Skip to content

Commit 1db4120

Browse files
authored
Merge pull request #32731 from compnerd/sealed
docs: make Windows build instructions fully self-contained
2 parents f3685f9 + b8d9e3b commit 1db4120

File tree

2 files changed

+147
-30
lines changed

2 files changed

+147
-30
lines changed

cmake/caches/Windows-x86_64.cmake

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
set(LLVM_ENABLE_PROJECTS
2+
clang
3+
clang-tools-extra
4+
lld
5+
lldb
6+
CACHE STRING "")
7+
8+
set(LLVM_EXTERNAL_PROJECTS
9+
cmark
10+
swift
11+
CACHE STRING "")
12+
13+
# NOTE(compnerd) always enable assertions, the toolchain will not provide enough
14+
# context to resolve issues otherwise and may silently generate invalid output.
15+
set(LLVM_ENABLE_ASSERTIONS YES CACHE BOOL "")
16+
17+
set(ENABLE_X86_RELAX_RELOCATIONS YES CACHE BOOL "")
18+
set(LLVM_ENABLE_PYTHON YES CACHE BOOL "")
19+
set(LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "")
20+
21+
# Disable certain targets to reduce the configure time or to avoid configuration
22+
# differences (and in some cases weird build errors on a complete build).
23+
set(LLVM_APPEND_VC_REV NO CACHE BOOL "")
24+
set(LLVM_BUILD_LLVM_DYLIB NO CACHE BOOL "")
25+
set(LLVM_BUILD_LLVM_C_DYLIB NO CACHE BOOL "")
26+
set(LLVM_ENABLE_LIBEDIT NO CACHE BOOL "")
27+
set(LLVM_ENABLE_LIBXML2 NO CACHE BOOL "")
28+
set(LLVM_ENABLE_OCAMLDOC NO CACHE BOOL "")
29+
set(LLVM_ENABLE_ZLIB NO CACHE BOOL "")
30+
set(LLVM_INCLUDE_BENCHMARKS NO CACHE BOOL "")
31+
set(LLVM_INCLUDE_DOCS NO CACHE BOOL "")
32+
set(LLVM_INCLUDE_EXAMPLES NO CACHE BOOL "")
33+
set(LLVM_INCLUDE_GO_TESTS NO CACHE BOOL "")
34+
set(LLVM_TOOL_GOLD_BUILD NO CACHE BOOL "")
35+
set(LLVM_TOOL_LLVM_SHLIB_BUILD NO CACHE BOOL "")
36+
37+
# Avoid swig dependency for lldb
38+
set(LLDB_ALLOW_STATIC_BINDINGS YES CACHE BOOL "")
39+
set(LLDB_USE_STATIC_BINDINGS YES CACHE BOOL "")
40+
41+
# This requires perl which may not be available on Windows
42+
set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")
43+
set(SWIFT_BUILD_STATIC_STDLIB NO CACHE BOOL "")
44+
set(SWIFT_BUILD_STATIC_SDK_OVERLAY NO CACHE BOOL "")
45+
46+
set(LLVM_INSTALL_BINUTILS_SYMLINKS YES CACHE BOOL "")
47+
set(LLVM_INSTALL_TOOLCHAIN_ONLY YES CACHE BOOL "")
48+
set(LLVM_TOOLCHAIN_TOOLS
49+
addr2line
50+
ar
51+
c++filt
52+
dsymutil
53+
dwp
54+
# lipo
55+
llvm-ar
56+
llvm-cov
57+
llvm-cvtres
58+
llvm-cxxfilt
59+
llvm-dlltool
60+
llvm-dwarfdump
61+
llvm-dwp
62+
llvm-lib
63+
llvm-lipo
64+
llvm-mt
65+
llvm-mt
66+
llvm-nm
67+
llvm-objcopy
68+
llvm-objdump
69+
llvm-pdbutil
70+
llvm-profdata
71+
llvm-ranlib
72+
llvm-rc
73+
llvm-readelf
74+
llvm-readobj
75+
llvm-size
76+
llvm-strings
77+
llvm-strip
78+
llvm-symbolizer
79+
llvm-undname
80+
nm
81+
objcopy
82+
objdump
83+
ranlib
84+
readelf
85+
size
86+
strings
87+
CACHE STRING "")
88+
89+
set(CLANG_TOOLS
90+
clang
91+
clangd
92+
clang-format
93+
clang-resource-headers
94+
clang-tidy
95+
CACHE STRING "")
96+
97+
set(LLD_TOOLS
98+
lld
99+
CACHE STRING "")
100+
101+
set(LLDB_TOOLS
102+
liblldb
103+
lldb
104+
lldb-argdumper
105+
lldb-python-scripts
106+
lldb-server
107+
lldb-vscode
108+
repl_swift
109+
CACHE STRING "")
110+
111+
set(SWIFT_INSTALL_COMPONENTS
112+
autolink-driver
113+
compiler
114+
clang-builtin-headers
115+
editor-integration
116+
tools
117+
sourcekit-inproc
118+
swift-remote-mirror
119+
swift-remote-mirror-headers
120+
CACHE STRING "")
121+
122+
set(LLVM_DISTRIBUTION_COMPONENTS
123+
IndexStore
124+
libclang
125+
libclang-headers
126+
LTO
127+
${LLVM_TOOLCHAIN_TOOLS}
128+
${CLANG_TOOLS}
129+
${LLD_TOOLS}
130+
${LLDB_TOOLS}
131+
${SWIFT_INSTALL_COMPONENTS}
132+
CACHE STRING "")

docs/WindowsBuild.md

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ From the settings application, go to `Update & Security`. In the `For developer
5252

5353
1. Clone `apple/llvm-project` into a directory for the toolchain
5454
2. Clone `apple/swift-cmark`, `apple/swift`, `apple/swift-corelibs-libdispatch`, `apple/swift-corelibs-foundation`, `apple/swift-corelibs-xctest`, `apple/swift-llbuild`, `apple/swift-package-manager` into the toolchain directory
55-
3. Clone `compnerd/swift-build` as a peer of the toolchain directory
5655

5756
- Currently, other repositories in the Swift project have not been tested and may not be supported.
5857

@@ -73,21 +72,12 @@ git clone https://github.com/apple/swift-corelibs-xctest swift-corelibs-xctest
7372
git clone https://github.com/apple/swift-llbuild llbuild
7473
git clone https://github.com/apple/swift-tools-support-core swift-tools-support-core
7574
git clone -c core.autocrlf=input https://github.com/apple/swift-package-manager swiftpm
76-
git clone https://github.com/compnerd/swift-build swift-build
7775
```
7876

79-
## Acquire ICU, SQLite3, curl, libxml2 and zlib
77+
## Dependencies (ICU, SQLite3, curl, libxml2 and zlib)
8078

81-
```
82-
C:\Python27\python.exe -m pip install --user msrest azure-devops tabulate
83-
C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id ICU --latest-artifacts --filter windows-x64 --download
84-
C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id XML2 --latest-artifacts --filter windows-x64 --download
85-
C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id CURL --latest-artifacts --filter windows-x64 --download
86-
C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id zlib --latest-artifacts --filter windows-x64 --download
87-
C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id SQLite --latest-artifacts --filter windows-x64 --download
88-
```
89-
90-
Extract the zip files, ignoring the top level directory, into `S:/Library`. The directory structure should resemble:
79+
The instructions assume that the dependencies are in `S:/Library`. The directory
80+
structure should resemble:
9181

9282
```
9383
/Library
@@ -103,6 +93,10 @@ Extract the zip files, ignoring the top level directory, into `S:/Library`. The
10393
┕ usr/...
10494
```
10595

96+
Note that only ICU is required for building the toolchain, and SQLite is only
97+
needed for building llbuild and onwards. The ICU project provides binaries,
98+
alternatively, see the ICU project for details on building ICU from source.
99+
106100
## One-time Setup (re-run on Visual Studio upgrades)
107101

108102
Set up the `ucrt`, `visualc`, and `WinSDK` modules by:
@@ -126,26 +120,17 @@ Warning: Creating the above links usually requires administrator privileges. The
126120

127121
```cmd
128122
cmake -B "S:\b\toolchain" ^
129-
-C S:\swift-build\cmake\caches\windows-x86_64.cmake ^
130-
-C S:\swift-build\cmake\caches\org.compnerd.dt.cmake ^
123+
-C S:\swift\cmake\caches\Windows-x86_64.cmake ^
131124
-D CMAKE_BUILD_TYPE=Release ^
132-
-D LLVM_ENABLE_ASSERTIONS=YES ^
133-
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb;lld" ^
134-
-D LLVM_EXTERNAL_PROJECTS="cmark;swift" ^
135125
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch ^
136126
-D LLVM_ENABLE_PDB=YES ^
137-
-D LLVM_ENABLE_LIBEDIT=NO ^
138-
-D LLDB_ENABLE_PYTHON=YES ^
139-
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^
140-
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^
141-
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-67/usr/include" ^
142-
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-67/usr/lib/icuuc67.lib" ^
143-
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-67/usr/include" ^
144-
-D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-67/usr/lib/icuin67.lib" ^
145-
-D CMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" ^
146-
-D PYTHON_EXECUTABLE=C:\Python27\python.exe ^
147-
-D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^
148-
-D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=YES ^
127+
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR=S:\swift ^
128+
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR=S:\cmark ^
129+
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE=S:\Library\icu-67\usr\include ^
130+
-D SWIFT_WINDOWS_x86_64_ICU_UC=S:\Library\icu-67\usr\lib\icuuc67.lib ^
131+
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE=S:\Library\icu-67\usr\include ^
132+
-D SWIFT_WINDOWS_x86_64_ICU_I18N=S:\Library\icu-67\usr\lib\icuin67.lib ^
133+
-D CMAKE_INSTALL_PREFIX=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr ^
149134
-G Ninja ^
150135
-S S:\llvm-project\llvm
151136

0 commit comments

Comments
 (0)