Fix SDK detection to work with modern versions of Xcode.

This finds the the OS X SDK directory by using xcrun and known fallbacks; users shouldn't be symlinking /Developer.
This commit is contained in:
Jake Petroules 2014-10-15 18:56:37 -07:00
parent e3d57af4fd
commit 67f17a0fda
1 changed files with 18 additions and 1 deletions

View File

@ -554,7 +554,24 @@ class InternalCommands:
return (major, minor, rev)
def getMacSdkDir(self):
return "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk"
sdkName = "macosx" + self.macSdk
# Ideally we'll use xcrun (which is influenced by $DEVELOPER_DIR), then try a couple
# fallbacks to known paths if xcrun is not available
status, sdkPath = commands.getstatusoutput("xcrun --show-sdk-path --sdk " + sdkName)
if status == 0 and sdkPath:
return sdkPath
developerDir = os.getenv("DEVELOPER_DIR")
if not developerDir:
developerDir = "/Applications/Xcode.app/Contents/Developer"
sdkDirName = sdkName.replace("macosx", "MacOSX")
sdkPath = developerDir + "/Platforms/MacOSX.platform/Developer/SDKs/" + sdkDirName + ".sdk"
if os.path.exists(sdkPath):
return sdkPath
return "/Developer/SDKs/" + sdkDirName + ".sdk"
# http://tinyurl.com/cs2rxxb
def fixCmakeEclipseBug(self):