You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/WindowsBuild.md
+35-39Lines changed: 35 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,19 @@
2
2
3
3
Visual Studio 2017 or newer is needed to build Swift on Windows, while VS2019 is recommended and currently used for CI. The free Community edition is sufficient to build Swift, and we're assuming host and target to be both x64.
4
4
5
-
The commands below (with the exception of installing Visual Studio) must be entered in the **x64 Native Tools Command Prompt for VS2019** (or VS2017, VS2022 depending on the Visual Studio that you are using) in the Start Menu. This sets environment variables to select the correct target platform.
5
+
The commands below (with the exception of installing Visual Studio) must be entered in the **x64 Native Tools Command Prompt for VS2019** (or VS2017, VS2022 depending on the Visual Studio that you are using) in the Start Menu. This sets environment variables to locate tools and resources for the correct target platform.
6
6
7
7
> **NOTE:** This guide is intended for toolchain developers who wants to develop or build Swift on their own machine. For building and packaging a standard toolchain, please refer to [`build-windows-toolchain.bat`](../utils/build-windows-toolchain.bat).
8
8
9
-
## Install dependencies
9
+
## Enable Developer Mode
10
10
11
-
### Visual Studio
11
+
From **Settings** app, go to *Update & Security*. In the *For developers* tab, set *Install apps from any source, including loose files* to On. This is required to enable the creation of symbolic links.
12
12
13
-
An easy way to get most of the tools to build Swift is using the [Visual Studio installer](https://www.visualstudio.com/downloads/). This command installs all needed Visual Studio components as well as Python, Git, CMake and Ninja:
13
+
## Install build tools and SDK
14
14
15
-
```
15
+
An easy way to get the tools to build Swift is using the [Visual Studio installer](https://www.visualstudio.com/downloads/). The following command installs all needed Visual Studio components as well as Python, Git, CMake and Ninja:
> - replace `https://aka.ms/vs/16/release/vs_community.exe` with `https://aka.ms/vs/17/release/vs_community.exe`
29
31
> - replace `Component.CPython3.x64` with `Component.CPython39.x64`
30
32
31
-
If you prefer you can install everything by hand, but make sure to include "Programming Languages|Visual C++" and "Windows and Web Development|Universal Windows App Development|Windows SDK" in your installation. The components listed above are required.
33
+
> **NOTE:** The following [link](https://docs.microsoft.com/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019) helps in finding the component name given its ID for Visual Studio 2019. For anyone using VS installer in GUI, please check it out.
32
34
33
-
The following [link](https://docs.microsoft.com/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019) helps in finding the component name given its ID for Visual Studio 2019.
34
-
35
-
### Python
36
-
37
-
The command above already installs Python 3. Alternatively, in the Visual Studio installation program, under *Individual Components*, install *Python 3 64 bits (3.x.x)*.
35
+
### Configure Python
38
36
39
37
If you are building a debug version of Swift, you should also install the Python debug binaries.
40
38
@@ -44,45 +42,43 @@ If you are building a debug version of Swift, you should also install the Python
44
42
4. Select *Download debug binaries (requires VS 2015 or later)*
45
43
5. Click *Install*
46
44
47
-
## Enable Developer Mode
48
-
49
-
From the settings application, go to *Update & Security*. In the *For developers* tab, select *Developer Mode* for *Use Developer Features*. This is required to enable the creation of symbolic links.
45
+
### Set up `vcpkg`
50
46
51
-
## Clone the repositories
52
-
53
-
> **NOTE:** This guide assumes your sources live at the root of `S:`. If your sources live elsewhere, you can create a substitution for this:
54
-
>
55
-
> subst S: <path to sources>
47
+
This guide uses `vcpkg` for pulling in external dependencies, including ICU, libcurl, libxml2, SQLite 3 and zlib.
56
48
57
-
First, clone `apple/swift` (this repository) with Git:
49
+
All you have to do is to clone and bootstrap `vcpkg`:
You'll be able to clone and check out the rest of Swift source repositories with `update-checkout` tool:
56
+
> **NOTE:** By default, the dependencies will be downloaded and built on demand. Optionally, you can pre-build the dependencies to speed up configuration:
This guide assumes your sources live at the root of `S:`. As long as drive letter `S:` is not assigned, you can create a substitution to map your source directory:
70
63
71
-
This guide uses `vcpkg` for pulling in external dependencies, including ICU, libcurl, libxml2, SQLite 3 and zlib.
64
+
```cmd
65
+
subst S: <path to source root>
66
+
```
72
67
73
-
All you have to do is to clone and bootstrap `vcpkg`:
68
+
First, clone `apple/swift` (this repository) with Git:
S:\swift\utils\update-checkout.cmd --clone --skip-repository swift
84
78
```
85
79
80
+
> **NOTE:** You can use forked versions of Swift source repositories by manually placing them into `S:\<repo-name>` and appending their names to the `--skip-repository` option of `update-checkout`. Don't forget to clone them with `-c core.autocrlf=input -c core.symlinks=true` and the correct repository name.
81
+
86
82
## Set up Visual Studio integration (re-run on Visual Studio upgrades)
87
83
88
84
Set up the `ucrt`, `visualc`, and `WinSDK` modules by:
> **NOTE:** Swift Standard Library is also built along with the compiler. This step extracts it into a portable SDK where we will install other runtime libraries.
224
+
> **NOTE:** Swift runtime libraries are also built along with the compiler. This step extracts them into a portable SDK where we will install core libraries alongside.
0 commit comments