Skip to content

Commit

Permalink
Add support for settable VS_INSTALLATION_PATH - enabling eWDK (#74)
Browse files Browse the repository at this point in the history
* Added support for the EWDK

You can now use the EWDK to build with this toolchain instead of a pre-installed VS version.

* Attempt to get github actions environment working

* Added *~ pattern to .gitignore for temporary editor files

* Don't set CMAKE_WINDOWS_KITS_10_DIR from environment

This avoids situations where WindowsSdkDir is set in the environment but we want to select a specific version via the pre-existing mechanisms in thie toolchain.
It's better to require EWDK users to explicitly state what they want by setting CMAKE_WINDOWS_KITS_10_DIR via cmake cache vars on the commandline.
  • Loading branch information
kaloth committed Sep 13, 2023
1 parent f73e4c6 commit 70d0c2b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
__*
.vscode
.vs
.vs
*~
3 changes: 3 additions & 0 deletions Windows.Kits.cmake
Expand Up @@ -56,6 +56,9 @@ endif()

if(NOT CMAKE_WINDOWS_KITS_10_DIR)
get_filename_component(CMAKE_WINDOWS_KITS_10_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]" ABSOLUTE CACHE)
if ("${CMAKE_WINDOWS_KITS_10_DIR}" STREQUAL "/registry")
unset(CMAKE_WINDOWS_KITS_10_DIR)
endif()
endif()

if(NOT CMAKE_WINDOWS_KITS_10_DIR)
Expand Down
21 changes: 12 additions & 9 deletions Windows.MSVC.toolchain.cmake
Expand Up @@ -37,7 +37,8 @@
# | CMAKE_VS_PLATFORM_TOOLSET_VERSION | The version of the MSVC toolset to use. For example, 14.29.30133. Defaults to the highest available. |
# | CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE | The architecture of the toolset to use. Defaults to 'x64'. |
# | CMAKE_WINDOWS_KITS_10_DIR | The location of the root of the Windows Kits 10 directory. |
# | VS_EXPERIMENTAL_MODULE | Whether experimental module support should be enabled.
# | VS_INSTALLATION_PATH | The location of the root of the Visual Studio installation. If not specified VSWhere will be used to search for one. |
# | VS_EXPERIMENTAL_MODULE | Whether experimental module support should be enabled. |
# | VS_USE_SPECTRE_MITIGATION_RUNTIME | Whether the compiler should link with a runtime that uses 'Spectre' mitigations. Defaults to 'OFF'. |
#
# The toolchain file will set the following variables:
Expand Down Expand Up @@ -108,14 +109,16 @@ endif()

# Find Visual Studio
#
findVisualStudio(
VERSION ${CMAKE_VS_VERSION_RANGE}
PRERELEASE ${CMAKE_VS_VERSION_PRERELEASE}
PRODUCTS ${CMAKE_VS_PRODUCTS}
PROPERTIES
installationVersion VS_INSTALLATION_VERSION
installationPath VS_INSTALLATION_PATH
)
if(NOT VS_INSTALLATION_PATH)
findVisualStudio(
VERSION ${CMAKE_VS_VERSION_RANGE}
PRERELEASE ${CMAKE_VS_VERSION_PRERELEASE}
PRODUCTS ${CMAKE_VS_PRODUCTS}
PROPERTIES
installationVersion VS_INSTALLATION_VERSION
installationPath VS_INSTALLATION_PATH
)
endif()

message(VERBOSE "VS_INSTALLATION_VERSION = ${VS_INSTALLATION_VERSION}")
message(VERBOSE "VS_INSTALLATION_PATH = ${VS_INSTALLATION_PATH}")
Expand Down

0 comments on commit 70d0c2b

Please sign in to comment.