# Vulkan # if(ENABLE_CPP20_MODULE) set(CMAKE_CXX_SCAN_FOR_MODULES ON) endif() find_package(Vulkan REQUIRED) if(ENABLE_CPP20_MODULE) add_library(VulkanCppModule) add_library(Vulkan::cppm ALIAS VulkanCppModule) target_compile_definitions(VulkanCppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_NO_STRUCT_CONSTRUCTORS=1 ) target_include_directories(VulkanCppModule PUBLIC "${Vulkan_INCLUDE_DIR}" ) target_link_libraries(VulkanCppModule PUBLIC Vulkan::Vulkan ) set_target_properties(VulkanCppModule PROPERTIES CXX_STANDARD 20) if(MSVC) target_compile_options(VulkanCppModule PRIVATE /std:c++latest /permissive- /Zc:__cplusplus /EHsc /Zc:preprocessor /translateInclude ) endif() target_sources(VulkanCppModule PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES BASE_DIRS "${Vulkan_INCLUDE_DIR}" FILES "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" ) target_sources(VulkanCppModule PRIVATE "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" ) else() add_library(VulkanCppModule INTERFACE) add_library(Vulkan::cppm ALIAS VulkanCppModule) target_link_libraries(VulkanCppModule INTERFACE Vulkan::Vulkan) target_compile_definitions(VulkanCppModule INTERFACE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_NO_STRUCT_CONSTRUCTORS=1 ) endif()