Skip to content

Commit 5f50f67

Browse files
authored
Update WindowsBuild.md
- remove numbers on steps, they get out of sync and auto-numbering headers doesn't work - correct some header titles - re-render the tree to be ascii pretty - split out "one-time setup" from "getting started" - fix invocation of cmake for toolchain - fix libdispatch build rules - convert libdispatch build rules to be copy-paste friendly - add libdispatch test instructions
1 parent 5f3b1da commit 5f50f67

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

docs/WindowsBuild.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
Visual Studio 2017 or newer is needed to build swift on Windows.
44

5-
## 1. Install dependencies
5+
## Install dependencies
66
- Install the latest version of [Visual Studio](https://www.visualstudio.com/downloads/)
7-
- Make sure to include "Programming Languages|Visual C++" and "Windows and Web
8-
Development|Universal Windows App Development|Windows SDK" in your
9-
installation.
7+
- Make sure to include "Programming Languages|Visual C++" and "Windows and Web Development|Universal Windows App Development|Windows SDK" in your installation.
108

11-
## 1. Clone the repositories
9+
## Clone the repositories
1210
1. Clone `apple/llvm-project` into a directory for the toolchain
1311
1. Clone `apple/swift-cmark`, `apple/swift`, `apple/swift-corelibs-libdispatch`, `apple/swift-corelibs-foundation`, `apple/swift-corelibs-xctest`, `apple/swift-llbuild`, `apple/swift-package-manager` into the toolchain directory
1412
1. Clone `compnerd/windows-swift` as a peer of the toolchain directory
@@ -34,19 +32,24 @@ git clone -c core.autocrlf=input https://github.com/apple/swift-package-manager
3432
git clone https://github.com/compnerd/windows-swift windows-swift
3533
```
3634

37-
## 1. Acquire ICU, SQLite3, curl, libxml2
35+
## Acquire ICU, SQLite3, curl, libxml2, zlib
3836
1. Go to https://dev.azure.com/compnerd/windows-swift and scroll down to "Dependencies" where you'll see bots (hopefully green) for icu, SQLite, curl, and libxml2. Download each of the zip files and copy their contents into S:/Library. The directory structure should resemble:
3937

4038
```
41-
S:/Library/
42-
/icu-64/usr
43-
/libcurl-development/usr
44-
/libxml2-development/usr
45-
/sqlite-3.28.0/usr
46-
/zlib-1.2.11/usr
39+
/Library
40+
┝ icu-64
41+
│ ┕ usr/...
42+
├ libcurl-development
43+
│ ┕ usr/...
44+
├ libxml2-development
45+
│ ┕ usr/...
46+
├ sqlite-3.28.0
47+
│ ┕ usr/...
48+
┕ zlib-1.2.11
49+
┕ usr/...
4750
```
4851

49-
## 1. Get ready
52+
## Get ready
5053
- From within a **NATIVE developer** command prompt (not PowerShell nor cmd, but the [Visual Studio Developer Command Prompt](https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx)), execute the following command if you have an x64 PC (The Native Developer command prompt is situated at "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019.lnk").
5154

5255
Run this as administrator the first time, for setting up the symlinks below.
@@ -62,6 +65,7 @@ VsDevCmd -arch=x86
6265
(`Debug`, `RelWithDebInfoAssert` or `Release`) to avoid conflicts between the debug and
6366
non-debug version of the MSCRT library.
6467

68+
## One-time Setup (re-run on Visual Studio upgrades)
6569
- Set up the `ucrt`, `visualc`, and `WinSDK` modules by copying `ucrt.modulemap` located at
6670
`swift/stdlib/public/Platform/ucrt.modulemap` into
6771
`${UniversalCRTSdkDir}/Include/${UCRTVersion}/ucrt` as `module.modulemap`, copying `visualc.modulemap` located at `swift/stdlib/public/Platform/visualc.modulemap` into `${VCToolsInstallDir}/include` as `module.modulemap`, and copying `winsdk.modulemap` located at `swift/stdlib/public/Platform/winsdk.modulemap` into `${UniversalCRTSdkDir}/Include/${UCRTVersion}/um` and setup the `visualc.apinotes` located at `swift/stdlib/public/Platform/visualc.apinotes` into `${VCToolsInstallDir}/include` as `visualc.apinotes`
@@ -75,12 +79,12 @@ mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Pla
7579

7680
Warning: Creating the above links usually requires administrator privileges. The quick and easy way to do this is to open a second developer prompt by right clicking whatever shortcut you used to open the first one, choosing Run As Administrator, and pasting the above commands into the resulting window. You can then close the privileged prompt; this is the only step which requires elevation.
7781

78-
## 1. Build toolchain
82+
## Build the toolchain
7983
- This must be done from within a developer command prompt. Make sure that the build type for LLVM/Clang is compatible with the build type for Swift. That is, either build everything `Debug` or some variant of `Release` (e.g. `Release`, `RelWithDebInfo`).
8084

8185
```cmd
8286
md "S:\b\toolchain"
83-
cmake -B "S:\b\toolchain" -G Ninja -C S:\windows-swift\cmake\caches\Windows-x86_64.cmake -C S:\windows-swift\cmake\caches\org.compnerd.dt.cmake -DLLVM_ENABLE_ASSERTIONS=YES -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cmark;swift;lldb" -DLLVM_EXTERNAL_PROJECTS="cmark;swift" -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\llvm-project\swift-corelibs-libdispatch -DLLVM_ENABLE_PDB=YES -DLLDB_DISABLE_PYTHON=YES -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" -DSWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" -DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib" -DCMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" -DPYTHON_EXECUTABLE=C:\Python27\python.exe
87+
cmake -B "S:\b\toolchain" -G Ninja -S S:\toolchain\llvm -C S:\windows-swift\cmake\caches\Windows-x86_64.cmake -C S:\windows-swift\cmake\caches\org.compnerd.dt.cmake -DLLVM_ENABLE_ASSERTIONS=YES -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cmark;swift;lldb;lld" -DLLVM_EXTERNAL_PROJECTS="cmark;swift" -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\llvm-project\swift-corelibs-libdispatch -DLLVM_ENABLE_PDB=YES -DLLDB_DISABLE_PYTHON=YES -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" -DSWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" -DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib" -DCMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" -DPYTHON_EXECUTABLE=C:\Python27\python.exe -DSWIFT_BUILD_DYNAMIC_STDLIB=YES -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=YES
8488
ninja -C S:\b\toolchain
8589
```
8690

@@ -90,7 +94,7 @@ ninja -C S:\b\toolchain
9094
path S:\b\toolchain\bin;%PATH%
9195
```
9296

93-
## 1. Running tests on Windows
97+
## Running tests on Windows
9498

9599
Running the testsuite on Windows has additional external dependencies.
96100

@@ -99,28 +103,25 @@ path S:\Library\icu-64\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\libdispatch-pre
99103
ninja -C S:\b\toolchain check-swift
100104
```
101105

102-
## 1. Build swift-corelibs-libdispatch
106+
## Build swift-corelibs-libdispatch
103107

104108
```cmd
105-
md "S:\b\libdispatch"
106-
cd "S:\b\libdispatch"
107-
cmake -G Ninja^
108-
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
109-
-DCMAKE_C_COMPILER=clang-cl^
110-
-DCMAKE_CXX_COMPILER=clang-cl^
111-
-DCMAKE_SWIFT_COMPILER=S:\b\toolchain\bin\swiftc.exe^
112-
-DENABLE_SWIFT=ON^
113-
-DENABLE_TESTING=OFF^
114-
S:\toolchain\swift-corelibs-libdispatch
115-
ninja
109+
cmake -B S:\b\libdispatch -G Ninja -S S:\toolchain\swift-corelibs-libdispatch -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_Swift_COMPILER=S:\b\toolchain\bin\swiftc.exe -DENABLE_SWIFT=YES
110+
ninja -C S:\b\libdispatch
116111
```
117112

118113
- Add libdispatch to your path:
119114
```cmd
120115
path S:\b\libdispatch;S:\b\libdispatch\src;%PATH%
121116
```
122117

123-
## 1. Build swift-corelibs-foundation
118+
## Test swift-corelibs-libdispatch
119+
120+
```cmd
121+
ninja -C S:\b\libdispatch check
122+
```
123+
124+
## Build swift-corelibs-foundation
124125

125126
```cmd
126127
md "S:\b\foundation"
@@ -146,7 +147,7 @@ ninja
146147
path S:\b\foundation;%PATH%
147148
```
148149

149-
## 1. Build swift-corelibs-xctest
150+
## Build swift-corelibs-xctest
150151

151152
```cmd
152153
md "S:\b\xctest"
@@ -169,13 +170,13 @@ ninja
169170
path S:\b\xctest;%PATH%
170171
```
171172

172-
## 1. Test XCTest
173+
## Test XCTest
173174

174175
```cmd
175176
ninja -C S:\b\xctest check-xctest
176177
```
177178

178-
## 1. Rebuild Foundation
179+
## Rebuild Foundation
179180

180181
```cmd
181182
cd "S:\b\foundation
@@ -196,14 +197,14 @@ cmake -G Ninja^
196197
ninja
197198
```
198199

199-
## 1. Test Foundation
200+
## Test Foundation
200201

201202
```cmd
202203
cmake --build S:\b\foundation
203204
ninja -C S:\b\foundation test
204205
```
205206

206-
## 1. Build llbuild
207+
## Build llbuild
207208

208209
```cmd
209210
md S:\b\llbuild
@@ -228,15 +229,15 @@ ninja
228229
path S:\b\llbuild\bin;%PATH%
229230
```
230231

231-
## 1. Build swift-package-manager
232+
## Build swift-package-manager
232233

233234
```cmd
234235
md S:\b\spm
235236
cd S:\b\spm
236237
C:\Python27\python.exe S:\swift-package-manager\Utilities\bootstrap --foundation S:\b\foundation --libdispatch-build-dir S:\b\libdispatch --libdispatch-source-dir S:\swift-corelibs-libdispatch --llbuild-build-dir S:\b\llbuild --llbuild-source-dir S:\llbuild --sqlite-build-dir S:\b\sqlite --sqlite-source-dir S:\sqlite-amalgamation-3270200
237238
```
238239

239-
## 1. Install Swift on Windows
240+
## Install Swift on Windows
240241

241242
- Run ninja install:
242243

0 commit comments

Comments
 (0)