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