update_external_sources.bat revision 48fb978db696f2a2216a02b6abf44e9d9bf7d25e
1@echo off
2REM Update source for glslang, LunarGLASS, spirv-tools
3
4REM Determine the appropriate CMake strings for the current version of Visual Studio
5echo Determining VS version
6python .\determine_vs_version.py > vsversion.tmp
7set /p VS_VERSION=< vsversion.tmp
8echo Detected Visual Studio Version as %VS_VERSION%
9
10REM from that information set the appropriate MSBUILD machine target as weell.
11echo Determining MSBUILD target
12set MSBUILD_MACHINE_TARGET=x64
13@setlocal
14@echo off
15echo.%VS_VERSION% | findstr /C:"Win32" 1>nul
16if errorlevel 1 (
17  echo.
18) ELSE (
19  set MSBUILD_MACHINE_TARGET=x86
20)
21endlocal
22echo Detected MSBuild target as %MSBUILD_MACHINE_TARGET%
23
24REM Cleanup the file we used to collect the VS version output since it's no longer needed.
25del /Q /F vsversion.tmp
26
27REM Determine if SVN exists, this is a requirement for LunarGLASS
28set SVN_EXE_FOUND=0
29for %%X in (svn.exe) do (set FOUND=%%~$PATH:X)
30if defined FOUND (
31 set SVN_EXE_FOUND=1
32)
33
34setlocal EnableDelayedExpansion
35set errorCode=0
36set BUILD_DIR=%~dp0
37set BASE_DIR=%BUILD_DIR%..
38set GLSLANG_DIR=%BASE_DIR%\glslang
39set LUNARGLASS_DIR=%BASE_DIR%\LunarGLASS
40set SPIRV_TOOLS_DIR=%BASE_DIR%\spirv-tools
41
42REM // ======== Parameter parsing ======== //
43
44   if "%1" == "" (
45      echo usage: update_external_sources.bat [options]
46      echo.
47      echo Available options:
48      echo   --sync-glslang      just pull glslang_revision
49      echo   --sync-LunarGLASS   just pull LunarGLASS_revision
50      echo   --sync-spirv-tools  just pull spirv-tools_revision
51      echo   --build-glslang     pulls glslang_revision, configures CMake, builds Release and Debug
52      echo   --build-LunarGLASS  pulls LunarGLASS_revision, configures CMake, builds Release and Debug
53      echo   --build-spirv-tools pulls spirv-tools_revision, configures CMake, builds Release and Debug
54      echo   --all               sync and build glslang, LunarGLASS, spirv-tools
55      goto:finish
56   )
57
58   set sync-glslang=0
59   set sync-LunarGLASS=0
60   set sync-spirv-tools=0
61   set build-glslang=0
62   set build-LunarGLASS=0
63   set build-spirv-tools=0
64   set check-glslang-build-dependencies=0
65   set check-LunarGLASS-fetch-dependencies=0
66   set check-LunarGLASS-build-dependencies=0
67
68   :parameterLoop
69
70      if "%1"=="" goto:parameterContinue
71
72      if "%1" == "--sync-glslang" (
73         set sync-glslang=1
74         shift
75         goto:parameterLoop
76      )
77
78      if "%1" == "--sync-LunarGLASS" (
79         set sync-LunarGLASS=1
80         set check-LunarGLASS-fetch-dependencies=1
81         shift
82         goto:parameterLoop
83      )
84
85	  if "%1" == "--sync-spirv-tools" (
86         set sync-spirv-tools=1
87         shift
88         goto:parameterLoop
89      )
90
91      if "%1" == "--build-glslang" (
92         set sync-glslang=1
93         set check-glslang-build-dependencies=1
94         set build-glslang=1
95         shift
96         goto:parameterLoop
97      )
98
99      if "%1" == "--build-LunarGLASS" (
100         set sync-LunarGLASS=1
101         set check-LunarGLASS-fetch-dependencies=1
102         set check-LunarGLASS-build-dependencies=1
103         set build-LunarGLASS=1
104         shift
105         goto:parameterLoop
106      )
107
108	  if "%1" == "--build-spirv-tools" (
109         set sync-spirv-tools=1
110		 REM glslang has the same needs as spirv-tools
111         set check-glslang-build-dependencies=1
112         set build-spirv-tools=1
113         shift
114         goto:parameterLoop
115      )
116
117      if "%1" == "--all" (
118         set sync-glslang=1
119         set sync-spirv-tools=1
120         set build-glslang=1
121         set build-spirv-tools=1
122         set check-glslang-build-dependencies=1
123         
124         REM Only attempt to build LunarGLASS if we find SVN
125         if %SVN_EXE_FOUND% equ 1 (
126             set sync-LunarGLASS=1
127             set build-LunarGLASS=1
128             set check-LunarGLASS-fetch-dependencies=1
129             set check-LunarGLASS-build-dependencies=1
130         )
131         shift
132         goto:parameterLoop
133      )
134
135      echo Unrecognized options "%1"
136      goto:error
137
138   :parameterContinue
139
140REM // ======== end Parameter parsing ======== //
141
142
143REM // ======== Dependency checking ======== //
144   REM git is required for all paths
145   for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
146   if not defined FOUND (
147      echo Dependency check failed:
148      echo   git.exe not found
149      echo   Git for Windows can be downloaded here:  https://git-scm.com/download/win
150      echo   Install and ensure git.exe makes it into your PATH
151      set errorCode=1
152   )
153
154   if %check-LunarGLASS-fetch-dependencies% equ 1 (
155      if %SVN_EXE_FOUND% equ 0 (
156         echo Dependency check failed:
157         echo   svn.exe not found
158         echo   Get Subversion for Windows here:  http://sourceforge.net/projects/win32svn/
159         echo   Install and ensure svn.exe makes it into your PATH, default is "C:\Program Files (x86)\Subversion\bin"
160         set errorCode=1
161      )
162
163      for %%X in (wget.exe) do (set FOUND=%%~$PATH:X)
164      if not defined FOUND (
165         echo Dependency check failed:
166         echo   wget.exe not found
167         echo   Get wget for Windows here:  http://gnuwin32.sourceforge.net/packages/wget.htm
168         echo   Easiest to select "Complete package, except sources" link which will install and setup PATH
169         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\GnuWin32\bin"
170         set errorCode=1
171      )
172
173      for %%X in (gzip.exe) do (set FOUND=%%~$PATH:X)
174      if not defined FOUND (
175         echo Dependency check failed:
176         echo   gzip.exe not found
177         echo   Get gzip for Windows here:  http://gnuwin32.sourceforge.net/packages/gzip.htm
178         echo   Easiest to select "Complete package, except sources" link which will install and setup PATH
179         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\GnuWin32\bin"
180         set errorCode=1
181      )
182
183      for %%X in (tar.exe) do (set FOUND=%%~$PATH:X)
184      if not defined FOUND (
185         echo Dependency check failed:
186         echo   tar.exe not found
187         echo   Get tar for Windows here:  http://gnuwin32.sourceforge.net/packages/gtar.htm
188         echo   Easiest to select Binaries/Setup link which will install and setup PATH
189         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\GnuWin32\bin"
190         set errorCode=1
191      )
192   )
193
194   if %check-glslang-build-dependencies% equ 1 (
195      for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
196      if not defined FOUND (
197         echo Dependency check failed:
198         echo   cmake.exe not found
199         echo   Get CNake 2.8 for Windows here:  http://www.cmake.org/cmake/resources/software.html
200         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
201         set errorCode=1
202      )
203   )
204
205   if %check-LunarGLASS-build-dependencies% equ 1 (
206      for %%X in (python.exe) do (set FOUND=%%~$PATH:X)
207      if not defined FOUND (
208         echo Dependency check failed:
209         echo   python.exe not found
210         echo   Get python 2.7x for Windows here:  http://www.python.org/download/releases/2.7.6/
211         echo   Install and ensure each makes it into your PATH, default is "C:\Python27"
212         set errorCode=1
213      )
214
215      for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
216      if not defined FOUND (
217         echo Dependency check failed:
218         echo   cmake.exe not found
219         echo   Get CNake 2.8 for Windows here:  http://www.cmake.org/cmake/resources/software.html
220         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
221         set errorCode=1
222      )
223   )
224
225   REM goto:main
226
227REM // ======== end Dependency checking ======== //
228
229:main
230
231if %errorCode% neq 0 (goto:error)
232
233REM Read the target versions from external file, which is shared with Linux script
234if not exist LunarGLASS_revision (
235   echo.
236   echo Missing LunarGLASS_revision file!  Place it next to this script with target version in it.
237   set errorCode=1
238   goto:error
239)
240
241if not exist glslang_revision (
242   echo.
243   echo Missing glslang_revision file!  Place it next to this script with target version in it.
244   set errorCode=1
245   goto:error
246)
247
248if not exist spirv-tools_revision (
249   echo.
250   echo Missing spirv-tools_revision file!  Place it next to this script with target version in it.
251   set errorCode=1
252   goto:error
253)
254
255set /p LUNARGLASS_REVISION= < LunarGLASS_revision
256set /p GLSLANG_REVISION= < glslang_revision
257set /p SPIRV_TOOLS_REVISION= < spirv-tools_revision
258echo LUNARGLASS_REVISION=%LUNARGLASS_REVISION%
259echo GLSLANG_REVISION=%GLSLANG_REVISION%
260echo SPIRV_TOOLS_REVISION=%SPIRV_TOOLS_REVISION%
261
262set /p LUNARGLASS_REVISION_R32= < LunarGLASS_revision_R32
263echo LUNARGLASS_REVISION_R32=%LUNARGLASS_REVISION_R32%
264
265echo Creating and/or updating glslang, LunarGLASS, spirv-tools in %BASE_DIR%
266
267if %sync-glslang% equ 1 (
268   rd /S /Q %GLSLANG_DIR%
269   if not exist %GLSLANG_DIR% (
270      call:create_glslang
271   )
272   if %errorCode% neq 0 (goto:error)
273   call:update_glslang
274   if %errorCode% neq 0 (goto:error)
275)
276
277if %sync-LunarGLASS% equ 1 (
278   rd /S /Q %LUNARGLASS_DIR%
279   if not exist %LUNARGLASS_DIR% (
280      call:create_LunarGLASS
281   )
282   if %errorCode% neq 0 (goto:error)
283   call:update_LunarGLASS
284   if %errorCode% neq 0 (goto:error)
285)
286
287if %sync-spirv-tools% equ 1 (
288   rd /S /Q %SPIRV_TOOLS_DIR%
289   if %errorlevel% neq 0 (goto:error)
290   if not exist %SPIRV_TOOLS_DIR% (
291      call:create_spirv-tools
292   )
293   if %errorCode% neq 0 (goto:error)
294   call:update_spirv-tools
295   if %errorCode% neq 0 (goto:error)
296)
297
298if %build-glslang% equ 1 (
299   call:build_glslang
300   if %errorCode% neq 0 (goto:error)
301)
302
303if %build-LunarGLASS% equ 1 (
304   call:build_LunarGLASS
305   if %errorCode% neq 0 (goto:error)
306)
307
308if %build-spirv-tools% equ 1 (
309   call:build_spirv-tools
310   if %errorCode% neq 0 (goto:error)
311)
312
313echo.
314echo Exiting
315goto:finish
316
317:error
318echo.
319echo Halting due to error
320goto:finish
321
322:finish
323if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% )
324endlocal
325goto:eof
326
327
328
329REM // ======== Functions ======== //
330
331:create_glslang
332   echo.
333   echo Creating local glslang repository %GLSLANG_DIR%)
334   mkdir %GLSLANG_DIR%
335   cd %GLSLANG_DIR%
336   git clone git@gitlab.khronos.org:GLSL/glslang.git .
337   git checkout %GLSLANG_REVISION%
338   if not exist %GLSLANG_DIR%\SPIRV (
339      echo glslang source download failed!
340      set errorCode=1
341   )
342goto:eof
343
344:update_glslang
345   echo.
346   echo Updating %GLSLANG_DIR%
347   cd %GLSLANG_DIR%
348   git fetch --all
349   git checkout %GLSLANG_REVISION%
350goto:eof
351
352:create_LunarGLASS
353   REM Windows complains if it can't find the directory below, no need to call
354   REM rd /S /Q %LUNARGLASS_DIR%
355   echo.
356   echo Creating local LunarGLASS repository %LUNARGLASS_DIR%)
357   mkdir %LUNARGLASS_DIR%
358   cd %LUNARGLASS_DIR%
359   git clone https://github.com/LunarG/LunarGLASS.git .
360   git checkout %LUNARGLASS_REVISION%
361   cd Core\LLVM
362   echo.
363   echo Downloading LLVM archive...
364   wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz
365   REM tar on windows can't filter through gzip, so the below line doesn't work
366   REM tar --gzip -xf llvm-3.4.src.tar.gz
367   echo.
368   echo Unzipping the archive...
369   echo gzip --decompress --verbose --keep llvm-3.4.src.tar.gz
370   gzip --decompress --verbose --keep llvm-3.4.src.tar.gz
371   echo.
372   echo Extracting the archive... (this is slow)
373   echo tar -xf llvm-3.4.src.tar
374   tar -xf llvm-3.4.src.tar
375   if not exist %LUNARGLASS_DIR%\Core\LLVM\llvm-3.4\lib (
376      echo .
377      echo LLVM source download failed!
378      echo Delete LunarGLASS directory and try again
379      set errorCode=1
380      goto:eof
381   )
382   echo.
383   echo Syncing LunarGLASS source...
384   cd %LUNARGLASS_DIR%
385   REM put back the LunarGLASS github versions of some LLVM files
386   git checkout -f .
387   REM overwrite with private gitlab versions of some files
388   svn checkout -r %LUNARGLASS_REVISION_R32% --force https://cvs.khronos.org/svn/repos/SPIRV/trunk/LunarGLASS/ .
389   svn revert -R .
390   if not exist %LUNARGLASS_DIR%\Frontends\SPIRV (
391      echo.
392      echo LunarGLASS source download failed!
393      set errorCode=1
394   )
395goto:eof
396
397:update_LunarGLASS
398   echo.
399   echo Updating %LUNARGLASS_DIR%
400   cd %LUNARGLASS_DIR%
401   git fetch --all
402   git checkout -f %LUNARGLASS_REVISION% .
403   if not exist %LUNARGLASS_DIR%\.svn (
404      svn checkout -r %LUNARGLASS_REVISION_R32% --force https://cvs.khronos.org/svn/repos/SPIRV/trunk/LunarGLASS/ .
405   )
406   svn update -r %LUNARGLASS_REVISION_R325
407   svn revert -R .
408goto:eof
409
410:create_spirv-tools
411   echo.
412   echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%)
413   mkdir %SPIRV_TOOLS_DIR%
414   cd %SPIRV_TOOLS_DIR%
415   git clone git@gitlab.khronos.org:spirv/spirv-tools.git .
416   git checkout %SPIRV_TOOLS_REVISION%
417   if not exist %SPIRV_TOOLS_DIR%\source (
418      echo spirv-tools source download failed!
419      set errorCode=1
420   )
421goto:eof
422
423:update_spirv-tools
424   echo.
425   echo Updating %SPIRV_TOOLS_DIR%
426   cd %SPIRV_TOOLS_DIR%
427   git fetch --all
428   git checkout %SPIRV_TOOLS_REVISION%
429goto:eof
430
431:build_glslang
432   echo.
433   echo Building %GLSLANG_DIR%
434   cd  %GLSLANG_DIR%
435
436   REM Cleanup any old directories lying around.
437   rmdir /s /q build32
438   rmdir /s /q build
439   
440   echo Making 32-bit glslang
441   echo *************************
442   mkdir build32
443   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build32
444   cd %GLSLANG_BUILD_DIR%
445
446   echo Generating 32-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
447   cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..
448   
449   echo Building 32-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
450   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
451   
452   REM Check for existence of one lib, even though we should check for all results
453   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslang.lib (
454      echo.
455      echo glslang 32-bit Debug build failed!
456      set errorCode=1
457   )
458   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
459   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
460   
461   REM Check for existence of one lib, even though we should check for all results
462   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
463      echo.
464      echo glslang 32-bit Release build failed!
465      set errorCode=1
466   )
467   
468   cd ..
469 
470   echo Making 64-bit glslang
471   echo *************************
472   mkdir build
473   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build
474   cd %GLSLANG_BUILD_DIR%
475
476   echo Generating 64-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
477   cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..
478   
479   echo Building 64-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
480   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
481   
482   REM Check for existence of one lib, even though we should check for all results
483   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslang.lib (
484      echo.
485      echo glslang 64-bit Debug build failed!
486      set errorCode=1
487   )
488   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
489   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
490   
491   REM Check for existence of one lib, even though we should check for all results
492   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
493      echo.
494      echo glslang 64-bit Release build failed!
495      set errorCode=1
496   )
497goto:eof
498
499:build_LunarGLASS
500   echo.
501   echo Building %LUNARGLASS_DIR%
502   set LLVM_DIR=%LUNARGLASS_DIR%\Core\LLVM\llvm-3.4
503   cd %LLVM_DIR%
504
505   REM Cleanup any old directories lying around.
506   rmdir /s /q build32
507   rmdir /s /q build
508   
509   echo Making 32-bit LLVM
510   echo *************************
511   mkdir build32
512   set LLVM_BUILD_DIR=%LLVM_DIR%\build32
513   cd %LLVM_BUILD_DIR%
514
515   echo Generating 32-bit LLVM CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
516   cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..
517   
518   echo Building 32-bit LLVM: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
519   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
520   REM Check for existence of one lib, even though we should check for all results
521   if not exist %LLVM_BUILD_DIR%\lib\Release\LLVMCore.lib (
522      echo.
523      echo LLVM 32-bit Release build failed!
524      set errorCode=1
525      goto:eof
526   )
527   REM disable Debug build of LLVM until LunarGLASS cmake files are updated to
528   REM handle Debug and Release builds of glslang simultaneously, instead of
529   REM whatever last lands in "./build32/install"
530   REM   echo Building 32-bit LLVM: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
531   REM   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
532   REM Check for existence of one lib, even though we should check for all results
533   REM   if not exist %LLVM_BUILD_DIR%\lib\Debug\LLVMCore.lib (
534   REM      echo.
535   REM      echo LLVM 32-bit Debug build failed!
536   REM      set errorCode=1
537   REM      goto:eof
538   REM   )
539   
540   cd ..
541 
542   echo Making 64-bit LLVM
543   echo *************************
544   mkdir build
545   set LLVM_BUILD_DIR=%LLVM_DIR%\build
546   cd %LLVM_BUILD_DIR%
547
548   echo Generating 64-bit LLVM CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
549   cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..
550   
551   echo Building 64-bit LLVM: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
552   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
553   REM Check for existence of one lib, even though we should check for all results
554   if not exist %LLVM_BUILD_DIR%\lib\Release\LLVMCore.lib (
555      echo.
556      echo LLVM 64-bit Release build failed!
557      set errorCode=1
558      goto:eof
559   )
560   REM disable Debug build of LLVM until LunarGLASS cmake files are updated to
561   REM handle Debug and Release builds of glslang simultaneously, instead of
562   REM whatever last lands in "./build32/install"
563   REM   echo Building 64-bit LLVM: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
564   REM   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
565   REM Check for existence of one lib, even though we should check for all results
566   REM   if not exist %LLVM_BUILD_DIR%\lib\Debug\LLVMCore.lib (
567   REM      echo.
568   REM      echo LLVM 64-bit Debug build failed!
569   REM      set errorCode=1
570   REM      goto:eof
571   REM   )
572
573   cd %LUNARGLASS_DIR%
574
575   REM Cleanup any old directories lying around.
576   rmdir /s /q build32
577   rmdir /s /q build
578   
579   echo Making 32-bit LunarGLASS
580   echo *************************
581   mkdir build32
582   set LUNARGLASS_BUILD_DIR=%LUNARGLASS_DIR%\build32
583   cd %LUNARGLASS_BUILD_DIR%
584   
585   echo Generating 32-bit LunarGlass CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
586   cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..
587   
588   echo Building 32-bit LunarGlass: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
589   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
590   
591   REM Check for existence of one lib, even though we should check for all results
592   if not exist %LUNARGLASS_BUILD_DIR%\Core\Release\core.lib (
593      echo.
594      echo LunarGLASS 32-bit Release build failed!
595      set errorCode=1
596      goto:eof
597   )
598   
599   REM disable Debug build of LunarGLASS until its cmake file can be updated to
600   REM handle Debug and Release builds of glslang simultaneously, instead of
601   REM whatever last lands in "./build/install"
602   REM   echo Building 32-bit LunarGlass: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
603   REM   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
604   REM Check for existence of one lib, even though we should check for all results
605   REM  if not exist %LUNARGLASS_BUILD_DIR%\Core\Debug\core.lib (
606   REM     echo.
607   REM     echo LunarGLASS 32-bit Debug build failed!
608   REM     set errorCode=1
609   REM     goto:eof
610   REM  )
611   
612   cd ..
613   
614   echo Making 64-bit LunarGLASS
615   echo *************************
616   mkdir build
617   set LUNARGLASS_BUILD_DIR=%LUNARGLASS_DIR%\build
618   cd %LUNARGLASS_BUILD_DIR%
619   
620   echo Generating 64-bit LunarGlass CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
621   cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..
622   
623   echo Building 64-bit LunarGlass: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
624   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
625   
626   REM Check for existence of one lib, even though we should check for all results
627   if not exist %LUNARGLASS_BUILD_DIR%\Core\Release\core.lib (
628      echo.
629      echo LunarGLASS 64-bit Release build failed!
630      set errorCode=1
631      goto:eof
632   )
633   
634   REM disable Debug build of LunarGLASS until its cmake file can be updated to
635   REM handle Debug and Release builds of glslang simultaneously, instead of
636   REM whatever last lands in "./build/install"
637   REM   echo Building 64-bit LunarGlass: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
638   REM   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
639   REM Check for existence of one lib, even though we should check for all results
640   REM  if not exist %LUNARGLASS_BUILD_DIR%\Core\Debug\core.lib (
641   REM     echo.
642   REM     echo LunarGLASS 64-bit Debug build failed!
643   REM     set errorCode=1
644   REM     goto:eof
645   REM  )
646goto:eof
647
648:build_spirv-tools
649   echo.
650   echo Building %SPIRV_TOOLS_DIR%
651   cd  %SPIRV_TOOLS_DIR%
652
653   REM Cleanup any old directories lying around.
654   rmdir /s /q build32
655   rmdir /s /q build
656   
657   echo Making 32-bit spirv-tools
658   echo *************************
659   mkdir build32
660   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build32
661   cd %SPIRV_TOOLS_BUILD_DIR%
662   
663   echo Generating 32-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
664   cmake -G "Visual Studio %VS_VERSION%" ..
665   
666   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug
667   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug
668   
669   REM Check for existence of one lib, even though we should check for all results
670   if not exist %SPIRV_TOOLS_BUILD_DIR%\Debug\SPIRV-Tools.lib (
671      echo.
672      echo spirv-tools 32-bit Debug build failed!
673      set errorCode=1
674   )
675   
676   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release
677   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release
678
679   REM Check for existence of one lib, even though we should check for all results
680   if not exist %SPIRV_TOOLS_BUILD_DIR%\Release\SPIRV-Tools.lib (
681      echo.
682      echo spirv-tools 32-bit Release build failed!
683      set errorCode=1
684   )
685   
686   cd ..
687 
688   echo Making 64-bit spirv-tools  
689   echo *************************
690   mkdir build
691   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build
692   cd %SPIRV_TOOLS_BUILD_DIR%
693   
694   echo Generating 64-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
695   cmake -G "Visual Studio %VS_VERSION% Win64" ..
696   
697   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug
698   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug
699   
700   REM Check for existence of one lib, even though we should check for all results
701   if not exist %SPIRV_TOOLS_BUILD_DIR%\Debug\SPIRV-Tools.lib (
702      echo.
703      echo spirv-tools 64-bit Debug build failed!
704      set errorCode=1
705   )
706   
707   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release
708   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release
709
710   REM Check for existence of one lib, even though we should check for all results
711   if not exist %SPIRV_TOOLS_BUILD_DIR%\Release\SPIRV-Tools.lib (
712      echo.
713      echo spirv-tools 64-bit Release build failed!
714      set errorCode=1
715   )
716goto:eof
717