2 REM Update source for glslang
4 REM Determine the appropriate CMake strings for the current version of Visual Studio
5 echo Determining VS version
6 python .\scripts\determine_vs_version.py > vsversion.tmp
7 set /p VS_VERSION=< vsversion.tmp
8 echo Detected Visual Studio Version as %VS_VERSION%
10 REM Cleanup the file we used to collect the VS version output since it's no longer needed.
11 del /Q /F vsversion.tmp
13 setlocal EnableDelayedExpansion
16 set BASE_DIR="%BUILD_DIR%external"
17 set REVISION_DIR="%BUILD_DIR%external_revisions"
18 set GLSLANG_DIR=%BASE_DIR%\glslang
24 git submodule update --init --recursive
26 REM // ======== Parameter parsing ======== //
28 set arg-use-implicit-component-list=1
39 if "%1"=="" goto:parameterContinue
41 if "%1" == "--glslang" (
43 set arg-use-implicit-component-list=0
44 echo Building glslang ^(%1^)
51 set arg-use-implicit-component-list=0
52 echo Building glslang ^(%1^)
57 if "%1" == "--no-sync" (
59 echo Skipping sync ^(%1^)
64 if "%1" == "--no-build" (
66 echo Skipping build ^(%1^)
73 echo 32-bit build requested
80 echo 64-bit build requested
85 if "%1" == "--debug" (
87 echo debug build requested
92 if "%1" == "--release" (
94 echo release build requested
99 if "%1" == "--spirv-tools" (
100 echo --spirv-tools argument has been deprecated and is no longer necessary
106 echo --s argument has been deprecated and is no longer necessary
112 echo --all argument has been deprecated and is no longer necessary
114 set arg-use-implicit-component-list=0
115 echo Building glslang ^(%1^)
121 echo Unrecognized option "%1"
123 echo usage: update_external_sources.bat [options]
125 echo Available options:
126 echo -g ^| --glslang enable glslang component
127 echo --all enable all components
128 echo --no-sync skip sync from git
129 echo --no-build skip build
130 echo --32 build for 32-bit
131 echo --64 build for 64-bit
132 echo --debug build for debug
133 echo --release build for release
135 echo If any component enables are provided, only those components are enabled.
136 echo If no component enables are provided, all components are enabled.
138 echo Sync uses git to pull a specific revision.
139 echo Build configures CMake, builds Release and Debug.
141 echo --32 without --64 builds only 32-bit, and vice-versa.
142 echo --debug without --release builds only debug, and vice-versa.
143 echo Specifying neither or both --32 and --64 builds both.
144 echo Specifying neither or both --debug and --release builds both.
145 echo So specifying none of these 4 options (default) builds all 4.
152 if %arg-use-implicit-component-list% equ 1 (
153 echo Building glslang
159 set check-glslang-build-dependencies=0
161 if %arg-do-glslang% equ 1 (
162 if %arg-no-sync% equ 0 (
165 if %arg-no-build% equ 0 (
166 set check-glslang-build-dependencies=1
184 if %arg-debug% equ 1 (
187 if %arg-release% equ 1 (
190 if %arg-debug% equ 0 (
191 if %arg-release% equ 0 (
197 REM this is a debugging aid that can be enabled while debugging command-line parsing
202 set check-glslang-build-dependencies
206 REM // ======== end Parameter parsing ======== //
209 REM // ======== Dependency checking ======== //
210 REM git is required for all paths
211 for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
212 if not defined FOUND (
213 echo Dependency check failed:
214 echo git.exe not found
215 echo Git for Windows can be downloaded here: https://git-scm.com/download/win
216 echo Install and ensure git.exe makes it into your PATH
220 if %check-glslang-build-dependencies% equ 1 (
221 for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
222 if not defined FOUND (
223 echo Dependency check failed:
224 echo cmake.exe not found
225 echo Get CMake for Windows here: http://www.cmake.org/cmake/resources/software.html
226 echo Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
234 REM // ======== end Dependency checking ======== //
238 if %errorCode% neq 0 (goto:error)
240 REM Read the target versions from external file, which is shared with Linux script
242 if not exist %REVISION_DIR%\glslang_giturl (
244 echo Missing glslang_giturl file! Place it in %REVISION_DIR% with git repo URL in it.
249 if not exist %REVISION_DIR%\glslang_revision (
251 echo Missing glslang_revision file! Place it in %REVISION_DIR% with target version in it.
256 set /p GLSLANG_GITURL= < %REVISION_DIR%\glslang_giturl
257 set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
259 echo GLSLANG_GITURL=%GLSLANG_GITURL%
260 echo GLSLANG_REVISION=%GLSLANG_REVISION%
263 echo Creating and/or updating glslang in %BASE_DIR%
265 if %sync-glslang% equ 1 (
266 if not exist %GLSLANG_DIR% (
269 if %errorCode% neq 0 (goto:error)
271 if %errorCode% neq 0 (goto:error)
274 if %build-glslang% equ 1 (
276 if %errorCode% neq 0 (goto:error)
285 echo Halting due to error
290 if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% )
294 REM // ======== Functions ======== //
298 echo Creating local glslang repository %GLSLANG_DIR%)
301 git clone %GLSLANG_GITURL% .
302 git checkout %GLSLANG_REVISION%
303 python.exe .\update_glslang_sources.py
304 if not exist %GLSLANG_DIR%\SPIRV (
305 echo glslang source download failed!
312 echo Updating %GLSLANG_DIR%
315 git checkout %GLSLANG_REVISION%
316 python.exe .\update_glslang_sources.py
321 echo Building %GLSLANG_DIR%
324 if not exist build32 (
331 set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build32
333 echo Making 32-bit glslang
334 echo *************************
335 cd %GLSLANG_BUILD_DIR%
337 echo Generating 32-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
338 cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..
340 if %do_debug% equ 1 (
341 echo Building 32-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
342 msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
344 REM Check for existence of one lib, even though we should check for all results
345 if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
347 echo glslang 32-bit Debug build failed!
351 if %do_release% equ 1 (
352 echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
353 msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
355 REM Check for existence of one lib, even though we should check for all results
356 if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
358 echo glslang 32-bit Release build failed!
365 set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build
367 echo Making 64-bit glslang
368 echo *************************
369 cd %GLSLANG_BUILD_DIR%
371 echo Generating 64-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
372 cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..
374 if %do_debug% equ 1 (
375 echo Building 64-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
376 msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
378 REM Check for existence of one lib, even though we should check for all results
379 if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
381 echo glslang 64-bit Debug build failed!
385 if %do_release% equ 1 (
386 echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
387 msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
389 REM Check for existence of one lib, even though we should check for all results
390 if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
392 echo glslang 64-bit Release build failed!