native icon indicating copy to clipboard operation
native copied to clipboard

Variable to find the SDK directories on macOS

Open brianquinlan opened this issue 2 years ago • 2 comments

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

brianquinlan avatar Mar 08 '23 22:03 brianquinlan

@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.

stuartmorgan-g avatar Sep 04 '24 19:09 stuartmorgan-g

Ok, I can bump the priority on this one

liamappelbe avatar Sep 04 '24 23:09 liamappelbe

Played around with some options. I think we'll want a few different variables:

  • $XCODE: xcode-select -p
    • eg /Applications/Xcode.app/Contents/Developer
  • $IOS_SDK: xcrun --show-sdk-path --sdk iphoneos
    • eg /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk
  • $MACOS_SDK: xcrun --show-sdk-path --sdk macosx
    • eg /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk

liamappelbe avatar Feb 18 '25 02:02 liamappelbe