From c5c6265c026e4d6cc2826aedf86f5eb352dc470d Mon Sep 17 00:00:00 2001 From: Nathaniel Cesario Date: Wed, 23 Sep 2020 17:46:04 -0600 Subject: build: Fix linux/windows build in single directory Allows a single worktree to be used by multiple platforms for builds. Change-Id: I5078eaee6f62757ebb431fdc22405cab77d2356e --- scripts/fetch_glslangvalidator.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'scripts/fetch_glslangvalidator.py') diff --git a/scripts/fetch_glslangvalidator.py b/scripts/fetch_glslangvalidator.py index 8be68e85..936def89 100755 --- a/scripts/fetch_glslangvalidator.py +++ b/scripts/fetch_glslangvalidator.py @@ -32,11 +32,14 @@ import ssl import subprocess import urllib.request import zipfile +import platform SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__)) REPO_DIR = os.path.join(SCRIPTS_DIR, '..') GLSLANG_URL = "https://github.com/KhronosGroup/glslang/releases/download/7.9.2888" +def platformDir(): return platform.system().lower() + if __name__ == '__main__': if len(sys.argv) != 2: print("ERROR -- must include a single glslang release zipfile name argument") @@ -45,19 +48,18 @@ if __name__ == '__main__': GLSLANG_FILENAME = sys.argv[1] GLSLANG_COMPLETE_URL = GLSLANG_URL + "/" + GLSLANG_FILENAME GLSLANG_OUTFILENAME = os.path.join(REPO_DIR, "glslang", GLSLANG_FILENAME) - GLSLANG_VALIDATOR_PATH = os.path.join(REPO_DIR, "glslang", "bin") - GLSLANG_VALIDATOR_FULL_PATH = os.path.join(REPO_DIR, "glslang", "bin", "glslangValidator") - GLSLANG_DIR = os.path.join(REPO_DIR, "glslang") + GLSLANG_DIR = os.path.join(REPO_DIR, "glslang", platformDir()) + GLSLANG_VALIDATOR_PATH = os.path.join(GLSLANG_DIR, "bin") + GLSLANG_VALIDATOR_FULL_PATH = os.path.join(GLSLANG_VALIDATOR_PATH, "glslangValidator") + if platform.system() == 'Windows': + GLSLANG_VALIDATOR_FULL_PATH = GLSLANG_VALIDATOR_FULL_PATH + '.exe' if os.path.isdir(GLSLANG_DIR): - if os.path.isdir(GLSLANG_VALIDATOR_PATH): - dir_contents = os.listdir(GLSLANG_VALIDATOR_PATH) - for afile in dir_contents: - if "glslangValidator" in afile: - print(" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH) - sys.exit(); + if os.path.exists(GLSLANG_VALIDATOR_FULL_PATH): + print(" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH) + sys.exit() else: - os.mkdir(GLSLANG_DIR) + os.makedirs(GLSLANG_DIR) print(" Downloading glslangValidator binary from glslang releases dir") sys.stdout.flush() -- cgit v1.2.3