Skip to content

Commit 9275ac3

Browse files
tonka3000compnerd
andauthored
docs: Update cmake section in readme with required env-vars
Add more information about compiling with cmake as mentioned in [#768](#768 (comment)) Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent a09e54d commit 9275ac3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,49 @@ ninja -C build SwiftWin32 UICatalog
2828
%CD%\build\bin\UICatalog.exe
2929
```
3030

31+
Following environment variables should be set/adjusted before run the above commands (the shown paths assume that you use compiler from the official swift installers from [swift.org](https://www.swift.org/download/)).
32+
33+
- Visual Studio compiler toolchain
34+
35+
The CMake commands use the `mt` tool which requires a Visual Studio compiler environment (Build Tools should be fine too).
36+
e.g. if you have Visual Studio 2019 installed you can create a command prompt by click on `x64 Native Tools Command Prompt for VS2019` from the Visual Studio 2019 installation in the Windows Start Menu.
37+
38+
Newer versions of Visual Studio or the corresponding Build Tools should be fine too.
39+
40+
Another way of activating a Visual Studio environment is the tool [vswhere](https://github.com/microsoft/vswhere).
41+
42+
- `SDKROOT`
43+
44+
This should be the path to the Windows Platform SDK from the Swift library. This should be already set by the official swift installer. If not set the env var.
45+
46+
\>= 5.10 `SDKROOT` needs to be `%LocalAppData%\Programs\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk`
47+
48+
< 5.10 `SDKROOT` needs to be `%SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk`
49+
50+
Examples for < 5.10:
51+
52+
Command Prompt: `set SDKROOT=%SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk`
53+
54+
PowerShell: `$env:SDKROOT="%SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk"`
55+
56+
- `Path`
57+
58+
The `Path` environment variables needs to be extended to allow the Swift compiler to be found.
59+
This is only required when this is not already the case.
60+
When you type `where swiftc` (`(Get-Command swiftc).Path` for PowerShell) and see no path to `swiftc` the following command is required.
61+
62+
\>= 5.10 the `Path` needs to extended with `%LocalAppData%\Programs\Swift\Runtimes\5.9.0\usr\bin;%LocalAppData%\Programs\Swift\Toolchains\5.9.0+Asserts\usr\bin`
63+
64+
< 5.10 the `Path` needs to be extended with `%SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin`
65+
66+
Examples for < 5.10:
67+
68+
Command Prompt: `set Path=%SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;%Path%`
69+
70+
PowerShell: `$env:Path="%SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;$env:Path"`
71+
72+
73+
3174
### Swift Package Manager
3275

3376
Building this project with swift-package-manager is supported although CMake is recommended for ease. The Swift Package Manager based build is required for code completion via SourceKit-LSP. It also allows for the use of Swift/Win32 in other applications using SPM. In order to use SPM to build this project additional post-build steps are required to use the demo applications.

0 commit comments

Comments
 (0)