Skip to content

Commit

Permalink
cmake: Workaround MSVC module support compiler bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
charles-lunarg committed Jun 18, 2024
1 parent 6889820 commit 49bc039
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 49bc039

Please sign in to comment.