Skip to content

Commit

Permalink
Windows.MSVC.toolchain.cmake shouldn't fallback to non-Spectre folder…
Browse files Browse the repository at this point in the history
…s on Spectre builds (#95)
  • Loading branch information
MarkSchofield authored Feb 20, 2024
2 parents ebe98d7 + 469062f commit 27780c0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
configuration: [ Debug, Release ]
buildPreset: [ windows-msvc-x64, windows-msvc-amd64, windows-msvc-x86, windows-msvc-arm64, windows-clang-x64, windows-clang-amd64, windows-clangcl-x64, windows-clangcl-amd64 ]
buildPreset: [ windows-msvc-x64, windows-msvc-spectre-x64, windows-msvc-amd64, windows-msvc-x86, windows-msvc-arm64, windows-clang-x64, windows-clang-amd64, windows-clangcl-x64, windows-clangcl-amd64 ]
runs-on: windows-latest
steps:
- name: Checkout
Expand Down
7 changes: 4 additions & 3 deletions Windows.MSVC.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ if(VS_USE_SPECTRE_MITIGATION_ATLMFC_RUNTIME)
atls.lib
)
link_directories("${VS_TOOLSET_PATH}/ATLMFC/lib/spectre/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")
else()
link_directories("${VS_TOOLSET_PATH}/ATLMFC/lib/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")
endif()

if(VS_USE_SPECTRE_MITIGATION_RUNTIME)
Expand All @@ -199,11 +201,10 @@ if(VS_USE_SPECTRE_MITIGATION_RUNTIME)
msvcrt.lib vcruntime.lib vcruntimed.lib
)
link_directories("${VS_TOOLSET_PATH}/lib/spectre/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")
else()
link_directories("${VS_TOOLSET_PATH}/lib/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")
endif()

link_directories("${VS_TOOLSET_PATH}/ATLMFC/lib/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")
link_directories("${VS_TOOLSET_PATH}/lib/${CMAKE_VS_PLATFORM_TOOLSET_ARCHITECTURE}")

link_directories("${VS_TOOLSET_PATH}/lib/x86/store/references")

# Module support
Expand Down
42 changes: 30 additions & 12 deletions example/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,20 @@
"CMAKE_TOOLCHAIN_FILE": "../Windows.MSVC.toolchain.cmake",
"CMAKE_VS_VERSION_PRERELEASE": "ON",
"VS_EXPERIMENTAL_MODULE": "OFF",
"VS_USE_SPECTRE_MITIGATION_ATLMFC_RUNTIME": "OFF",
"VS_USE_SPECTRE_MITIGATION_RUNTIME": "OFF"
},
"binaryDir": "${sourceDir}/__output/${presetName}"
}
},
{
"name": "windows-msvc-spectre",
"inherits": "windows-msvc",
"hidden": true,
"displayName": "Windows-only configuration",
"description": "This build is only available on Windows",
"cacheVariables": {
"VS_USE_SPECTRE_MITIGATION_ATLMFC_RUNTIME": "ON",
"VS_USE_SPECTRE_MITIGATION_RUNTIME": "ON"
}
},
{
"name": "windows-clang",
Expand All @@ -40,24 +51,18 @@
"CMAKE_TOOLCHAIN_FILE": "../Windows.Clang.toolchain.cmake",
"CMAKE_VS_VERSION_RANGE": "[16.0,18.0)",
"CMAKE_VS_VERSION_PRERELEASE": "ON"
},
"binaryDir": "${sourceDir}/__output/${presetName}"
}
},
{
"name": "windows-clangcl",
"inherits": "windows",
"inherits": "windows-clang",
"hidden": true,
"displayName": "Windows-only configuration",
"description": "This build is only available on Windows",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_C_COMPILER_FRONTEND_VARIANT": "MSVC",
"CMAKE_CXX_COMPILER_FRONTEND_VARIANT": "MSVC",
"CMAKE_TOOLCHAIN_FILE": "../Windows.Clang.toolchain.cmake",
"CMAKE_VS_VERSION_RANGE": "[16.0,18.0)",
"CMAKE_VS_VERSION_PRERELEASE": "ON"
},
"binaryDir": "${sourceDir}/__output/${presetName}"
"CMAKE_CXX_COMPILER_FRONTEND_VARIANT": "MSVC"
}
},
{
"name": "windows-msvc-x64",
Expand All @@ -68,6 +73,15 @@
"CMAKE_SYSTEM_PROCESSOR": "x64"
}
},
{
"name": "windows-msvc-spectre-x64",
"inherits": "windows-msvc-spectre",
"displayName": "Configure for 'windows-msvc-spectre-x64'",
"binaryDir": "${sourceDir}/__output/${presetName}",
"cacheVariables": {
"CMAKE_SYSTEM_PROCESSOR": "x64"
}
},
{
"name": "windows-msvc-amd64",
"inherits": "windows-msvc",
Expand Down Expand Up @@ -151,6 +165,10 @@
"name": "windows-msvc-x64",
"configurePreset": "windows-msvc-x64"
},
{
"name": "windows-msvc-spectre-x64",
"configurePreset": "windows-msvc-spectre-x64"
},
{
"name": "windows-msvc-amd64",
"configurePreset": "windows-msvc-amd64"
Expand Down

0 comments on commit 27780c0

Please sign in to comment.