add option VULKAN_HEADERS_DISABLE_MODULE_STD to avoid automatic use of import std

This commit is contained in:
Jan Kuhlmann 2025-09-26 00:17:49 +02:00 committed by Charles Giessen
parent 8ed12a9178
commit ef7df1629c

View file

@ -41,8 +41,9 @@ project(VULKAN_HEADERS LANGUAGES C CXX VERSION ${VK_VERSION_STRING})
# options for Vulkan-Headers and the Vulkan-Hpp C++20 module # options for Vulkan-Headers and the Vulkan-Hpp C++20 module
option(VULKAN_HEADERS_ENABLE_TESTS "Test Vulkan-Headers" ${PROJECT_IS_TOP_LEVEL}) option(VULKAN_HEADERS_ENABLE_TESTS "Test Vulkan-Headers" ${PROJECT_IS_TOP_LEVEL})
option(VULKAN_HEADERS_ENABLE_INSTALL "Install Vulkan-Headers" ${PROJECT_IS_TOP_LEVEL}) option(VULKAN_HEADERS_ENABLE_INSTALL "Install Vulkan-Headers" ${PROJECT_IS_TOP_LEVEL})
option(VULKAN_HEADERS_ENABLE_MODULE "Enables building of the Vulkan C++20 module; requires minimum CMake version 3.28" OFF) option(VULKAN_HEADERS_ENABLE_MODULE "Enables building of the Vulkan C++20 module; requires minimum CMake version 3.28" ON)
option(VULKAN_HEADERS_ENABLE_MODULE_STD "Enables building of the Vulkan C++20 module with import std; requires minimum CMake version 3.30" OFF) option(VULKAN_HEADERS_ENABLE_MODULE_STD "Enables building of the Vulkan C++20 module with import std; requires minimum CMake version 3.30" OFF)
option(VULKAN_HEADERS_DISABLE_MODULE_STD "Disable automatic use of import std; for the Vulkan C++20 module" OFF)
# set up Vulkan-Headers # set up Vulkan-Headers
add_library(Vulkan-Headers INTERFACE) add_library(Vulkan-Headers INTERFACE)
@ -82,6 +83,9 @@ if (VULKAN_HEADERS_ENABLE_MODULE)
else() else()
target_compile_features(Vulkan-HppModule PUBLIC cxx_std_20) target_compile_features(Vulkan-HppModule PUBLIC cxx_std_20)
endif() endif()
if (VULKAN_HEADERS_DISABLE_MODULE_STD)
target_compile_definitions(Vulkan-HppModule PUBLIC VULKAN_HPP_NO_STD_MODULE=ON)
endif()
target_link_libraries(Vulkan-HppModule PUBLIC Vulkan::Headers) target_link_libraries(Vulkan-HppModule PUBLIC Vulkan::Headers)
# Clang 16's module support can be broken with extensions enabled # Clang 16's module support can be broken with extensions enabled