native
native copied to clipboard
Variable to find the SDK directories on macOS
Apple seems to move around it's framework headers. Currently, on my machine, they have paths like:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h
previously they looked like:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h
It would be nice to have a magic variable that can be used in ffigen.yaml so that you can write paths like this:
$SDK/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h
@liamappelbe I'm assuming "Backlog" means this isn't on the short-term roadmap currently? This seems like a blocker for adoption in flutter/packages, because any hard-coded path is not guaranteed to work for anyone else, since Xcode can be moved or renamed.
Having a variable that ffigen will map to the value of xcode-select -p is the only way to make a config file that is portable to other developers/machines.
Ok, I can bump the priority on this one
Played around with some options. I think we'll want a few different variables:
$XCODE:xcode-select -p- eg
/Applications/Xcode.app/Contents/Developer
- eg
$IOS_SDK:xcrun --show-sdk-path --sdk iphoneos- eg
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk
- eg
$MACOS_SDK:xcrun --show-sdk-path --sdk macosx- eg
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk
- eg