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 REM // ======== Parameter parsing ======== //
26 set arg-use-implicit-component-list=1
37 if "%1"=="" goto:parameterContinue
39 if "%1" == "--glslang" (
41 set arg-use-implicit-component-list=0
42 echo Building glslang ^(%1^)
49 set arg-use-implicit-component-list=0
50 echo Building glslang ^(%1^)
55 if "%1" == "--no-sync" (
57 echo Skipping sync ^(%1^)
62 if "%1" == "--no-build" (
64 echo Skipping build ^(%1^)
71 echo 32-bit build requested
78 echo 64-bit build requested
83 if "%1" == "--debug" (
85 echo debug build requested
90 if "%1" == "--release" (
92 echo release build requested
97 if "%1" == "--spirv-tools" (
98 echo --spirv-tools argument has been deprecated and is no longer necessary
104 echo --s argument has been deprecated and is no longer necessary
110 echo --all argument has been deprecated and is no longer necessary
112 set arg-use-implicit-component-list=0
113 echo Building glslang ^(%1^)
119 echo Unrecognized option "%1"
121 echo usage: update_external_sources.bat [options]
123 echo Available options:
124 echo -g ^| --glslang enable glslang component
125 echo --all enable all components
126 echo --no-sync skip sync from git
127 echo --no-build skip build
128 echo --32 build for 32-bit
129 echo --64 build for 64-bit
130 echo --debug build for debug
131 echo --release build for release
133 echo If any component enables are provided, only those components are enabled.
134 echo If no component enables are provided, all components are enabled.
136 echo Sync uses git to pull a specific revision.
137 echo Build configures CMake, builds Release and Debug.
139 echo --32 without --64 builds only 32-bit, and vice-versa.
140 echo --debug without --release builds only debug, and vice-versa.
141 echo Specifying neither or both --32 and --64 builds both.
142 echo Specifying neither or both --debug and --release builds both.
143 echo So specifying none of these 4 options (default) builds all 4.
150 if %arg-use-implicit-component-list% equ 1 (
151 echo Building glslang
157 set check-glslang-build-dependencies=0
159 if %arg-do-glslang% equ 1 (
160 if %arg-no-sync% equ 0 (
163 if %arg-no-build% equ 0 (
164 set check-glslang-build-dependencies=1
182 if %arg-debug% equ 1 (
185 if %arg-release% equ 1 (
188 if %arg-debug% equ 0 (
189 if %arg-release% equ 0 (
195 REM this is a debugging aid that can be enabled while debugging command-line parsing
200 set check-glslang-build-dependencies
204 REM // ======== end Parameter parsing ======== //
207 REM // ======== Dependency checking ======== //
208 REM git is required for all paths
209 for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
210 if not defined FOUND (
211 echo Dependency check failed:
212 echo git.exe not found
213 echo Git for Windows can be downloaded here: https://git-scm.com/download/win
214 echo Install and ensure git.exe makes it into your PATH
218 if %check-glslang-build-dependencies% equ 1 (
219 for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
220 if not defined FOUND (
221 echo Dependency check failed:
222 echo cmake.exe not found
223 echo Get CMake for Windows here: http://www.cmake.org/cmake/resources/software.html
224 echo Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
232 REM // ======== end Dependency checking ======== //
236 if %errorCode% neq 0 (goto:error)
238 REM Read the target versions from external file, which is shared with Linux script
240 if not exist %REVISION_DIR%\glslang_giturl (
242 echo Missing glslang_giturl file! Place it in %REVISION_DIR% with git repo URL in it.
247 if not exist %REVISION_DIR%\glslang_revision (
249 echo Missing glslang_revision file! Place it in %REVISION_DIR% with target version in it.
254 set /p GLSLANG_GITURL= < %REVISION_DIR%\glslang_giturl
255 set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
257 echo GLSLANG_GITURL=%GLSLANG_GITURL%
258 echo GLSLANG_REVISION=%GLSLANG_REVISION%
261 echo Creating and/or updating glslang in %BASE_DIR%
263 if %sync-glslang% equ 1 (
264 if not exist %GLSLANG_DIR% (
267 if %errorCode% neq 0 (goto:error)
269 if %errorCode% neq 0 (goto:error)
272 if %build-glslang% equ 1 (
274 if %errorCode% neq 0 (goto:error)
283 echo Halting due to error
288 if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% )
292 REM // ======== Functions ======== //
296 echo Creating local glslang repository %GLSLANG_DIR%)
299 git clone %GLSLANG_GITURL% .
300 git checkout %GLSLANG_REVISION%
301 python.exe .\update_glslang_sources.py
302 if not exist %GLSLANG_DIR%\SPIRV (
303 echo glslang source download failed!
310 echo Updating %GLSLANG_DIR%
313 git checkout %GLSLANG_REVISION%
314 python.exe .\update_glslang_sources.py
319 echo Building %GLSLANG_DIR%
322 if not exist build32 (
329 set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build32
331 echo Making 32-bit glslang
332 echo *************************
333 cd %GLSLANG_BUILD_DIR%
335 echo Generating 32-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
336 cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..
338 if %do_debug% equ 1 (
339 echo Building 32-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
340 msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
342 REM Check for existence of one lib, even though we should check for all results
343 if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
345 echo glslang 32-bit Debug build failed!
349 if %do_release% equ 1 (
350 echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
351 msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
353 REM Check for existence of one lib, even though we should check for all results
354 if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
356 echo glslang 32-bit Release build failed!
363 set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build
365 echo Making 64-bit glslang
366 echo *************************
367 cd %GLSLANG_BUILD_DIR%
369 echo Generating 64-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
370 cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..
372 if %do_debug% equ 1 (
373 echo Building 64-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
374 msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
376 REM Check for existence of one lib, even though we should check for all results
377 if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
379 echo glslang 64-bit Debug build failed!
383 if %do_release% equ 1 (
384 echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
385 msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
387 REM Check for existence of one lib, even though we should check for all results
388 if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
390 echo glslang 64-bit Release build failed!