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 7dd2db25ec
commit b644b1253d

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):