diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/methods.py b/methods.py index 111a2347be..f8fc6c64ef 100644 --- a/methods.py +++ b/methods.py @@ -6,7 +6,7 @@ import glob import string import datetime import subprocess -from compat import iteritems, isbasestring +from compat import iteritems, isbasestring, decode_utf8 def add_source_files(self, sources, filetype, lib_env=None, shared=False): @@ -591,7 +591,7 @@ def generate_vs_project(env, num_jobs): release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe'] targets = debug_targets + release_targets + release_debug_targets if not env.get('MSVS'): - env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' + env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' env['MSVS']['SOLUTIONSUFFIX'] = '.sln' env.MSVSProject( target=['#godot' + env['MSVSPROJECTSUFFIX']], @@ -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 = decode_utf8(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 + |