import os, sys, pprint, re, json, pathlib, hashlib, subprocess, glob
executePath = os.getcwd()
scriptPath = os.path.dirname(os.path.realpath(__file__))
def finish(code):
global executePath
os.chdir(executePath)
sys.exit(code)
def error(text):
print('[ERROR] ' + text)
finish(1)
win = (sys.platform == 'win32')
mac = (sys.platform == 'darwin')
win32 = win and (os.environ['Platform'] == 'x86')
win64 = win and (os.environ['Platform'] == 'x64')
if win and not 'COMSPEC' in os.environ:
error('COMSPEC environment variable is not set.')
if win and not win32 and not win64:
error('Make sure to run from Native Tools Command Prompt.')
os.chdir(scriptPath + '/../../../..')
pathSep = ';' if win else ':'
libsLoc = 'Libraries' if not win64 else (os.path.join('Libraries', 'win64'))
keysLoc = 'cache_keys'
rootDir = os.getcwd()
libsDir = os.path.realpath(os.path.join(rootDir, libsLoc))
thirdPartyDir = os.path.realpath(os.path.join(rootDir, 'ThirdParty'))
usedPrefix = os.path.realpath(os.path.join(libsDir, 'local'))
optionsList = [
'skip-release',
'build-qt5',
'skip-qt5',
'build-qt6',
'skip-qt6',
'build-stackwalk',
]
options = []
runCommand = []
customRunCommand = False
for arg in sys.argv[1:]:
if customRunCommand:
runCommand.append(arg)
if arg in optionsList:
options.append(arg)
elif arg == 'run':
customRunCommand = True
buildQt5 = not 'skip-qt5' in options if win else 'build-qt5' in options
buildQt6 = 'build-qt6' in options if win else not 'skip-qt6' in options
if not os.path.isdir(os.path.join(libsDir, keysLoc)):
pathlib.Path(os.path.join