Skip to content

Commit a7f113d

Browse files
authored
Merge pull request swiftlang#29671 from compnerd/cmake-harder
CI: stylistic changes to simplify script
2 parents 94cd804 + 8679ca2 commit a7f113d

File tree

1 file changed

+20
-36
lines changed

1 file changed

+20
-36
lines changed

utils/build-windows.bat

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,8 @@ endlocal
146146
:: Configures, builds, and installs LLVM
147147
setlocal enableextensions enabledelayedexpansion
148148

149-
mkdir "%build_root%\llvm" %exitOnError%
150-
pushd "%build_root%\llvm"
151-
152-
cmake "%source_root%\llvm"^
149+
cmake^
150+
-B "%build_root%\llvm"^
153151
-G Ninja^
154152
-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
155153
-DCMAKE_C_COMPILER=cl^
@@ -175,9 +173,8 @@ cmake "%source_root%\llvm"^
175173
-DCLANG_TOOLS="clang;clang-format;clang-headers;clang-tidy"^
176174
-DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
177175
-DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
178-
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%
179-
180-
popd
176+
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
177+
-S "%source_root%\llvm" %exitOnError%
181178

182179
cmake --build "%build_root%\llvm" %exitOnError%
183180
cmake --build "%build_root%\llvm" --target install %exitOnError%
@@ -190,19 +187,16 @@ endlocal
190187
:: Configures and builds CMark
191188
setlocal enableextensions enabledelayedexpansion
192189

193-
mkdir "%build_root%\cmark" %exitOnError%
194-
pushd "%build_root%\cmark"
195-
196-
cmake "%source_root%\cmark"^
190+
cmake^
191+
-B "%build_root%\cmark"^
197192
-G Ninja^
198193
-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
199194
-DCMAKE_C_COMPILER=cl^
200195
-DCMAKE_CXX_COMPILER=cl^
201196
-DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
202197
-DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
203-
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%
204-
205-
popd
198+
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
199+
-S "%source_root%\cmark" %exitOnError%
206200

207201
cmake --build "%build_root%\cmark" %exitOnError%
208202

@@ -214,12 +208,10 @@ endlocal
214208
:: Configures, builds, and installs Swift and the Swift Standard Library
215209
setlocal enableextensions enabledelayedexpansion
216210

217-
mkdir "%build_root%\swift" %exitOnError%
218-
pushd "%build_root%\swift"
219-
220211
:: SWIFT_PARALLEL_LINK_JOBS=8 allows the build machine to use as many CPU as
221212
:: possible, while not exhausting the RAM.
222-
cmake "%source_root%\swift"^
213+
cmake^
214+
-B "%build_root%\swift"^
223215
-G Ninja^
224216
-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
225217
-DCMAKE_C_COMPILER=cl^
@@ -247,9 +239,8 @@ cmake "%source_root%\swift"^
247239
-DPYTHON_EXECUTABLE:PATH=%PYTHON_HOME%\python.exe^
248240
-DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
249241
-DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
250-
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%
251-
252-
popd
242+
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
243+
-S "%source_root%\swift" %exitOnError%
253244

254245
cmake --build "%build_root%\swift" %exitOnError%
255246
cmake --build "%build_root%\swift" --target install %exitOnError%
@@ -272,10 +263,8 @@ endlocal
272263
:: Configures, builds, and installs LLDB
273264
setlocal enableextensions enabledelayedexpansion
274265

275-
mkdir "%build_root%\lldb" %exitOnError%
276-
pushd "%build_root%\lldb"
277-
278-
cmake "%source_root%\lldb"^
266+
cmake^
267+
-B "%build_root%\lldb"^
279268
-G Ninja^
280269
-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
281270
-DCMAKE_C_COMPILER=clang-cl^
@@ -291,9 +280,8 @@ cmake "%source_root%\lldb"^
291280
-DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
292281
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
293282
-DLLDB_DISABLE_PYTHON=YES^
294-
-DLLDB_INCLUDE_TESTS:BOOL=NO %exitOnError%
295-
296-
popd
283+
-DLLDB_INCLUDE_TESTS:BOOL=NO^
284+
-S "%source_root%\lldb" %exitOnError%
297285

298286
cmake --build "%build_root%\lldb" %exitOnError%
299287
cmake --build "%build_root%\lldb" --target install %exitOnError%
@@ -306,10 +294,8 @@ endlocal
306294
:: Configures, builds, and installs Dispatch
307295
setlocal enableextensions enabledelayedexpansion
308296

309-
mkdir "%build_root%\swift-corelibs-libdispatch" %exitOnError%
310-
pushd "%build_root%\swift-corelibs-libdispatch"
311-
312-
cmake "%source_root%\swift-corelibs-libdispatch"^
297+
cmake^
298+
-B "%build_root%\swift-corelibs-libdispatch"^
313299
-G Ninja^
314300
-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
315301
-DCMAKE_C_COMPILER=clang-cl^
@@ -327,10 +313,8 @@ cmake "%source_root%\swift-corelibs-libdispatch"^
327313
-DCMAKE_SHARED_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
328314
-DCMAKE_Swift_COMPILER_TARGET:STRING=x86_64-unknown-windows-msvc^
329315
-DCMAKE_Swift_FLAGS:STRING="-resource-dir \"%install_directory%\lib\swift\""^
330-
-DCMAKE_Swift_LINK_FLAGS:STRING="-resource-dir \"%install_directory%\lib\swift\"" %exitOnError%
331-
332-
333-
popd
316+
-DCMAKE_Swift_LINK_FLAGS:STRING="-resource-dir \"%install_directory%\lib\swift\""^
317+
-S "%source_root%\swift-corelibs-libdispatch" %exitOnError%
334318

335319
cmake --build "%build_root%\swift-corelibs-libdispatch" %exitOnError%
336320
cmake --build "%build_root%\swift-corelibs-libdispatch" --target install %exitOnError%

0 commit comments

Comments
 (0)