mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
CMake: Rename our triplets to their canonical names
Becuase we're using dynamic libraries, our configuration is classified as a "community triplet". To not confuse vcpkg maintainers when developers create bug reports, name them properly. This means that the default triplet detection is now kind of useless, so we have to invent our own for these triplets.
This commit is contained in:
parent
89061dd3c4
commit
673537b26b
Notes:
github-actions[bot]
2024-12-22 22:49:21 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/673537b26bb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2767
15 changed files with 54 additions and 1 deletions
2
.github/workflows/lagom-template.yml
vendored
2
.github/workflows/lagom-template.yml
vendored
|
@ -123,7 +123,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cmake --preset=CI -S Meta/Lagom -B ${{ github.workspace }}/Build/tools-build \
|
cmake --preset=Distribution_CI -S Meta/Lagom -B ${{ github.workspace }}/Build/tools-build \
|
||||||
-DLAGOM_TOOLS_ONLY=ON \
|
-DLAGOM_TOOLS_ONLY=ON \
|
||||||
-DINSTALL_LAGOM_TOOLS=ON \
|
-DINSTALL_LAGOM_TOOLS=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/Build/tools-install \
|
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/Build/tools-install \
|
||||||
|
|
|
@ -165,8 +165,10 @@
|
||||||
"description": "Fuzzers build",
|
"description": "Fuzzers build",
|
||||||
"binaryDir": "${fileDir}/Build/fuzzers",
|
"binaryDir": "${fileDir}/Build/fuzzers",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
|
"BUILD_SHARED_LIBS": "OFF",
|
||||||
"CMAKE_BUILD_TYPE": "",
|
"CMAKE_BUILD_TYPE": "",
|
||||||
"ENABLE_QT": "OFF",
|
"ENABLE_QT": "OFF",
|
||||||
|
"VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/distribution-triplets",
|
||||||
"ENABLE_FUZZERS_LIBFUZZER": "ON",
|
"ENABLE_FUZZERS_LIBFUZZER": "ON",
|
||||||
"ENABLE_ADDRESS_SANITIZER": "ON"
|
"ENABLE_ADDRESS_SANITIZER": "ON"
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,3 +18,54 @@ if (LINUX AND NOT LAGOM_USE_LINKER)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
|
||||||
|
|
||||||
|
# Munge the VCPKG_TRIPLET to correspond to the right one for our presets
|
||||||
|
# Just make sure not to override if the developer is trying to cross-compile
|
||||||
|
# or the developer set it manually, or if this is not the first run of CMake
|
||||||
|
if (NOT DEFINED CACHE{VCPKG_TARGET_TRIPLET} AND NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
||||||
|
# Only tweak settings if there's custom triplets defined
|
||||||
|
if (NOT DEFINED CACHE{VCPKG_OVERLAY_TRIPLETS})
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# And then, only tweak settings if the triplets are ours
|
||||||
|
if (NOT VCPKG_OVERLAY_TRIPLETS MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(arch "")
|
||||||
|
set(os "")
|
||||||
|
|
||||||
|
# The CMake way to do uname -{m,s} checks
|
||||||
|
cmake_host_system_information(RESULT os_platform QUERY OS_PLATFORM)
|
||||||
|
cmake_host_system_information(RESULT os_name QUERY OS_NAME)
|
||||||
|
|
||||||
|
if(os_platform MATCHES "^(x86_64|AMD64|amd64)$")
|
||||||
|
set(arch x64)
|
||||||
|
elseif(os_platform MATCHES "^(aarch64|arm64|ARM64)$")
|
||||||
|
set(arch arm64)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unable to automatically detect architecture for vcpkg, please set VCPKG_TARGET_TRIPLET manually")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (os_name STREQUAL "Linux")
|
||||||
|
set(os linux)
|
||||||
|
elseif (os_name MATCHES "Darwin|macOS")
|
||||||
|
set(os osx)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unable to automatically detect os name for vcpkg, please set VCPKG_TARGET_TRIPLET manually")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(full_triplet "${arch}-${os}")
|
||||||
|
|
||||||
|
# NOTE: This will break if we start putting a trailing / on the triplet paths :|
|
||||||
|
cmake_path(GET VCPKG_OVERLAY_TRIPLETS FILENAME triplet_path)
|
||||||
|
string(REPLACE "-triplets" "" triplet_path ${triplet_path})
|
||||||
|
string(TOLOWER ${triplet_path} triplet_path)
|
||||||
|
if (NOT triplet_path STREQUAL "distribution")
|
||||||
|
set(full_triplet "${full_triplet}-dynamic")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Determined host VCPKG_TARGET_TRIPLET: ${full_triplet}")
|
||||||
|
set(VCPKG_TARGET_TRIPLET ${full_triplet} CACHE STRING "")
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue