xb premake: Allow the premake script to bootstrap premake.

This commit is contained in:
Dr. Chat 2017-01-26 23:57:04 -06:00
parent 1eb0048e54
commit 73d3697efc
1 changed files with 18 additions and 18 deletions

View File

@ -307,7 +307,6 @@ def get_clang_format_binary():
print 'See docs/style_guide.md for instructions on how to get it.' print 'See docs/style_guide.md for instructions on how to get it.'
sys.exit(1) sys.exit(1)
def run_premake(target_os, action): def run_premake(target_os, action):
"""Runs premake on the main project with the given format. """Runs premake on the main project with the given format.
@ -329,28 +328,30 @@ def run_premake(target_os, action):
if ret == 0: if ret == 0:
generate_version_h() generate_version_h()
return ret
def run_premake_clean(): def run_premake_clean():
"""Runs a premake clean operation. """Runs a premake clean operation.
""" """
if sys.platform == 'darwin': if sys.platform == 'darwin':
run_premake('macosx', 'clean') return run_premake('macosx', 'clean')
elif sys.platform == 'win32': elif sys.platform == 'win32':
run_premake('windows', 'clean') return run_premake('windows', 'clean')
else: else:
run_premake('linux', 'clean') return run_premake('linux', 'clean')
def run_platform_premake(): def run_platform_premake():
"""Runs all gyp configurations. """Runs all gyp configurations.
""" """
if sys.platform == 'darwin': if sys.platform == 'darwin':
run_premake('macosx', 'xcode4') return run_premake('macosx', 'xcode4')
elif sys.platform == 'win32': elif sys.platform == 'win32':
run_premake('windows', 'vs2015') return run_premake('windows', 'vs2015')
else: else:
run_premake('linux', 'gmake') ret = run_premake('linux', 'gmake')
run_premake('linux', 'codelite') ret = ret != 0 and run_premake('linux', 'codelite') or ret
return ret
def run_premake_export_commands(): def run_premake_export_commands():
@ -472,10 +473,10 @@ class SetupCommand(Command):
print('') print('')
print('- running premake...') print('- running premake...')
run_platform_premake() if run_platform_premake() == 0:
print('') print('')
print('Success!')
print('Success!')
return 0 return 0
@ -522,10 +523,10 @@ class PullCommand(Command):
print('') print('')
print('- running premake...') print('- running premake...')
run_platform_premake() if run_platform_premake() == 0:
print('') print('')
print('Success!')
print('Success!')
return 0 return 0
@ -540,13 +541,12 @@ class PremakeCommand(Command):
*args, **kwargs) *args, **kwargs)
def execute(self, args, pass_args, cwd): def execute(self, args, pass_args, cwd):
# Update premake. If no binary found, it will be built from source.
print('Running premake...') print('Running premake...')
print('') print('')
if run_platform_premake() == 0:
print('Success!')
# Update premake.
run_platform_premake()
print('Success!')
return 0 return 0