@@ -17,7 +17,7 @@ the other hand, `clang-cl` is able to build the runtime, which makes it
17
17
possible to build and run all the components required for Swift natively on
18
18
Windows.
19
19
20
- ## MSVC
20
+ ## ` clang-cl `
21
21
- Windows doesn't currently have a build script. You'll need to run commands
22
22
manually to build Swift on Windows.
23
23
- Windows support for Swift is a work in progress and may not work on your
@@ -143,7 +143,10 @@ cmake -G "Ninja" "%swift_source_dir%/swift"^
143
143
-DICU_I18N_LIB_NAME="icuin"^
144
144
-DSWIFT_INCLUDE_DOCS=FALSE^
145
145
-DSWIFT_INCLUDE_TESTS=FALSE^
146
- -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=FALSE^
146
+ -DCMAKE_C_COMPILER="<path-to-llvm-bin>/clang-cl.exe"^
147
+ -DCMAKE_CXX_COMPILER="<path-to-llvm-bin>/bin/clang-cl.exe"^
148
+ -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 /Z7"^
149
+ -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 -Z7" ^
147
150
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE
148
151
popd
149
152
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
@@ -155,23 +158,39 @@ cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ni
155
158
limitation that file paths cannot exceed 260 characters. These can be
156
159
ignored, as they occur after the build when writing the last build status to
157
160
a file.
161
+
158
162
``` cmd
159
163
cmake -G "Visual Studio 15" "%swift_source_dir%/swift"^
160
164
-DCMAKE_GENERATOR_PLATFORM="x64"^
161
165
...
162
166
```
163
167
164
- ## Clang-cl
168
+ ## MSVC
165
169
166
- Follow the instructions for MSVC, but add the following lines to each CMake
167
- configuration command. ` clang-cl ` 4.0.1 has been tested. You can remove the
168
- ` SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=FALSE ` definition, as overlays are supported
169
- with ` clang-cl ` , as it supports modules. The ` Z7 ` flag is required to produce
170
- PDB files that MSVC's ` link.exe ` can read and enables proper stack traces.
170
+ Follow instructions 1-6 for ` clang-cl ` , but run the following instead to build Swift
171
171
172
172
``` cmd
173
- -DCMAKE_C_COMPILER="<path-to-llvm-bin>/clang-cl.exe"^
174
- -DCMAKE_CXX_COMPILER="<path-to-llvm-bin>/bin/clang-cl.exe"^
175
- -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 /Z7"^
176
- -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 -Z7" ^
173
+ mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
174
+ pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
175
+ cmake -G "Ninja" "%swift_source_dir%/swift"^
176
+ -DCMAKE_BUILD_TYPE=Debug^
177
+ -DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark"^
178
+ -DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64"^
179
+ -DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64/src"^
180
+ -DSWIFT_PATH_TO_LLVM_SOURCE="%swift_source_dir%/llvm"^
181
+ -DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"^
182
+ -DSWIFT_PATH_TO_CLANG_SOURCE="%swift_source_dir%/llvm/tools/clang"^
183
+ -DSWIFT_PATH_TO_CLANG_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"^
184
+ -DICU_UC_INCLUDE_DIRS="%swift_source_dir%/icu/include"^
185
+ -DICU_UC_LIBRARY_DIRS="%swift_source_dir%/icu/lib64"^
186
+ -DICU_I18N_INCLUDE_DIRS="%swift_source_dir%/icu/include"^
187
+ -DICU_I18N_LIBRARY_DIRS="%swift_source_dir%/icu/lib64"^
188
+ -DICU_UC_LIB_NAME="icuuc"^
189
+ -DICU_I18N_LIB_NAME="icuin"^
190
+ -DSWIFT_INCLUDE_DOCS=FALSE^
191
+ -DSWIFT_INCLUDE_TESTS=FALSE^
192
+ -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=FALSE^
193
+ -DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE
194
+ popd
195
+ cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
177
196
```
0 commit comments