@@ -8,20 +8,10 @@ Visual Studio 2017 or newer is needed to build swift on Windows.
8
8
Development|Universal Windows App Development|Windows SDK" in your
9
9
installation.
10
10
11
- ## 2. Clone the repositories
12
- 1 . Configure git to work with Unix file endings (ie ` git config --global core.autocrlf false ` )
13
- 1 . Create a folder to contain all the Swift repositories
14
- 1 . Clone ` apple/swift-cmark ` into a folder named ` cmark `
15
- 1 . Clone ` apple/swift-clang ` into a folder named ` clang `
16
- 1 . Clone ` apple/swift-llvm ` into a folder named ` llvm `
17
- 1 . Clone ` apple/swift-compiler-rt ` into a folder named ` compiler-rt `
18
- 1 . Clone ` apple/swift ` into a folder named ` swift `
19
- 1 . Clone ` apple/swift-corelibs-libdispatch ` into a folder named ` swift-corelibs-libdispatch `
20
- 1 . Clone ` apple/swift-corelibs-foundation ` into a folder named ` swift-corelibs-foundation `
21
- 1 . Clone ` apple/swift-corelibs-xctest ` into a folder name ` swift-corelibs-xctest `
22
- 1 . Clone ` apple/swift-lldb ` into a folder named ` lldb `
23
- 1 . Clone ` apple/swift-llbuild ` into a folder named ` llbuild `
24
- 1 . Clone ` apple/swift-package-manager ` info a folder named ` swift-package-manager `
11
+ ## 1. Clone the repositories
12
+ 1 . Clone ` apple/llvm-project ` into a directory for the toolchain
13
+ 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
14
+ 1 . Clone ` compnerd/windows-swift ` as a peer of the toolchain directory
25
15
26
16
- Currently, other repositories in the Swift project have not been tested and may not be supported.
27
17
@@ -33,20 +23,18 @@ subst S: <path to sources>
33
23
34
24
``` cmd
35
25
S:
36
- git clone https://github.com/apple/swift-cmark cmark
37
- git clone https://github.com/apple/swift-clang clang
38
- git clone https://github.com/apple/swift-llvm llvm
39
- git clone https://github.com/apple/swift-compiler-rt compiler-rt
40
- git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift
41
- git clone https://github.com/apple/swift-corelibs-libdispatch
42
- git clone https://github.com/apple/swift-corelibs-foundation
43
- git clone https://github.com/apple/swift-corelibs-xctest
44
- git clone https://github.com/apple/swift-lldb lldb
45
- git clone https://github.com/apple/swift-llbuild llbuild
46
- git clone -c core.autocrlf=input https://github.com/apple/swift-package-manager
47
- ```
48
-
49
- ## 3. Acquire ICU, SQLite3, curl, libxml2
26
+ git clone https://github.com/apple/llvm-project --branch swift/master toolchain
27
+ git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift toolchain/swift
28
+ git clone https://github.com/apple/swift-cmark toolchain/cmark
29
+ git clone https://github.com/apple/swift-corelibs-libdispatch toolchain/swift-corelibs-libdispatch
30
+ git clone https://github.com/apple/swift-corelibs-foundation toolchain/swift-corelibs-foundation
31
+ git clone https://github.com/apple/swift-corelibs-xctest toolchain/swift-corelibs-xctest
32
+ git clone https://github.com/apple/swift-llbuild toolchain/llbuild
33
+ git clone -c core.autocrlf=input https://github.com/apple/swift-package-manager toolchain/swift-package-manager
34
+ git clone https://github.com/compnerd/windows-swift windows-swift
35
+ ```
36
+
37
+ ## 1. Acquire ICU, SQLite3, curl, libxml2
50
38
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:
51
39
52
40
```
@@ -58,7 +46,7 @@ S:/Library/
58
46
/zlib-1.2.11/usr
59
47
```
60
48
61
- ## 4 . Get ready
49
+ ## 1 . Get ready
62
50
- 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").
63
51
64
52
Run this as administrator the first time, for setting up the symlinks below.
@@ -87,114 +75,31 @@ mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Pla
87
75
88
76
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.
89
77
90
- ## 5. Build LLVM/Clang
91
- - This must be done from within a developer command prompt. Make sure that the build
92
- type for LLVM/Clang is compatible with the build type for Swift. That is,
93
- either build everything ` Debug ` or some variant of ` Release ` (e.g. ` Release ` ,
94
- ` RelWithDebInfo ` ).
95
- ``` cmd
96
- md "S:\b\llvm"
97
- cd "S:\b\llvm"
98
- cmake -G Ninja^
99
- -DCMAKE_BUILD_TYPE=Release^
100
- -DCMAKE_C_COMPILER=cl^
101
- -DCMAKE_CXX_COMPILER=cl^
102
- -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^
103
- -DLLVM_ENABLE_ASSERTIONS=ON^
104
- -DLLVM_ENABLE_PDB=YES^
105
- -DLLVM_ENABLE_PROJECTS=clang^
106
- -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86"^
107
- S:/llvm
108
- ninja
109
- ```
110
-
111
- - Update your path to include the LLVM tools.
112
-
113
- ``` cmd
114
- path S:\b\llvm\bin;%PATH%
115
- ```
116
- ## 6. Build CMark
117
- - This must be done from within a developer command prompt.
118
-
119
- ``` cmd
120
- md "S:\b\cmark"
121
- cd "S:\b\cmark"
122
- cmake -G Ninja^
123
- -DCMAKE_BUILD_TYPE=RelWithDebInfo^
124
- -DCMAKE_C_COMPILER=cl^
125
- -DCMAKE_CXX_COMPILER=cl^
126
- S:\cmark
127
- ninja
128
- ```
129
-
130
- ## 7. Build Swift
131
- - This must be done from within a developer command prompt
132
- - Note that Visual Studio vends a 32-bit python 2.7 installation in ` C:\Python27 ` and a 64-bit python in ` C:\Python27amd64 ` . You may use either one based on your installation.
133
-
134
- ``` cmd
135
- md "S:\b\swift"
136
- cd "S:\b\swift"
137
- cmake -G Ninja^
138
- -DCMAKE_BUILD_TYPE=RelWithDebInfo^
139
- -DCMAKE_C_COMPILER=cl^
140
- -DCMAKE_CXX_COMPILER=cl^
141
- -DCMAKE_EXE_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
142
- -DCMAKE_SHARED_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
143
- -DSWIFT_INCLUDE_DOCS=OFF^
144
- -DSWIFT_PATH_TO_CMARK_SOURCE="S:\cmark"^
145
- -DSWIFT_PATH_TO_CMARK_BUILD="S:\b\cmark"^
146
- -DLLVM_DIR=S:\b\llvm\lib\cmake\llvm^
147
- -DClang_DIR=S:\b\llvm\lib\cmake\clang^
148
- -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE="S:\swift-corelibs-libdispatch"^
149
- -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include"^
150
- -DSWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib"^
151
- -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include"^
152
- -DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib"^
153
- -DCMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr"^
154
- -DPYTHON_EXECUTABLE=C:\Python27\python.exe^
155
- S:\swift
156
- ninja
157
- ```
158
-
159
- - To create a Visual Studio project, you'll need to change the generator and,
160
- if you have a 64 bit processor, specify the generator platform. Note that you
161
- may get multiple build errors compiling the ` swift ` project due to an MSBuild
162
- limitation that file paths cannot exceed 260 characters. These can be
163
- ignored, as they occur after the build when writing the last build status to
164
- a file.
78
+ ## 1. Build toolchain
79
+ - 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 ` ).
165
80
166
81
``` cmd
167
- cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
82
+ 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
84
+ ninja -C S:\b\toolchain
168
85
```
169
86
170
- ## 8. Build lldb
171
- - This must be done from within a developer command prompt.
87
+ - Update your path to include the toolchain.
172
88
173
89
``` cmd
174
- md "S:\b\lldb"
175
- cd "S:\b\lldb"
176
- cmake -G Ninja^
177
- -DLLVM_DIR="S:/b/llvm/lib/cmake/llvm"^
178
- -DClang_DIR="S:/b/llvm/lib/cmake/clang"^
179
- -DSwift_DIR="S:/b/swift/lib/cmake/swift"^
180
- -DCMAKE_BUILD_TYPE=RelWithDebInfo^
181
- -DLLDB_USE_STATIC_BINDINGS=YES^
182
- -DLLVM_ENABLE_ASSERTIONS=ON^
183
- -DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
184
- S:\lldb
185
- ninja
90
+ path S:\b\toolchain\bin;%PATH%
186
91
```
187
92
188
- ## 9 . Running tests on Windows
93
+ ## 1 . Running tests on Windows
189
94
190
95
Running the testsuite on Windows has additional external dependencies.
191
96
192
97
``` cmd
193
- path S:\Library\icu-64\usr\bin;S:\b\swift \bin;S:\b\swift \libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
194
- ninja -C S:\b\swift check-swift
98
+ path S:\Library\icu-64\usr\bin;S:\b\toolchain \bin;S:\b\toolchain \libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
99
+ ninja -C S:\b\toolchain check-swift
195
100
```
196
101
197
- ## 10 . Build swift-corelibs-libdispatch
102
+ ## 1 . Build swift-corelibs-libdispatch
198
103
199
104
``` cmd
200
105
md "S:\b\libdispatch"
@@ -203,10 +108,10 @@ cmake -G Ninja^
203
108
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
204
109
-DCMAKE_C_COMPILER=clang-cl^
205
110
-DCMAKE_CXX_COMPILER=clang-cl^
206
- -DCMAKE_SWIFT_COMPILER=S:\b\swift \bin\swiftc.exe^
111
+ -DCMAKE_SWIFT_COMPILER=S:\b\toolchain \bin\swiftc.exe^
207
112
-DENABLE_SWIFT=ON^
208
113
-DENABLE_TESTING=OFF^
209
- S:\swift-corelibs-libdispatch
114
+ S:\toolchain\ swift-corelibs-libdispatch
210
115
ninja
211
116
```
212
117
@@ -215,21 +120,21 @@ ninja
215
120
path S:\b\libdispatch;S:\b\libdispatch\src;%PATH%
216
121
```
217
122
218
- ## 11 . Build swift-corelibs-foundation
123
+ ## 1 . Build swift-corelibs-foundation
219
124
220
125
``` cmd
221
126
md "S:\b\foundation"
222
127
cd "S:\b\foundation
223
128
cmake -G Ninja^
224
129
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
225
130
-DCMAKE_C_COMPILER=clang-cl^
226
- -DCMAKE_SWIFT_COMPILER=S:\b\swift \bin\swiftc.exe^
227
- -DCURL_LIBRARY="S:/curl/builds/ libcurl-vc15-x64-release-static-ipv6-sspi-winssl/ lib/libcurl_a .lib"^
228
- -DCURL_INCLUDE_DIR="S:/curl/builds/ libcurl-vc15-x64-release-static-ipv6-sspi-winssl /include"^
131
+ -DCMAKE_SWIFT_COMPILER=S:\b\toolchain \bin\swiftc.exe^
132
+ -DCURL_LIBRARY="S:/Library/ libcurl-development/usr/ lib/libcurl .lib"^
133
+ -DCURL_INCLUDE_DIR="S:/Library/ libcurl-development/usr /include"^
229
134
-DENABLE_TESTING=NO^
230
135
-DICU_ROOT="S:/Library/icu-64"^
231
- -DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a .lib"^
232
- -DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
136
+ -DLIBXML2_LIBRARY="S:/Library/ libxml2-development/usr/lib/libxml2 .lib"^
137
+ -DLIBXML2_INCLUDE_DIR="S:/Library/ libxml2-development/usr /include"^
233
138
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
234
139
-DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=S:\b\libdispatch^
235
140
S:\swift-corelibs-foundation
@@ -241,15 +146,15 @@ ninja
241
146
path S:\b\foundation;%PATH%
242
147
```
243
148
244
- ## 12 . Build swift-corelibs-xctest
149
+ ## 1 . Build swift-corelibs-xctest
245
150
246
151
``` cmd
247
152
md "S:\b\xctest"
248
153
cd "S:\b\xctest"
249
154
cmake -G Ninja^
250
155
-DBUILD_SHARED_LIBS=YES^
251
156
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
252
- -DCMAKE_SWIFT_COMPILER=S:\b\swift \bin\swiftc.exe^
157
+ -DCMAKE_SWIFT_COMPILER=S:\b\toolchain \bin\swiftc.exe^
253
158
-DXCTEST_PATH_TO_FOUNDATION_BUILD=S:\b\foundation^
254
159
-DXCTEST_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
255
160
-DXCTEST_PATH_TO_LIBDISPATCH_BUILD=S:\b\libdispatch^
@@ -264,41 +169,41 @@ ninja
264
169
path S:\b\xctest;%PATH%
265
170
```
266
171
267
- ## 13 . Test XCTest
172
+ ## 1 . Test XCTest
268
173
269
174
``` cmd
270
175
ninja -C S:\b\xctest check-xctest
271
176
```
272
177
273
- ## 14 . Rebuild Foundation
178
+ ## 1 . Rebuild Foundation
274
179
275
180
``` cmd
276
181
cd "S:\b\foundation
277
182
cmake -G Ninja^
278
183
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
279
184
-DCMAKE_C_COMPILER=clang-cl^
280
- -DCMAKE_SWIFT_COMPILER=S:\b\swift \bin\swiftc.exe^
281
- -DCURL_LIBRARY="S:/curl/builds/ libcurl-vc15-x64-release-static-ipv6-sspi-winssl/ lib/libcurl_a .lib"^
282
- -DCURL_INCLUDE_DIR="S:/curl/builds/ libcurl-vc15-x64-release-static-ipv6-sspi-winssl /include"^
185
+ -DCMAKE_SWIFT_COMPILER=S:\b\toolchain \bin\swiftc.exe^
186
+ -DCURL_LIBRARY="S:/Library/ libcurl-development/usr/ lib/libcurl .lib"^
187
+ -DCURL_INCLUDE_DIR="S:/Library/ libcurl-development/usr /include"^
283
188
-DENABLE_TESTING=YES^
284
189
-DICU_ROOT="S:/Library/icu-64"^
285
- -DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a .lib"^
286
- -DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
190
+ -DLIBXML2_LIBRARY="S:/Library/ libxml2-development/usr/lib/libxml2 .lib"^
191
+ -DLIBXML2_INCLUDE_DIR="S:/Library/ libxml2-development/usr /include"^
287
192
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
288
193
-DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=S:\b\libdispatch^
289
194
-DFOUNDATION_PATH_TO_XCTEST_BUILD=S:\b\xctest^
290
195
S:\swift-corelibs-foundation
291
196
ninja
292
197
```
293
198
294
- ## 15 . Test Foundation
199
+ ## 1 . Test Foundation
295
200
296
201
``` cmd
297
202
cmake --build S:\b\foundation
298
203
ninja -C S:\b\foundation test
299
204
```
300
205
301
- ## 16 . Build llbuild
206
+ ## 1 . Build llbuild
302
207
303
208
``` cmd
304
209
md S:\b\llbuild
@@ -311,8 +216,8 @@ cmake -G Ninja^
311
216
-DFOUNDATION_BUILD_DIR=S:\b\foundation^
312
217
-DLIBDISPATCH_BUILD_DIR=S:\b\libdispatch^
313
218
-DLIBDISPATCH_SOURCE_DIR=S:\swift-corelibs-libdispatch^
314
- -DSQLite3_INCLUDE_DIR=S:\sqlite-amalgamation-3270200 ^
315
- -DSQLite3_LIBRARY=S:\b \sqlite\sqlite3.lib^
219
+ -DSQLite3_INCLUDE_DIR=S:\Library\ sqlite-3.28.0\usr\include ^
220
+ -DSQLite3_LIBRARY=S:\Library \sqlite-3.28.0\usr\lib \sqlite3.lib^
316
221
-DLLBUILD_SUPPORT_BINDINGS=Swift^
317
222
S:\llbuild
318
223
ninja
@@ -323,15 +228,15 @@ ninja
323
228
path S:\b\llbuild\bin;%PATH%
324
229
```
325
230
326
- ## 17 . Build swift-package-manager
231
+ ## 1 . Build swift-package-manager
327
232
328
233
``` cmd
329
234
md S:\b\spm
330
235
cd S:\b\spm
331
236
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
332
237
```
333
238
334
- ## 18 . Install Swift on Windows
239
+ ## 1 . Install Swift on Windows
335
240
336
241
- Run ninja install:
337
242
0 commit comments