diff options
| author | Nathaniel Cesario <nathaniel@lunarg.com> | 2020-09-23 17:46:04 -0600 |
|---|---|---|
| committer | ncesario-lunarg <71668273+ncesario-lunarg@users.noreply.github.com> | 2020-09-29 15:04:56 -0600 |
| commit | c5c6265c026e4d6cc2826aedf86f5eb352dc470d (patch) | |
| tree | 0008828549923b5175b2fb8b6fa88e9b93388bc4 /scripts/fetch_glslangvalidator.py | |
| parent | 02cdef3dfe626c2b8f35c7706c04592a3cf78308 (diff) | |
| download | usermoji-c5c6265c026e4d6cc2826aedf86f5eb352dc470d.tar.xz | |
build: Fix linux/windows build in single directory
Allows a single worktree to be used by multiple platforms for builds.
Change-Id: I5078eaee6f62757ebb431fdc22405cab77d2356e
Diffstat (limited to 'scripts/fetch_glslangvalidator.py')
| -rwxr-xr-x | scripts/fetch_glslangvalidator.py | 22 |
1 files changed, 12 insertions, 10 deletions
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() |
