Skip to content

Commit 4b93736

Browse files
authored
Merge pull request #17012 from sparkasaurusRex/doc-windowscrosscompile
2 parents 0a1fe5d + 3b3b8cb commit 4b93736

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

docs/WindowsCrossCompile.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export VCToolsInstallDir=".../Microsoft Visual Studio/2017/Community"
1717
```
1818

1919
## 2. Set up the `visualc` and `ucrt` modules
20-
The `visualc.modulemap` located at
21-
`swift/stdlib/public/Platform/visualc.modulemap` needs to be copied into
22-
`${VCToolsInstallDir}/include`. The `ucrt.modulemap` located at
20+
The `ucrt.modulemap` located at
2321
`swift/stdlib/public/Platform/ucrt.modulemap` needs to be copied into
24-
`${UniversalCRTSdkDir}/Include/${UCRTVersion}/ucrt`.
22+
`${UniversalCRTSdkDir}/Include/${UCRTVersion}/ucrt`. The `visualc.modulemap`
23+
located at `swift/stdlib/public/Platform/visualc.modulemap` needs to be copied
24+
into `${VCToolsInstallDir}/include`.
2525

2626
## 3. Configure the runtime to be built with the just built `clang`
2727
Ensure that we use the tools from the just built LLVM and `clang` tools to
@@ -32,13 +32,35 @@ build the static libraries. Note that cross-compiling will require the use of
3232
`lld`. Ensure that `lld-link.exe` is available to clang via your path.
3333
Additionally, the ICU headers and libraries need to be provided for the build.
3434

35+
#### macOS
36+
3537
```bash
36-
--extra-cmake-options=-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE, \
37-
-DCMAKE_AR=<path to llvm-ar>, \
38-
-DCMAKE_RANLIB=<path to llvm-ranlib>, \
39-
-DSWIFT_SDKS=WINDOWS, \
40-
-DSWIFT_WINDOWS_ICU_I18N_INCLUDE=<path to ICU i18n includes>, \
41-
-DSWIFT_WINDOWS_ICU_UC_INCLUDE=<path to ICU UC includes>, \
42-
-DSWIFT_WINDOWS_ICU_I18N=<path to ICU i18n lib>, \
43-
-DSWIFT_WINDOWS_ICU_UC=<path to ICU UC lib>
38+
--extra-cmake-options=-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE,\
39+
-DCMAKE_AR=<path to llvm-ar>,\
40+
-DCMAKE_RANLIB=<path to llvm-ranlib>,\
41+
-DSWIFT_SDKS=WINDOWS,\
42+
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE=<path to ICU i18n includes>,\
43+
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE=<path to ICU UC includes>,\
44+
-DSWIFT_WINDOWS_x86_64_ICU_I18N=<path to ICU i18n lib>,\
45+
-DSWIFT_WINDOWS_x86_64_ICU_UC=<path to ICU UC lib>
4446
```
47+
48+
#### Linux
49+
50+
For Linux, you will also need to build the Linux SDK with the cmake options
51+
below.
52+
53+
```bash
54+
--extra-cmake-options=-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE,\
55+
-DCMAKE_AR=<path to llvm-ar>,\
56+
-DCMAKE_RANLIB=<path to llvm-ranlib>,\
57+
-DSWIFT_SDKS='LINUX;WINDOWS',\
58+
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE=<path to ICU i18n includes>,\
59+
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE=<path to ICU UC includes>,\
60+
-DSWIFT_WINDOWS_x86_64_ICU_I18N=<path to ICU i18n lib>,\
61+
-DSWIFT_WINDOWS_x86_64_ICU_UC=<path to ICU UC lib>
62+
```
63+
64+
## 4. Build the Swift runtime and standard library with `ninja`
65+
From the build directory, you can build the Swift runtime and standard library
66+
for Windows using `ninja swiftCore-windows-x86_64`.

0 commit comments

Comments
 (0)