pd-rs / crank

A wrapper for cargo to use creating games for the Playdate handheld gaming system.
MIT License
83 stars 16 forks source link

Check for the env var mentioned by playdate docs #14

Closed skeet70 closed 2 years ago

skeet70 commented 2 years ago

The official docs say to set PLAYDATE_SDK_PATH so it should be a pretty reliable way to find the SDK.

I've also got another branch off this one that makes everything work for my specific setup, but I haven't generalized it (my target is in a /tmp/ ramdisk). The one piece that may be generally useful there is this change which makes the run command use the SDK path too (open doesn't exist on my distro).

With the changes in both those branches done, I can confirm everything in hello_world (and crankstart-klondike) works on Arch Linux w/ kernel 5.15.33-1-lts.

rtsuk commented 2 years ago

I think this might break the existing behavior on Mac.

skeet70 commented 2 years ago

It seemed like the Mac docs didn't require, but suggested, setting the PLAYDATE_SDK_PATH. I kept the existing logic in the other end of the match arm, so if it's not set it should have the same behaviour it does currently. If it is set, it seems like it'd still work, since the goal is to find the SDK anyway?

rtsuk commented 2 years ago

Oh, yes, it should work fine.

skeet70 commented 2 years ago

It looks like the latest tag in panic's distribution server is gone, I pinned it to the most recent .pkg for now. Seems like it'll be annoying though going forward, not sure if you want to do something more elaborate long term.

rtsuk commented 2 years ago

I will defer to @boozook who set this up initially on how to handle it.

lilyinstarlight commented 2 years ago

The latest tag is still there, but as of SDK 1.9.3, macOS versions are distributed as .zip (with the .pkg inside)

See https://github.com/lilyinstarlight/crank/commit/2a666446e3e895729b5c50b8bd5fce4c40e61b75 which I intended to PR but hadn't gotten around to it yet

rtsuk commented 2 years ago

Might as well merge this in, but @lilyinstarlight a PR of that change would be great.

lilyinstarlight commented 2 years ago

I just got home, so I rebased and opened #15 real quick with the change. I had a few other branches I wanted to PR so I'll see if I can't make them PR-ready and open those tonight too :)

boozook commented 2 years ago

👋 @skeet70

It seemed like the Mac docs didn't require, but suggested, setting the PLAYDATE_SDK_PATH. I agree. Seems to there's two ways for macOS prioritised in following order:

  1. env PLAYDATE_SDK_PATH
  2. config in $HOME

And just env PLAYDATE_SDK_PATH for linux.

So I'm sure a good solution for any platform will be next:

  1. try get env var
  2. (skip if 1. succeed) try read config as fallback for first step
  3. call which pdc, then use that path
  4. check hardcoded default paths I'm not sure about ordering for steps 3 and 4, maybe need swap.

Also for future after all we should determine the version of SDK/pdc and warn if it old or crank not tested with it.