-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-windows.bat
executable file
·245 lines (218 loc) · 6.15 KB
/
build-windows.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
@echo off
setlocal
set sourcedir=%1
if not exist "%sourcedir%" (
echo %sourcedir%: Source directory does not exist
exit /b 1
)
set tag=%2
if "%tag%" EQU "" (
echo No tag name specified
exit /b 1
)
set noextra=-DGLFW_BUILD_TESTS=NO -DGLFW_BUILD_EXAMPLES=NO -DGLFW_BUILD_DOCS=NO
rem HTML documentation
setlocal
call :build_docs
endlocal
rem MinGW-w64 32-bit
setlocal
path ..\mingw32\bin;%PATH%
set targetdir=glfw-%tag%.bin.WIN32/lib-mingw-w64
set toolchain=w64-i686
call :build_mingw_static
call :build_mingw_dll
endlocal
rem MinGW-w64 64-bit
setlocal
path ..\mingw64\bin;%PATH%
set targetdir=glfw-%tag%.bin.WIN64/lib-mingw-w64
set toolchain=w64-x86_64
call :build_mingw_static
call :build_mingw_dll
endlocal
rem Visual C++ 2013 32-bit
setlocal
set generator=Visual Studio 12 2013
set arch=Win32
set toolset=v120_xp
set targetdir=glfw-%tag%.bin.WIN32\lib-vc2013
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2013 64-bit
setlocal
set generator=Visual Studio 12 2013
set arch=x64
set toolset=v120_xp
set targetdir=glfw-%tag%.bin.WIN64\lib-vc2013
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2015 32-bit
setlocal
set generator=Visual Studio 14 2015
set arch=Win32
set toolset=v140_xp
set targetdir=glfw-%tag%.bin.WIN32\lib-vc2015
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2015 64-bit
setlocal
set generator=Visual Studio 14 2015
set arch=x64
set toolset=v140_xp
set targetdir=glfw-%tag%.bin.WIN64\lib-vc2015
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2017 32-bit
setlocal
set generator=Visual Studio 15 2017
set arch=Win32
set toolset=v141_xp
set targetdir=glfw-%tag%.bin.WIN32\lib-vc2017
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2017 64-bit
setlocal
set generator=Visual Studio 15 2017
set arch=x64
set toolset=v141_xp
set targetdir=glfw-%tag%.bin.WIN64\lib-vc2017
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2019 32-bit
setlocal
set generator=Visual Studio 16 2019
set arch=Win32
set toolset=v142
set targetdir=glfw-%tag%.bin.WIN32\lib-vc2019
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2019 64-bit
setlocal
set generator=Visual Studio 16 2019
set arch=x64
set toolset=v142
set targetdir=glfw-%tag%.bin.WIN64\lib-vc2019
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2019 32-bit DLL with static UCRT
setlocal
set generator=Visual Studio 16 2019
set arch=Win32
set toolset=v142
set targetdir=glfw-%tag%.bin.WIN32\lib-static-ucrt
call :build_vs_dll_mt
endlocal
rem Visual C++ 2019 64-bit with static UCRT
setlocal
set generator=Visual Studio 16 2019
set arch=x64
set toolset=v142
set targetdir=glfw-%tag%.bin.WIN64\lib-static-ucrt
call :build_vs_dll_mt
endlocal
rem Visual C++ 2022 32-bit
setlocal
set generator=Visual Studio 17 2022
set arch=Win32
set toolset=v143
set targetdir=glfw-%tag%.bin.WIN32\lib-vc2022
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
rem Visual C++ 2022 64-bit
setlocal
set generator=Visual Studio 17 2022
set arch=x64
set toolset=v143
set targetdir=glfw-%tag%.bin.WIN64\lib-vc2022
call :build_vs_static
call :build_vs_static_mt
call :build_vs_dll
endlocal
endlocal
exit /b 0
:build_docs
set CFLAGS=-s -Werror
set builddir=build\docs
cmake -E make_directory %builddir%
cmake -S "%sourcedir%" -B %builddir% -DGLFW_BUILD_WIN32=0 -DDOXYGEN_EXECUTABLE=..\doxygen\doxygen.exe
cmake --build %builddir% --target docs
cmake -E copy_directory %builddir%\docs\html glfw-%tag%\docs\html
cmake -E copy_directory %builddir%\docs\html glfw-%tag%.bin.WIN32\docs\html
cmake -E copy_directory %builddir%\docs\html glfw-%tag%.bin.WIN64\docs\html
exit /b 0
:build_mingw_static
set CFLAGS=-s -Werror
set builddir=build\mingw-%toolchain%-static
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "MinGW Makefiles" %noextra% -DCMAKE_BUILD_TYPE=Release
cmake --build %builddir%
cmake -E copy %builddir%\src\libglfw3.a %targetdir%
exit /b 0
:build_mingw_dll
set CFLAGS=-s -Werror
set builddir=build\mingw-%toolchain%-dll
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "MinGW Makefiles" %noextra% -DBUILD_SHARED_LIBS=YES -DCMAKE_BUILD_TYPE=Release
cmake --build %builddir%
cmake -E copy %builddir%\src\libglfw3dll.a %targetdir%
cmake -E copy %builddir%\src\glfw3.dll %targetdir%
exit /b 0
:build_vs_static
set CFLAGS=/WX
set builddir=build\vs-%toolset%-%arch%-static
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "%generator%" -A %arch% -T %toolset% %noextra%
cmake --build %builddir% --config Release
cmake -E copy %builddir%\src\Release\glfw3.lib %targetdir%
exit /b 0
:build_vs_static_mt
set CFLAGS=/WX
set builddir=build\vs-%toolset%-%arch%-static-mt
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "%generator%" -A %arch% -T %toolset% %noextra% -DUSE_MSVC_RUNTIME_LIBRARY_DLL=OFF
cmake --build %builddir% --config Release
cmake -E copy %builddir%\src\Release\glfw3.lib %targetdir%\glfw3_mt.lib
exit /b 0
:build_vs_dll
set CFLAGS=/WX
set builddir=build\vs-%toolset%-%arch%-dll
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "%generator%" -A %arch% -T %toolset% %noextra% -DBUILD_SHARED_LIBS=YES
cmake --build %builddir% --config Release
cmake -E copy %builddir%\src\Release\glfw3dll.lib %targetdir%
cmake -E copy %builddir%\src\Release\glfw3.dll %targetdir%
exit /b 0
:build_vs_dll_mt
set CFLAGS=/WX
set builddir=build\vs-%toolset%-%arch%-dll-mt
cmake -E make_directory %builddir%
cmake -E make_directory %targetdir%
cmake -S "%sourcedir%" -B %builddir% -G "%generator%" -A %arch% -T %toolset% %noextra% -DBUILD_SHARED_LIBS=YES -DUSE_MSVC_RUNTIME_LIBRARY_DLL=OFF
cmake --build %builddir% --config Release
cmake -E copy %builddir%\src\Release\glfw3dll.lib %targetdir%
cmake -E copy %builddir%\src\Release\glfw3.dll %targetdir%
exit /b 0