Skip to content

Commit 15a21f2

Browse files
committed
---
yaml --- r: 347391 b: refs/heads/master c: 5973637 h: refs/heads/master i: 347389: 1705579 347387: e118773 347383: 26863ad 347375: 36ebd22 347359: 4289149 347327: 0299234 347263: a9e675e 347135: a433ebe
1 parent 73d4240 commit 15a21f2

File tree

2 files changed

+24
-46
lines changed

2 files changed

+24
-46
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 01644a4345c99b3e8adfe3f9499325a61ba28d44
2+
refs/heads/master: 5973637d43eafaa3249bdd0461166d533a7c02cc
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/docs/WindowsBuild.md

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
# Building Swift on Windows
22

3-
This document describes how to build Swift for Windows natively. See [the
4-
Windows doc](./Windows.md) for more about what is possible with Swift on
5-
Windows.
3+
Visual Studio 2017 or newer is needed to build swift on Windows.
64

7-
There are two supported ways to build Swift on Windows:
8-
9-
1. Using [`clang-cl`](https://clang.llvm.org/docs/UsersManual.html#clang-cl)
10-
1. Using the Microsoft Visual C++ compiler (MSVC)
11-
12-
`clang-cl` is recommended over MSVC for building Swift on Windows.
13-
14-
Although it is possible to build the compiler and the standard library with
15-
MSVC and to use those built products to compile a Swift program, it won't be
16-
possible to run the binary without separately obtaining the Swift runtime. On
17-
the other hand, `clang-cl` is able to build the runtime, which makes it
18-
possible to build and run all the components required for Swift natively on
19-
Windows.
20-
21-
clang should be 7.0 or newer. Visual Studio 2017 is needed in all cases as
22-
it provides some of the needed headers and libraries.
23-
24-
## `clang-cl`
25-
26-
### 1. Install dependencies
5+
## 1. Install dependencies
276
1. Latest version of [Visual Studio](https://www.visualstudio.com/downloads/)
287
- Make sure to include "Programming Languages|Visual C++" and "Windows and Web
298
Development|Universal Windows App Development|Windows SDK" in your
309
installation.
3110

32-
### 2. Clone the repositories
11+
## 2. Clone the repositories
3312
1. Configure git to work with Unix file endings
3413
1. Create a folder to contain all the Swift repositories
3514
1. Clone `apple/swift-cmark` into a folder named `cmark`
@@ -72,23 +51,23 @@ git clone https://github.com/curl/curl.git
7251
git clone https://gitlab.gnome.org/GNOME/libxml2.git
7352
```
7453

75-
### 3. Acquire ICU
54+
## 3. Acquire ICU
7655
1. Download ICU from [ICU Project](http://site.icu-project.org) for Windows x64 and extract the binaries.
7756
1. Add the `bin64` folder to your `Path` environment variable.
7857

7958
```cmd
8059
PATH S:\icu\bin64;%PATH%
8160
```
8261

83-
### 4. Fetch SQLite3
62+
## 4. Fetch SQLite3
8463

8564
```powershell
8665
(New-Object System.Net.WebClient).DownloadFile("https://www.sqlite.org/2019/sqlite-amalgamation-3270200.zip", "S:\sqlite-amalgamation-3270200.zip")
8766
Add-Type -A System.IO.Compression.FileSystem
8867
[IO.Compression.ZipFile]::ExtractToDirectory("S:\sqlite-amalgamation-3270200.zip", "S:\")
8968
```
9069

91-
### 5. Get ready
70+
## 5. Get ready
9271
- From within a **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.
9372

9473
```cmd
@@ -119,7 +98,7 @@ mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Pla
11998

12099
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.
121100

122-
### 6. Build LLVM/Clang
101+
## 6. Build LLVM/Clang
123102
- This must be done from within a developer command prompt. LLVM and Clang are
124103
large projects, so building might take a few hours. Make sure that the build
125104
type for LLVM/Clang is compatbile with the build type for Swift. That is,
@@ -147,8 +126,7 @@ cmake --build "S:\b\llvm"
147126
```cmd
148127
path S:\b\llvm\bin;%PATH%
149128
```
150-
151-
### 7. Build CMark
129+
## 7. Build CMark
152130
- This must be done from within a developer command prompt. CMark is a fairly
153131
small project and should only take a few minutes to build.
154132
```cmd
@@ -163,7 +141,7 @@ popd
163141
cmake --build "S:\b\cmark"
164142
```
165143

166-
### 8. Build Swift
144+
## 8. Build Swift
167145
- This must be done from within a developer command prompt
168146
- 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.
169147

@@ -204,7 +182,7 @@ cmake --build "S:\b\swift"
204182
cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
205183
```
206184

207-
### 9. Build lldb
185+
## 9. Build lldb
208186
- This must be done from within a developer command prompt and could take hours
209187
depending on your system.
210188
```cmd
@@ -225,7 +203,7 @@ popd
225203
cmake --build S:\b\lldb
226204
```
227205

228-
### 10. Running tests on Windows
206+
## 10. Running tests on Windows
229207

230208
Running the testsuite on Windows has additional external dependencies. You must have a subset of the GNUWin32 programs installed and available in your path. The following packages are currently required:
231209

@@ -239,7 +217,7 @@ path S:\thirdparty\icu4c-63_1-Win64-MSVC2017\bin64;S:\b\swift\bin;S:\b\swift\lib
239217
ninja -C S:\b\swift check-swift
240218
```
241219

242-
### 11. Build swift-corelibs-libdispatch
220+
## 11. Build swift-corelibs-libdispatch
243221

244222
```cmd
245223
mkdir "S:\b\libdispatch"
@@ -261,7 +239,7 @@ cmake --build S:\b\libdispatch
261239
path S:\b\libdispatch;S:\b\libdispatch\src;%PATH%
262240
```
263241

264-
### 12. Build curl
242+
## 12. Build curl
265243

266244
```cmd
267245
pushd "S:\curl"
@@ -271,7 +249,7 @@ nmake /f Makefile.vc mode=static VC=15 MACHINE=x64
271249
popd
272250
```
273251

274-
### 13. Build libxml2
252+
## 13. Build libxml2
275253

276254
```cmd
277255
pushd "S:\libxml2\win32"
@@ -280,7 +258,7 @@ nmake /f Makefile.msvc
280258
popd
281259
```
282260

283-
### 14. Build swift-corelibs-foundation
261+
## 14. Build swift-corelibs-foundation
284262

285263
```cmd
286264
mkdir "S:\b\foundation"
@@ -307,7 +285,7 @@ cmake -G Ninja^
307285
path S:\b\foundation;%PATH%
308286
```
309287

310-
### 15. Build swift-corelibs-xctest
288+
## 15. Build swift-corelibs-xctest
311289

312290
```cmd
313291
mkdir "S:\b\xctest"
@@ -332,13 +310,13 @@ cmake --build S:\b\xctest
332310
path S:\b\xctest;%PATH%
333311
```
334312

335-
### 16. Test XCTest
313+
## 16. Test XCTest
336314

337315
```cmd
338316
ninja -C S:\b\xctest check-xctest
339317
```
340318

341-
### 17. Rebuild Foundation
319+
## 17. Rebuild Foundation
342320

343321
```cmd
344322
mkdir "S:\b\foundation"
@@ -361,14 +339,14 @@ cmake -G Ninja^
361339
cmake --build S:\b\foundation
362340
```
363341

364-
### 18. Test Foundation
342+
## 18. Test Foundation
365343

366344
```cmd
367345
cmake --build S:\b\foundation
368346
ninja -C S:\b\foundation test
369347
```
370348

371-
### 19. Build SQLite3
349+
## 19. Build SQLite3
372350

373351
```cmd
374352
md S:\b\sqlite
@@ -381,7 +359,7 @@ cl /MD /Ox /Zi /LD /DSQLITE_API=__declspec(dllexport) S:\sqlite-amalgamation-327
381359
path S:\b\sqlite;%PATH%
382360
```
383361

384-
### 20. Build llbuild
362+
## 20. Build llbuild
385363

386364
```cmd
387365
md S:\b\llbuild
@@ -401,15 +379,15 @@ ninja
401379
path S:\b\llbuild;%PATH%
402380
```
403381

404-
### 21. Build swift-package-manager
382+
## 21. Build swift-package-manager
405383

406384
```cmd
407385
md S:\b\spm
408386
cd S:\b\spm
409387
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
410388
```
411389

412-
### 22. Install Swift on Windows
390+
## 22. Install Swift on Windows
413391

414392
- Run ninja install:
415393

0 commit comments

Comments
 (0)