mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2025-09-07 19:06:13 -04:00
CMake: Cleanup of vulkan target and cpp module test (#2105)
* cleanup of vulkan target * fixed cpp module test * extend ubuntu ci to compile cpp modules * only test cpp modules on ubuntu 24.04 * fixed condition syntax * exclude gcc <=14 * revert ci for ubuntu
This commit is contained in:
parent
04727f6695
commit
f9c5bfde49
@ -226,6 +226,9 @@ if ( VK_NO_PROTOTYPES )
|
||||
endif()
|
||||
if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_DISPATCH_LOADER_DYNAMIC" )
|
||||
if( UNIX )
|
||||
target_link_libraries( DispatchLoaderDynamicSharedLibrary PRIVATE ${CMAKE_DL_LIBS} )
|
||||
endif()
|
||||
else()
|
||||
find_package( Vulkan )
|
||||
if ( Vulkan_FOUND )
|
||||
@ -288,18 +291,21 @@ if( VULKAN_HPP_ENABLE_CPP20_MODULES )
|
||||
# create a target to provide VulkanHpp as C++20 module
|
||||
add_library( VulkanHppModule )
|
||||
add_library( Vulkan::HppModule ALIAS VulkanHppModule )
|
||||
set_target_properties( VulkanHppModule PROPERTIES
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF )
|
||||
# Clang 16's module support can be broken with extensions enabled
|
||||
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "16.0" )
|
||||
set_target_properties( VulkanHppModule PROPERTIES CXX_EXTENSIONS OFF )
|
||||
endif()
|
||||
if( VULKAN_HPP_ENABLE_STD_MODULE )
|
||||
target_compile_features( VulkanHppModule PUBLIC cxx_std_23 )
|
||||
set_target_properties( VulkanHppModule PROPERTIES CXX_MODULE_STD ON )
|
||||
else()
|
||||
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
|
||||
endif()
|
||||
target_sources( VulkanHppModule
|
||||
PUBLIC
|
||||
FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm )
|
||||
target_sources( VulkanHppModule PUBLIC
|
||||
FILE_SET vulkan_module_file
|
||||
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
TYPE CXX_MODULES
|
||||
FILES vulkan/vulkan.cppm )
|
||||
target_link_libraries( VulkanHppModule PUBLIC Vulkan::Hpp )
|
||||
endif()
|
||||
|
||||
|
@ -1,13 +1,4 @@
|
||||
cmake_minimum_required( VERSION 3.28 )
|
||||
|
||||
vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule NO_UTILS )
|
||||
|
||||
if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
|
||||
if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
|
||||
target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
|
||||
else()
|
||||
target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
|
||||
endif()
|
||||
target_link_libraries( Cpp20Modules PRIVATE Vulkan::Vulkan )
|
||||
set_target_properties( Cpp20Modules PROPERTIES CXX_EXTENSIONS OFF )
|
||||
endif()
|
||||
set_target_properties( Cpp20Modules PROPERTIES CXX_SCAN_FOR_MODULES ON )
|
@ -17,6 +17,8 @@
|
||||
|
||||
import vulkan_hpp;
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <vulkan/vulkan_hpp_macros.hpp>
|
||||
|
||||
static std::string AppName = "Cpp20Modules";
|
||||
|
Loading…
x
Reference in New Issue
Block a user