layers: Avoid warnings in vk_layer_logging.h
[platform/upstream/Vulkan-LoaderAndValidationLayers.git] / build_windows_targets.bat
1 echo off
2 REM
3 REM This Windows batch file builds this repository for the following targets:
4 REM 64/32-bit Release/Debug
5 REM It uses CMake to genererate the project files and then invokes msbuild
6 REM to build them.
7 REM The update_external_sources.bat batch file must be executed before running
8 REM this batch file
9 REM
10 REM Arguments:
11 REM None: Runs CMake and builds all 4 combinations
12 REM Argument contains:
13 REM     cmake (case insensitive): Deletes build and build32 and runs just CMake on both
14 REM     32: Deletes build32, runs CMake and builds 32-bit versions
15 REM     64: Deletes build, runs CMake and builds 64-bit versions
16 REM     debug (case insensitive): Builds just the debug config of a 32 and/or 64-bit build
17 REM     release (case insensitive): Builds just the release config of a 32 and/or 64-bit build
18 REM Notes:
19 REM cmake: When specified, generate the CMake build files only - don't compile
20 REM 32/64: Specifying neither or both builds both
21 REM debug/release: Specifying neither or both builds both
22 REM Examples:
23 REM build_windows_targets.bat 64
24 REM   -- deletes build, creates build, runs CMake and compiles 64-bit Debug and Release.
25 REM build_windows_targets.bat 64 debug
26 REM   -- deletes build, creates build, runs CMake and compiles 64-bit Debug.
27
28 set arg_cmake=0
29 set arg_32=0
30 set arg_64=0
31 set arg_debug=0
32 set arg_release=0
33
34 set do_cmake=0
35 set do_32=0
36 set do_64=0
37 set do_debug=0
38 set do_release=0
39
40 for %%a in (%*) do (
41     echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set arg_cmake=1)
42     echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set arg_32=1)
43     echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set arg_64=1)
44     echo.%%a | %WINDIR%\system32\find.exe /I "debug">Nul && (set arg_debug=1)
45     echo.%%a | %WINDIR%\system32\find.exe /I "release">Nul && (set arg_release=1)
46 )
47
48 if %arg_32%==1 (
49     set do_32=1
50 )
51 if %arg_64%==1 (
52     set do_64=1
53 )
54 if %arg_32%==0 (
55     if %arg_64%==0 (
56         set do_32=1
57         set do_64=1
58     )
59 )
60
61 if %arg_debug%==1 (
62     set do_debug=1
63 )
64 if %arg_release%==1 (
65     set do_release=1
66 )
67 if %arg_debug%==0 (
68     if %arg_release%==0 (
69         set do_debug=1
70         set do_release=1
71     )
72 )
73
74 if %arg_cmake%==1 (
75     set do_cmake=1
76     set do_32=0
77     set do_64=0
78     set do_debug=0
79     set do_release=0
80 )
81
82 REM Determine the appropriate CMake strings for the current version of Visual Studio
83 echo Determining VS version
84 python .\scripts\determine_vs_version.py > vsversion.tmp
85 set /p VS_VERSION=< vsversion.tmp
86 echo Detected Visual Studio Version as %VS_VERSION%
87 del /Q /F vsversion.tmp
88
89 if %do_cmake%==1 (
90     rmdir /Q /S build
91     rmdir /Q /S build32
92     mkdir build
93     pushd build
94     echo Generating 64-bit CMake files for Visual Studio %VS_VERSION%
95     cmake -G "Visual Studio %VS_VERSION% Win64" ..
96     popd
97     mkdir build32
98     pushd build32
99     echo Generating 32-bit CMake files for Visual Studio %VS_VERSION%
100     cmake -G "Visual Studio %VS_VERSION%" ..
101     popd
102 )
103
104 REM *******************************************
105 REM 64-bit build
106 REM *******************************************
107 if %do_64%==1 (
108     rmdir /Q /S build
109     mkdir build
110     pushd build
111     echo Generating 64-bit CMake files for Visual Studio %VS_VERSION%
112     cmake -G "Visual Studio %VS_VERSION% Win64" ..
113     if %do_debug% equ 1 (
114         echo Building 64-bit Debug 
115         msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /maxcpucount /verbosity:quiet
116         if errorlevel 1 (
117         echo.
118         echo 64-bit Debug build failed!
119         popd
120         exit /b 1
121         )
122     )
123    
124     if %do_release%==1 (
125         echo Building 64-bit Release 
126         msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /maxcpucount /verbosity:quiet
127         if errorlevel 1 (
128         echo.
129         echo 64-bit Release build failed!
130         popd
131         exit /b 1
132         )
133     )
134     popd
135 )
136  
137 REM *******************************************
138 REM 32-bit build
139 REM *******************************************
140   
141 if %do_32%==1 (
142     rmdir /Q /S build32
143     mkdir build32
144     pushd build32
145     echo Generating 32-bit CMake files for Visual Studio %VS_VERSION%
146     cmake -G "Visual Studio %VS_VERSION%" ..
147     if %do_debug%==1 (
148         echo Building 32-bit Debug 
149         msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /maxcpucount /verbosity:quiet
150         if errorlevel 1 (
151         echo.
152         echo 32-bit Debug build failed!
153         popd
154         exit /b 1
155         )
156     )
157
158     if %do_release%==1 (
159         echo Building 32-bit Release 
160         msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /maxcpucount /verbosity:quiet
161         if errorlevel 1 (
162         echo.
163         echo 32-bit Release build failed!
164         popd
165         exit /b 1
166         )
167     )
168     popd
169 )
170 exit /b 0