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
+11-37Lines changed: 11 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Building Swift on Windows
2
2
3
-
Visual Studio 2017 or newer is needed to build swift on Windows.
3
+
Visual Studio 2017 or newer is needed to build swift on Windows. The following must take place in the developer command prompt (provided by Visual Studio). This shows up as "x64 Native Tools Command Prompt for VS2017" (or VS2019, VS2019 Preview depending on the Visual Studio that you are using) in the Start Menu.
4
4
5
5
## Install dependencies
6
6
- 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 Development|Universal Windows App Development|Windows SDK" in your installation.
7
+
- Make sure to include "Programming Languages|Visual C++" and "Windows and Web Development|Universal Windows App Development|Windows SDK" in your installation. The following components are required:
- 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").
54
-
55
-
Run this as administrator the first time, for setting up the symlinks below.
56
-
57
-
If instead you're compiling for a 32-bit Windows target, adapt the `arch` argument to `x86` and run
58
-
59
-
```cmd
60
-
VsDevCmd -arch=x86
61
-
```
62
-
63
-
- Decide whether you want to build a release or debug version of Swift on Windows and
64
-
replace the `CMAKE_BUILD_TYPE` parameter in the build steps below with the correct value
65
-
(`Debug`, `RelWithDebInfoAssert` or `Release`) to avoid conflicts between the debug and
66
-
non-debug version of the MSCRT library.
67
-
68
56
## One-time Setup (re-run on Visual Studio upgrades)
69
57
- Set up the `ucrt`, `visualc`, and `WinSDK` modules by copying `ucrt.modulemap` located at
70
58
`swift/stdlib/public/Platform/ucrt.modulemap` into
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.
81
69
82
70
## Build the toolchain
83
-
- 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`).
- Add the Swift on Windows binaries path (`C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin`) to the `PATH` environment variable.
0 commit comments