Skip to content
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions docs/src/developer_guide/compiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ The following table lists the available configuration options:
* - ``SGL_ENABLE_HEADER_VALIDATION``
- ``OFF``
- Enable header validation
* - ``SGL_MSVC_TOOLSET_VERSION``
- ``Unset``
- Specify an exact MSVC toolset version to use (e.g., `14.44.35207`)



Expand Down
43 changes: 43 additions & 0 deletions external/vcpkg-triplets/x64-windows-static-md-fix.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# Allow user to explicitly specify a toolset version via -DSGL_MSVC_TOOLSET_VERSION=...
# If not specified, it falls back to the VCToolsVersion from the developer environment.
if(DEFINED SGL_MSVC_TOOLSET_VERSION)
set(toolset_to_use ${SGL_MSVC_TOOLSET_VERSION})
message(STATUS "Triplet: Using user-specified toolset version '${toolset_to_use}'.")
elseif(DEFINED ENV{VCToolsVersion})
set(toolset_to_use "$ENV{VCToolsVersion}")
message(STATUS "Triplet: Using toolset version from environment: '${toolset_to_use}'.")
endif()

if(DEFINED toolset_to_use)
# Set the detailed toolset version. This forces vcpkg to use the specific toolset.
set(VCPKG_PLATFORM_TOOLSET_VERSION "${toolset_to_use}")

# Also set the major toolset version, as vcpkg may require it to be present.
# For VS 2022, all versions (14.30-14.49) use v143 toolset
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _match "${toolset_to_use}")
if(_match)
# Map version to correct Visual Studio toolset
# 14.0-14.9 -> v140 (VS 2015)
# 14.1X -> v141 (VS 2017)
# 14.2X -> v142 (VS 2019)
# 14.3X-14.4X -> v143 (VS 2022)
if(CMAKE_MATCH_1 EQUAL 14)
if(CMAKE_MATCH_2 GREATER_EQUAL 0 AND CMAKE_MATCH_2 LESS 10)
set(derived_toolset "v140")
elseif(CMAKE_MATCH_2 GREATER_EQUAL 10 AND CMAKE_MATCH_2 LESS 20)
set(derived_toolset "v141")
elseif(CMAKE_MATCH_2 GREATER_EQUAL 20 AND CMAKE_MATCH_2 LESS 30)
set(derived_toolset "v142")
else()
# v143 for 14.30+ (VS 2022 and future versions)
# Covers 14.3X, 14.4X, and beyond
set(derived_toolset "v143")
endif()
else()
# Fallback for unknown versions
set(derived_toolset "v${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
endif()
set(VCPKG_PLATFORM_TOOLSET "${derived_toolset}")
endif()
endif()

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
Expand Down