Skip to content

Commit e3c37e6

Browse files
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.
1 parent cde27c9 commit e3c37e6

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.github/workflows/ci.yml

+22-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
cmake:
20+
cmake-unix:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24-
os: [ ubuntu-latest, windows-latest, macos-latest ]
24+
os: [ ubuntu-latest, macos-latest ]
2525
cmake-version: [ '3.15', 'latest']
2626
steps:
2727
- uses: actions/checkout@v4
@@ -30,9 +30,26 @@ jobs:
3030
cmakeVersion: ${{ matrix.cmake-version }}
3131
- uses: ilammy/msvc-dev-cmd@v1
3232
- run: cmake -S . -B build -D VULKAN_HEADERS_ENABLE_TESTS=ON -D VULKAN_HEADERS_ENABLE_INSTALL=ON -G Ninja
33-
- run: cmake --build ./build --verbose
34-
- run: cmake --install build/ --prefix build/install --verbose
35-
- run: ctest --output-on-failure --verbose
33+
- run: cmake --build ./build
34+
- run: cmake --install build/ --prefix build/install
35+
- run: ctest --output-on-failure
36+
working-directory: build
37+
38+
cmake-windows:
39+
runs-on: windows-latest
40+
strategy:
41+
matrix:
42+
cmake-version: [ '3.15', 'latest']
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: lukka/get-cmake@latest
46+
with:
47+
cmakeVersion: ${{ matrix.cmake-version }}
48+
- uses: ilammy/msvc-dev-cmd@v1
49+
- 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
50+
- run: cmake --build ./build
51+
- run: cmake --install build/ --prefix build/install
52+
- run: ctest --output-on-failure
3653
working-directory: build
3754

3855
reuse:

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ if (MSVC AND (MSVC_VERSION GREATER_EQUAL "1934") OR
4848
set(COMPILER_SUPPORTS_CXX_MODULES TRUE)
4949
endif()
5050

51+
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})
5152

52-
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28" AND COMPILER_SUPPORTS_CXX_MODULES)
53+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28" AND VULKAN_HEADERS_ENABLE_MODULE)
5354
add_library(Vulkan-Module)
5455
add_library(Vulkan::VulkanHppModule ALIAS Vulkan-Module)
5556
target_sources(Vulkan-Module

tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_test(NAME integration.add_subdirectory
1212
--build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration
1313
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory
1414
--build-generator ${CMAKE_GENERATOR}
15-
--build-options -DFIND_PACKAGE_TESTING=OFF
15+
--build-options -DFIND_PACKAGE_TESTING=OFF -DVULKAN_HEADERS_ENABLE_MODULE=OFF
1616
)
1717

1818
set(test_install_dir "${CMAKE_CURRENT_BINARY_DIR}/install")

0 commit comments

Comments
 (0)