Skip to content

docs/Windows: More cleanup #15295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions docs/WindowsBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ argument to `x86` and run
VsDevCmd -arch=x86
```

- Then adapt the following command and run it.
- Then adapt the following command and run it. Make sure to use forward slashes
(`/`) instead of backslashes (`\`) as the path seperators. `clang` breaks
with backslashed paths
```cmd
set swift_source_dir=path-to-directory-containing-all-cloned-repositories
```
Expand Down Expand Up @@ -113,7 +115,14 @@ cmake -G "Ninja"^
-DLLVM_TARGETS_TO_BUILD=X86^
"%swift_source_dir%/llvm"
popd
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"
cmake --build "%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"
```
- store the llvm `bin` directory in an environment variable so it can be used
to build swift. Assuming you followed the instructions exactly, the path
below is correct, but it may be different based on your build variant and
platform, so double check.
```cmd
set llvm_bin_dir="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64/bin"
```

### 7. Build Swift
Expand All @@ -122,8 +131,8 @@ cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"
- You may need to adjust the `SWIFT_WINDOWS_LIB_DIRECTORY` parameter depending on
your target platform or Windows SDK version.
```cmd
mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@compnerd I can't remember if one needs to cd into the ninja dir to run cmake. Is pushding into the parent ok?
If you're not sure I'll probably run this Monday/Tuesday next week and we can test then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id say test, but you can pass the path to the cmake invocation.

Copy link
Contributor Author

@AndrewSB AndrewSB Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test on the next time I do a clean build

mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
cmake -G "Ninja" "%swift_source_dir%/swift"^
-DCMAKE_BUILD_TYPE=Debug^
-DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark"^
Expand All @@ -141,13 +150,13 @@ cmake -G "Ninja" "%swift_source_dir%/swift"^
-DICU_I18N_LIB_NAME="icuin"^
-DSWIFT_INCLUDE_DOCS=FALSE^
-DSWIFT_INCLUDE_TESTS=FALSE^
-DCMAKE_C_COMPILER="<path-to-llvm-bin>/clang-cl.exe"^
-DCMAKE_CXX_COMPILER="<path-to-llvm-bin>/bin/clang-cl.exe"^
-DCMAKE_C_COMPILER="%llvm_bin_dir%/clang-cl.exe"^
-DCMAKE_CXX_COMPILER="%llvm_bin_dir%/clang-cl.exe"^
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 /Z7"^
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 -Z7" ^
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE
popd
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
```

- To create a Visual Studio project, you'll need to change the generator and,
Expand All @@ -168,13 +177,13 @@ cmake -G "Visual Studio 15" "%swift_source_dir%/swift"^
Follow instructions 1-6 for `clang-cl`, but run the following instead to build Swift

```cmd
mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
mkdir "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
cmake -G "Ninja" "%swift_source_dir%/swift"^
-DCMAKE_BUILD_TYPE=Debug^
-DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark"^
-DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64"^
-DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64/src"^
-DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/cmark-windows-amd64"^
-DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/cmark-windows-amd64/src"^
-DSWIFT_PATH_TO_LLVM_SOURCE="%swift_source_dir%/llvm"^
-DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"^
-DSWIFT_PATH_TO_CLANG_SOURCE="%swift_source_dir%/llvm/tools/clang"^
Expand All @@ -190,5 +199,5 @@ cmake -G "Ninja" "%swift_source_dir%/swift"^
-DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=FALSE^
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE
popd
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64/ninja"
cmake --build "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
```