Swift Toolchain and SDK Build Tool
Swift for Windows build helper tool. Also Swift Toolchain and SDK snapshots
Swift is a large project consisting of many parts. When it comes to changing or investigate something located in, for example, Swift Foundation library, it is crucial to have quick and robust way to rebuild only that part.
The goals of this project are to:
- Provide a tool to build and experiment with Swift (Toolchain and SDK) on Windows in convenient way on local developer machine
- Provide binary snapshots of dev and release versions of vanilla Swift, as well as customized version by Readdle
- Provide convenient code/script blocks to integrate Swift build process in arbitrary CI/CD flow
- Windows 10 RedStone 4 (10.0.17763.0) or newer
- Developer Mode. Enable in Settings > Update & Security > For developers. Required to create symlinks without elevation.
- Git. https://git-scm.com/download/win
- Python 3. https://www.python.org/downloads/release/python-385/
- Visual Studio 2019. Any edition. Use most recent version, or version from latest successfull check. For minimal build system use Build Tools: https://aka.ms/vs/16/release/vs_buildtools.exe. Required components are:
- MSVC v142 - VS 2019 C++ x64/x86 build tools (Microsoft.VisualStudio.Component.VC.Tools.x86.x64)
- C++ ATL for v142 build tools (Microsoft.VisualStudio.Component.VC.ATL)
- Windows 10 SDK (Microsoft.VisualStudio.Component.Windows10SDK.18362 or newer)
- C++ CMake tools for Windows (Microsoft.VisualStudio.Component.VC.CMake.Project)
Additional Requirements (Swift 5.3)
- Python 2. https://www.python.org/downloads/release/python-2718/. IMPORTANT: Should be installed to C:\Python27.
- Visual Studio 2019. Components:
- MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28-16.9) (Microsoft.VisualStudio.Component.VC.126.96.36.199.x86.x64)
- C++ v14.28 (16.9) ATL for v142 build tools (x86 & x64) (Microsoft.VisualStudio.Component.VC.188.8.131.52.ATL)
- Run elevated Command Prompt. Elevation is required to install clang modules into Visual Studio directory. If you somehow omit this step (e.g. by commenting corresponding script line), elevation is not needed, but make sure you have modues installed already (either manually, or by previous build tool run).
- Clone this repository (e.g. to
C:\swift-windows-gha) and CD into it. Note: don't put it deeply into directory structure, or you will probably get build errors due to file path length restrictions.
- Answer to all questions with defaults by pressing Enter.
Just toolchain alone contains more than 5000 sources to build, so be patient. Build takes about 40 minutes on 3.2GHz 8-core CPU, more than a hour on VM under MacBook Pro 2017, and about 6 hours on GitHub Actions cloud agent.
In the end you will get
Library folder at the default output path, which contains all built products as well as some intermediates.
- Build process details
- Build configuration options
- How-To: Working on SDK