@@ -10,6 +10,7 @@ There are two supported ways to build Swift on Windows, they are
10
10
1 . Using the Microsoft Visual C++ compiler (MSVC)
11
11
12
12
` clang-cl ` is recommended over MSVC for building Swift on Windows.
13
+
13
14
Although it is possible to build the compiler and the standard library with
14
15
MSVC and to use those built products to compile a Swift program, it won't be
15
16
possible to run the binary without separately obtaining the Swift runtime. On
@@ -39,17 +40,9 @@ it provides some of the needed headers and libraries.
39
40
- Currently, other repositories in the Swift project have not been tested and
40
41
may not be supported.
41
42
42
- ### 3. Build ICU
43
- 1 . Download and extract the [ ICU source
44
- code] ( http://site.icu-project.org/download ) to a folder named ` icu ` in the same
45
- directory as the other Swift project repositories (tested with ICU versions 55.1 and 59.1).
46
- 1 . Open ` src/win32/allinone.sln ` in Visual Studio.
47
- 1 . Make sure to select the correct architecture from the drop-down in Visual
48
- Studio.
49
- 1 . Right click on the solution in the Solution Explorer window and select
50
- "Build Solution".
51
- 1 . When this is done, add the ` <icu-source>/bin ` folder to your ` Path `
52
- environment variable.
43
+ ### 3. Acquire ICU
44
+ 1 . Download ICU from [ ICU Project] ( http://site.icu-project.org ) for Windows x64 and extract the binaries.
45
+ 1 . Add the ` bin64 ` folder to your ` Path ` environment variable.
53
46
54
47
### 4. Get ready
55
48
- From within a ** developer** command prompt (not PowerShell nor cmd, but [ the
@@ -103,10 +96,7 @@ pushd "%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"
103
96
cmake -G "Ninja"^
104
97
-DLLVM_ENABLE_ASSERTIONS=TRUE^
105
98
-DCMAKE_BUILD_TYPE=Debug^
106
- -DLLVM_TOOL_SWIFT_BUILD=NO^
107
- -DLLVM_INCLUDE_DOCS=TRUE^
108
99
-DLLVM_ENABLE_PROJECTS=clang^
109
- -DLLVM_LIT_ARGS=-sv^
110
100
-DLLVM_TARGETS_TO_BUILD=X86^
111
101
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^
112
102
"%swift_source_dir%/llvm"
@@ -131,29 +121,25 @@ mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
131
121
pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
132
122
cmake -G "Ninja"^
133
123
-DCMAKE_BUILD_TYPE=Debug^
134
- -DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark"^
135
- -DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64"^
136
- -DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64/src"^
137
- -DSWIFT_PATH_TO_LLVM_SOURCE="%swift_source_dir%/llvm"^
138
- -DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
139
- -DSWIFT_PATH_TO_CLANG_SOURCE="%swift_source_dir%/llvm/tools/clang"^
140
- -DSWIFT_PATH_TO_CLANG_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
141
- -DICU_WINDOWS_x86_64_UC_INCLUDE="%swift_source_dir%/icu/include"^
142
- -DICU_WINDOWS_x86_64_UC_LIBRARY="%swift_source_dir%/icu/lib64/icuuc.lib"^
143
- -DICU_WINDOWS_x86_64_I18N_INCLUDE="%swift_source_dir%/icu/include"^
144
- -DICU_WINDOWS_x86_64_I18N_LIBRARY="%swift_source_dir%/icu/lib64/icuin.lib"^
145
- -DSWIFT_INCLUDE_DOCS=FALSE^
146
- -DSWIFT_INCLUDE_TESTS=FALSE^
147
124
-DCMAKE_C_COMPILER="%llvm_bin_dir%/clang-cl.exe"^
148
125
-DCMAKE_CXX_COMPILER="%llvm_bin_dir%/clang-cl.exe"^
149
- -DCMAKE_C_FLAGS="/Z7 "^
150
- -DCMAKE_CXX_FLAGS="/Z7 -Wno-c++98-compat -Wno-c++98-compat-pedantic"^
126
+ -DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark "^
127
+ -DCMAKE_CXX_FLAGS="-Wno-c++98-compat -Wno-c++98-compat-pedantic"^
151
128
-DCMAKE_EXE_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
152
- -DCMAKE_MODULE_LINKER_FLAGS="/INCREMENTAL:NO"^
153
129
-DCMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO"^
154
- -DCMAKE_STATIC_LINKER_FLAGS="/INCREMENTAL:NO"^
130
+ -DSWIFT_INCLUDE_DOCS=NO^
131
+ -DSWIFT_PATH_TO_LLVM_SOURCE="%swift_source_dir%/llvm"^
132
+ -DSWIFT_PATH_TO_CLANG_SOURCE="%swift_source_dir%/clang"^
133
+ -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE="%swift_source_dir%/swift-corelibs-libdispatch"^
134
+ -DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
135
+ -DSWIFT_PATH_TO_CLANG_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
136
+ -DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64"^
137
+ -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="%swift_source_dir%/icu/include"^
138
+ -DSWIFT_WINDOWS_x86_64_ICU_UC="%swift_source_dir%/icu/lib64/icuuc.lib"^
139
+ -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="%swift_source_dir%/icu/include"^
140
+ -DSWIFT_WINDOWS_x86_64_ICU_I18N="%swift_source_dir%/icu/lib64/icuin.lib"^
155
141
-DCMAKE_INSTALL_PREFIX="C:/Program Files (x86)/Swift"^
156
- "%swift_source_dir%/swift"
142
+ "%swift_source_dir%/swift"
157
143
popd
158
144
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
159
145
```
0 commit comments