Swift on Windows
Windows nightlies built on Azure
Downloading the nightlies
- We assume you are reading these instructions on the Azure DevOps page for windows-swift at https://dev.azure.com/compnerd/windows-swift.
buildsfrom the left of the dashboard.
- Click the most recent successful build.
- At the top right of this page to the right of where it says
All logsthere is a three dot button. Under this choose
toolchainto download the nightly toolchain to your machine.
Installing the nightlies
- Extract the toolchain artifact. We assume that the toolchain will be installed to
C:\Library. Extracting it to that location should give you a hierarchy that looks like
- In order to develop with this toolchain, you will need an installation of the Windows SDK. The easiest way to do this is to install Visual Studio. Additionally, you will need to copy a few files into the SDK to make it usable from swift.
curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/ucrt.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/visualc.modulemap" -o "%VCToolsInstallDir%\include\module.modulemap" curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/visualc.apinotes" -o "%VCToolsInstallDir%\include\visualc.apinotes" curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/winsdk.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap"
- You will need to add the ICU libraries for the target. The nightlies are built against ICU 63.1 from the ICU project. You can download the binaries for that from http://download.icu-project.org/files/icu4c/63.1/icu4c-63_1-Win64-MSVC2017.zip.
In these instructions we assume you rename the extracted icu folder
icu63_1and move it to
Building and running swift code
- To have the required Visual Studio toolchain available ensure you use the
x64 Native Tools Command Prompt for VS 2017that came with Visual Studio. Search inside the Visual Studio application folder to find it.
- You need to add the folder containing
PATHenvironment variable to use the toolchain.
- You also need to add the folder containing the icu dlls to the
This can be achieved by entering the following into the command line.
path %PATH%;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin path %PATH%;C:\Library\icu63_1\bin64
Alternatively, to make these changes persistent go to the Windows environment variables edit dialog found in
System Properties >
Environment Variables and edit the path variable to add the following two new items.
Note: After modifying the environment variables using this dialog, running applications must be restarted in order for changes to take effect.