CMake: Add windows vcpkg triplet files to minimize port builds

Now we won't be building both debug and release for all ports when
using a release, distribution, or sanitizer preset.

Eventually we can use this to build all our ports with clang-cl.exe.
That doesn't work at all out of the box, and needs a bunch of extra
legwork. Likely legwork for every port we build.
This commit is contained in:
Andrew Kaster 2025-06-21 17:06:09 -06:00 committed by Andrew Kaster
commit 5783caf68e
Notes: github-actions[bot] 2025-06-22 19:34:35 +00:00
7 changed files with 29 additions and 6 deletions

View file

@ -0,0 +1,4 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
include(${CMAKE_CURRENT_LIST_DIR}/base.cmake)

View file

@ -0,0 +1,2 @@
include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-windows.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/debug.cmake)

View file

@ -0,0 +1,3 @@
# Note: This is equivalent to upstream x64-windows-static-md-release.cmake
include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-windows.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/distribution.cmake)

View file

@ -1,11 +1,14 @@
# The generated file here is read by vcpkg/base-triplets/base.cmake to ensure consistency between the project
# build and the vcpkg build.
set(EXTRA_VCPKG_VARIABLES "")
if (NOT "${CMAKE_C_COMPILER}" STREQUAL "")
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CC} ${CMAKE_C_COMPILER})\n")
endif()
if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "")
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CXX} ${CMAKE_CXX_COMPILER})\n")
if (NOT WIN32)
# Supporting Clang-CL for all our vcpkg ports is an adventure in itself, so let's not
if (NOT "${CMAKE_C_COMPILER}" STREQUAL "")
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CC} ${CMAKE_C_COMPILER})\n")
endif()
if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "")
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CXX} ${CMAKE_CXX_COMPILER})\n")
endif()
endif()
# Workaround for bad patchelf interaction with binutils 2.43.50

View file

@ -0,0 +1,3 @@
# Note: This is equivalent to upstream x64-windows-release.cmake
include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-windows.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/release.cmake)

View file

@ -2,4 +2,9 @@ set(VCPKG_BUILD_TYPE release)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "-frtti")
if (WIN32)
set(VCPKG_CXX_FLAGS "/GR")
else()
set(VCPKG_CXX_FLAGS "-frtti")
endif()

View file

@ -0,0 +1,3 @@
# Note: This is mostly equivalent to upstream x64-windows-release.cmake
include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-windows.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/sanitizer.cmake)