Merge pull request #21339 from Placinta/master

Fix regular macOS build by passing -isysroot to compiler so correct system headers are found
This commit is contained in:
Rémi Verschelde 2018-11-20 14:11:13 +01:00 committed by GitHub
commit a2a5793e13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 4 deletions

View file

@ -628,3 +628,27 @@ def CommandNoCache(env, target, sources, command, **args):
result = env.Command(target, sources, command, **args)
env.NoCache(result)
return result
def detect_darwin_sdk_path(platform, env):
sdk_name = ''
if platform == 'osx':
sdk_name = 'macosx'
var_name = 'MACOS_SDK_PATH'
elif platform == 'iphone':
sdk_name = 'iphoneos'
var_name = 'IPHONESDK'
elif platform == 'iphonesimulator':
sdk_name = 'iphonesimulator'
var_name = 'IPHONESDK'
else:
raise Exception("Invalid platform argument passed to detect_darwin_sdk_path")
if not env[var_name]:
try:
sdk_path = subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip()
if sdk_path:
env[var_name] = sdk_path
except (subprocess.CalledProcessError, OSError) as e:
print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
raise