Skip to content

Commit 1d17839

Browse files
authored
Update WindowsBuild.md
Clean up some of the windows recommendations. This is motivated by trying to setup a clean environment with @keith. - migrate from `toolchain` to `llvm-project` for the LLVM project - extract `swift` and `cmark` from the `llvm-project` directory structure - use the `EXTERNAL_PROJECT` and `ENABLE_PROJECTS` properly - convert artifact fetching to use a command line tool to fetch the URLs rather than manually using a browser This now reflects the standard checkout layout more closely.
1 parent b5a8b51 commit 1d17839

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

docs/WindowsBuild.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ subst S: <path to sources>
6464

6565
```cmd
6666
S:
67-
git clone https://github.com/apple/llvm-project --branch swift/master toolchain
68-
git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift toolchain/swift
69-
git clone https://github.com/apple/swift-cmark toolchain/cmark
67+
git clone https://github.com/apple/llvm-project --branch swift/master llvm-project
68+
git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift swift
69+
git clone https://github.com/apple/swift-cmark cmark
7070
git clone https://github.com/apple/swift-corelibs-libdispatch swift-corelibs-libdispatch
7171
git clone https://github.com/apple/swift-corelibs-foundation swift-corelibs-foundation
7272
git clone https://github.com/apple/swift-corelibs-xctest swift-corelibs-xctest
@@ -78,15 +78,16 @@ git clone https://github.com/compnerd/swift-build swift-build
7878

7979
## Acquire ICU, SQLite3, curl, libxml2 and zlib
8080

81-
Go to [compnerd's swift-build azure page](https://dev.azure.com/compnerd/swift-build/_build) and open [Pipelines](https://dev.azure.com/compnerd/swift-build/_build) where you'll see bots (hopefully green) for:
82-
83-
- [ICU](https://dev.azure.com/compnerd/swift-build/_build?definitionId=9)
84-
- [SQLite](https://dev.azure.com/compnerd/swift-build/_build?definitionId=12&_a=summary)
85-
- [curl](https://dev.azure.com/compnerd/swift-build/_build?definitionId=11&_a=summary)
86-
- [libxml2](https://dev.azure.com/compnerd/swift-build/_build?definitionId=10&_a=summary)
87-
- [zlib](https://dev.azure.com/compnerd/swift-build/_build?definitionId=16&_a=summary)
81+
```
82+
python -m pip install --user msrest azure-devops tabulate
83+
python swift-build\utilities\swift-build.py --build-id ICU --latest-artifacts --filter windows-x64 --download
84+
python swift-build\utilities\swift-build.py --build-id XML2 --latest-artifacts --filter windows-x64 --download
85+
python swift-build\utilities\swift-build.py --build-id CURL --latest-artifacts --filter windows-x64 --download
86+
python swift-build\utilities\swift-build.py --build-id zlib --latest-artifacts --filter windows-x64 --download
87+
python swift-build\utilities\swift-build.py --build-id SQLite --latest-artifacts --filter windows-x64 --download
88+
```
8889

89-
Download each of the zip files and copy their contents into S:/Library. The directory structure should resemble:
90+
Extract the zip files, ignoring the top level directory, into `S:/Library`. The directory structure should resemble:
9091

9192
```
9293
/Library
@@ -113,29 +114,30 @@ Set up the `ucrt`, `visualc`, and `WinSDK` modules by:
113114
- and setup the `visualc.apinotes` located at `swift/stdlib/public/Platform/visualc.apinotes` into `${VCToolsInstallDir}/include` as `visualc.apinotes`
114115

115116
```cmd
116-
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\ucrt.modulemap
117-
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\winsdk.modulemap
118-
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\visualc.modulemap
119-
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\toolchain\swift\stdlib\public\Platform\visualc.apinotes
117+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\swift\stdlib\public\Platform\ucrt.modulemap
118+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\swift\stdlib\public\Platform\winsdk.modulemap
119+
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\swift\stdlib\public\Platform\visualc.modulemap
120+
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Platform\visualc.apinotes
120121
```
121122

122123
Warning: Creating the above links usually requires administrator privileges. The quick and easy way to do this is to open a second developer prompt by right clicking whatever shortcut you used to open the first one, choosing Run As Administrator, and pasting the above commands into the resulting window. You can then close the privileged prompt; this is the only step which requires elevation.
123124

124125
## Build the toolchain
125126

126127
```cmd
127-
md "S:\b\toolchain"
128128
cmake -B "S:\b\toolchain" ^
129129
-C S:\swift-build\cmake\caches\windows-x86_64.cmake ^
130130
-C S:\swift-build\cmake\caches\org.compnerd.dt.cmake ^
131131
-D CMAKE_BUILD_TYPE=Release ^
132132
-D LLVM_ENABLE_ASSERTIONS=YES ^
133-
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cmark;swift;lldb;lld" ^
133+
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb;lld" ^
134134
-D LLVM_EXTERNAL_PROJECTS="cmark;swift" ^
135135
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch ^
136136
-D LLVM_ENABLE_PDB=YES ^
137137
-D LLVM_ENABLE_LIBEDIT=NO ^
138138
-D LLDB_ENABLE_PYTHON=YES ^
139+
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^
140+
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^
139141
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" ^
140142
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" ^
141143
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" ^
@@ -145,7 +147,7 @@ cmake -B "S:\b\toolchain" ^
145147
-D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^
146148
-D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=YES ^
147149
-G Ninja ^
148-
-S S:\toolchain\llvm
150+
-S S:\llvm-project\llvm
149151
150152
ninja -C S:\b\toolchain
151153
```

0 commit comments

Comments
 (0)