CMake: Create a set of vcpkg overlay triplets for sanitizers

This changes the Sanitizer configs to build all the vcpkg dependencies
with our specified CFLAGS and CXXFLAGS for ASAN and UBSAN.

Unfortunately, we can't yet enable actually compiling them with
sanitizers enabled, because this causes test failures that need to be
investigated.
This commit is contained in:
Andrew Kaster 2024-06-14 10:14:37 -06:00
parent b88e0eb50a
commit bf3c11229f
Notes: sideshowbarker 2024-07-16 23:34:49 +09:00
6 changed files with 36 additions and 6 deletions

View file

@ -17,10 +17,6 @@ runs:
if: ${{ inputs.os == 'Linux' }}
shell: bash
run: |
# These packages are already part of the ubuntu-22.04 image:
# cmake libgmp-dev npm shellcheck
# Packages below aren't.
set -e
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
@ -29,7 +25,7 @@ runs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install autoconf autoconf-archive automake ccache clang-18 clang++-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev
sudo apt-get install autoconf autoconf-archive automake build-essential cmake fonts-liberation2 zip curl tar ccache clang-18 clang++-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100

View file

@ -76,6 +76,13 @@ jobs:
echo "host_cxx=$(brew --prefix llvm@18)/bin/clang++" >> "$GITHUB_OUTPUT"
fi
- name: Set dynamic environment variables
id: 'set-env-vars'
run: |
# Note: Required for vcpkg to use this compiler for its own builds.
echo "CC=${{ steps.build-parameters.outputs.host_cc }}" >> "$GITHUB_ENV"
echo "CXX=${{ steps.build-parameters.outputs.host_cxx }}" >> "$GITHUB_ENV"
# https://github.com/actions/runner-images/issues/9330
- name: Enable Microphone Access (macOS 14)
if: ${{ inputs.os == 'macos-14' }}

View file

@ -46,7 +46,8 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"ENABLE_UNDEFINED_SANITIZER": "ON",
"ENABLE_ADDRESS_SANITIZER": "ON"
"ENABLE_ADDRESS_SANITIZER": "ON",
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/Meta/CMake/vcpkg/sanitizer-triplets"
}
},
{

View file

@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "-frtti")

View file

@ -0,0 +1,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "-frtti")

View file

@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "-frtti")