From e3c37e6e184a232e10b01dff5a065ce48c047f88 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 18 Jun 2024 14:32:15 -0500 Subject: cmake: Workaround MSVC module support compiler bug Adds the VULKAN_HEADERS_ENABLE_MODULE option to control whether to build the Vulkan-Hpp module. This is necessary to allow CI to pass while waiting for the MSVC version 17.11, which fixes an internal compiler bug, to be added to github actions runners. --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++----- CMakeLists.txt | 3 ++- tests/CMakeLists.txt | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f4cd8a..5ba23a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,11 @@ permissions: contents: read jobs: - cmake: + cmake-unix: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ ubuntu-latest, macos-latest ] cmake-version: [ '3.15', 'latest'] steps: - uses: actions/checkout@v4 @@ -30,9 +30,26 @@ jobs: cmakeVersion: ${{ matrix.cmake-version }} - uses: ilammy/msvc-dev-cmd@v1 - run: cmake -S . -B build -D VULKAN_HEADERS_ENABLE_TESTS=ON -D VULKAN_HEADERS_ENABLE_INSTALL=ON -G Ninja - - run: cmake --build ./build --verbose - - run: cmake --install build/ --prefix build/install --verbose - - run: ctest --output-on-failure --verbose + - run: cmake --build ./build + - run: cmake --install build/ --prefix build/install + - run: ctest --output-on-failure + working-directory: build + + cmake-windows: + runs-on: windows-latest + strategy: + matrix: + cmake-version: [ '3.15', 'latest'] + steps: + - uses: actions/checkout@v4 + - uses: lukka/get-cmake@latest + with: + cmakeVersion: ${{ matrix.cmake-version }} + - uses: ilammy/msvc-dev-cmd@v1 + - run: cmake -S . -B build -D VULKAN_HEADERS_ENABLE_TESTS=ON -D VULKAN_HEADERS_ENABLE_INSTALL=ON -G Ninja -DVULKAN_HEADERS_ENABLE_MODULE=OFF # workaround for compiler bug in 17.10 and before + - run: cmake --build ./build + - run: cmake --install build/ --prefix build/install + - run: ctest --output-on-failure working-directory: build reuse: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e6d7f1..8df7850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,8 +48,9 @@ if (MSVC AND (MSVC_VERSION GREATER_EQUAL "1934") OR set(COMPILER_SUPPORTS_CXX_MODULES TRUE) endif() +option(VULKAN_HEADERS_ENABLE_MODULE "Enables building of the Vulkan C++ module. Default is true if supported by the CMake version and compilers" ${COMPILER_SUPPORTS_CXX_MODULES}) -if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28" AND COMPILER_SUPPORTS_CXX_MODULES) +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28" AND VULKAN_HEADERS_ENABLE_MODULE) add_library(Vulkan-Module) add_library(Vulkan::VulkanHppModule ALIAS Vulkan-Module) target_sources(Vulkan-Module diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5a5984b..81823ab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,7 +12,7 @@ add_test(NAME integration.add_subdirectory --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory --build-generator ${CMAKE_GENERATOR} - --build-options -DFIND_PACKAGE_TESTING=OFF + --build-options -DFIND_PACKAGE_TESTING=OFF -DVULKAN_HEADERS_ENABLE_MODULE=OFF ) set(test_install_dir "${CMAKE_CURRENT_BINARY_DIR}/install") -- cgit v1.2.3