make premake lookup process look for global version
This commit is contained in:
parent
7d1785ce7e
commit
52bb8e4c1d
|
@ -15,7 +15,7 @@ import subprocess
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
from helpers import is_executable
|
from helpers import is_executable, get_bin, has_bin
|
||||||
|
|
||||||
|
|
||||||
self_path = os.path.dirname(os.path.abspath(__file__))
|
self_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -54,26 +54,32 @@ setup_premake_path_override()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# First try the freshly-built premake.
|
premake_build_bin = os.path.join(premake_path, 'bin', 'release', 'premake5')
|
||||||
premake5_bin = os.path.join(premake_path, 'bin', 'release', 'premake5')
|
premake_local_bin = os.path.join(self_path, 'bin', 'premake5')
|
||||||
if not is_executable(premake5_bin):
|
premake5_bin = None
|
||||||
# No fresh build, so fallback to checked in copy (which we may not have).
|
# First check if premake is available at the system level
|
||||||
premake5_bin = os.path.join(self_path, 'bin', 'premake5')
|
if has_bin('premake5'):
|
||||||
if not is_executable(premake5_bin):
|
premake5_bin = get_bin('premake5')
|
||||||
# Still no valid binary, so build it.
|
print('using the installed version of premake')
|
||||||
|
# Next try the freshly-built premake.
|
||||||
|
elif is_executable(premake_build_bin):
|
||||||
|
premake5_bin = premake_build_bin
|
||||||
|
print('using local build of premake')
|
||||||
|
# No fresh build, so fallback to checked in copy (which we may not have).
|
||||||
|
elif is_executable(premake_local_bin):
|
||||||
|
premake5_bin = premake_local_bin
|
||||||
|
print('using the local prebuilt premake')
|
||||||
|
# Still no valid binary, so build it.
|
||||||
|
else:
|
||||||
print('premake5 executable not found, attempting build...')
|
print('premake5 executable not found, attempting build...')
|
||||||
build_premake()
|
build_premake()
|
||||||
premake5_bin = os.path.join(premake_path, 'bin', 'release', 'premake5')
|
if is_executable(premake_build_bin):
|
||||||
if not is_executable(premake5_bin):
|
premake5_bin = premake_build_bin
|
||||||
# Nope, boned.
|
print('using local build of premake')
|
||||||
print('ERROR: cannot build premake5 executable.')
|
else:
|
||||||
sys.exit(1)
|
# Nope, boned.
|
||||||
|
print('ERROR: cannot build premake5 executable.')
|
||||||
# Ensure the submodule has been checked out.
|
sys.exit(1)
|
||||||
if not os.path.exists(os.path.join(premake_path, 'scripts', 'package.lua')):
|
|
||||||
print('third_party/premake-core was not present; run xb setup...')
|
|
||||||
sys.exit(1)
|
|
||||||
return
|
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
# Append the executable extension on windows.
|
# Append the executable extension on windows.
|
||||||
|
@ -91,6 +97,12 @@ def main():
|
||||||
def build_premake():
|
def build_premake():
|
||||||
"""Builds premake from source.
|
"""Builds premake from source.
|
||||||
"""
|
"""
|
||||||
|
# Ensure the submodule has been checked out.
|
||||||
|
if not os.path.exists(os.path.join(premake_path, 'scripts', 'package.lua')):
|
||||||
|
print('third_party/premake-core was not present; run xb setup...')
|
||||||
|
sys.exit(1)
|
||||||
|
return
|
||||||
|
|
||||||
# Ensure that on Android, premake-core is in the internal storage.
|
# Ensure that on Android, premake-core is in the internal storage.
|
||||||
clone_premake_to_internal_storage()
|
clone_premake_to_internal_storage()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
|
Loading…
Reference in New Issue