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