Cleanup up on CMakeLists.txt (#1564)

This commit is contained in:
Andreas Süßenbach 2023-04-20 16:50:26 +02:00 committed by GitHub
parent 20cb37e39f
commit e1d6ec8abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 571 additions and 838 deletions

View File

@ -26,109 +26,265 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) function( vulkan_hpp__setup_platform )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
project(VulkanHppGenerator LANGUAGES CXX) if( WIN32 )
target_compile_definitions( ${TARGET_NAME} PUBLIC NOMINMAX VK_USE_PLATFORM_WIN32_KHR )
elseif( APPLE )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_MACOS_MVK )
elseif( UNIX )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_XCB_KHR )
else()
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
endif()
endfunction()
function( vulkan_hpp__setup_project )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
project( ${TARGET_NAME} LANGUAGES CXX )
endfunction()
function( vulkan_hpp__setup_library )
set( options SHARED )
set( oneValueArgs NAME )
set( multiValueArgs HEADERS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
if( "${TARGET_SOURCES}" STREQUAL "" )
add_library( ${TARGET_NAME} INTERFACE ${TARGET_HEADERS} )
else()
if( ${TARGET_SHARED} )
add_library( ${TARGET_NAME} SHARED ${TARGET_SOURCES} ${TARGET_HEADERS} )
else()
add_library( ${TARGET_NAME} ${TARGET_SOURCES} ${TARGET_HEADERS} )
endif()
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON )
endif()
endfunction()
function( vulkan_hpp__setup_sample )
set( options )
set( oneValueArgs FOLDER NAME PCH_REUSE )
set( multiValueArgs HEADERS INCLUDE_DIRS LIBS PCH SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${TARGET_HEADERS} ${TARGET_SOURCES} )
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON )
if( TARGET_FOLDER )
set_target_properties( ${TARGET_NAME} PROPERTIES FOLDER "${TARGET_FOLDER}" )
endif()
if( TARGET_INCLUDE_DIRS )
target_include_directories( ${TARGET_NAME} PUBLIC ${TARGET_INCLUDE_DIRS} )
endif()
if( TARGET_LIBS )
target_link_libraries( ${TARGET_NAME} PRIVATE "${TARGET_LIBS}" )
endif()
if( VULKAN_HPP_PRECOMPILE )
if( TARGET_PCH_REUSE )
target_precompile_headers( ${TARGET_NAME} REUSE_FROM "${TARGET_PCH_REUSE}" )
elseif( TARGET_PCH )
target_precompile_headers( ${TARGET_NAME} PRIVATE "${TARGET_PCH}" )
endif()
endif()
endfunction()
function( vulkan_hpp__setup_sample_static )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT SAMPLES_BUILD_ONLY_DYNAMIC )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_static" )
endif()
find_package( Vulkan REQUIRED )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH <vulkan/vulkan.hpp>
SOURCES ${TARGET_NAME}.cpp
LIBS ${Vulkan_LIBRARIES} )
target_compile_definitions( 01_InitInstance PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif()
endfunction()
function( vulkan_hpp__setup_sample_dynamic )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_dynamic" )
endif()
if( NOT TARGET_SOURCES )
set( TARGET_SOURCES ${TARGET_NAME}.cpp )
endif()
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils )
endfunction()
function( vulkan_hpp__setup_sample_raii )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_raii" )
endif()
if( NOT TARGET_SOURCES )
set( TARGET_SOURCES ${TARGET_NAME}.cpp )
endif()
vulkan_hpp__setup_sample(
NAME RAII_${TARGET_NAME}
FOLDER RAII_Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils )
endfunction()
function( vulkan_hpp__setup_test )
set( options )
set( oneValueArgs CXX_STANDARD NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_test" )
endif()
if( NOT TARGET_CXX_STANDARD )
set( TARGET_CXX_STANDARD 11 )
endif()
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${TARGET_NAME}.cpp )
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD ${TARGET_CXX_STANDARD} CXX_STANDARD_REQUIRED ON )
endfunction()
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format) find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format)
if( CLANG_FORMAT_EXECUTABLE )
if(CLANG_FORMAT_EXECUTABLE)
# get the clang-format version string # get the clang-format version string
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion) execute_process( COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion )
# filter out the actual version # filter out the actual version
string(REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}") string( REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}" )
# we need at least version 7.0.0 ! # we need at least version 7.0.0 !
if (clangFormatVersion VERSION_LESS 7.0.0) if( clangFormatVersion VERSION_LESS 7.0.0 )
message(WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp") message( WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp" )
else () else()
message(STATUS " Found clang-format version <" ${clangFormatVersion} ">.") message( STATUS " Found clang-format version <" ${clangFormatVersion} ">." )
add_definitions(-DCLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}") add_definitions( -DCLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
if (clangFormatVersion VERSION_LESS 11.0.0) if( clangFormatVersion VERSION_LESS 11.0.0 )
message(STATUS " Using .clang-format version 7." ) message( STATUS " Using .clang-format version 7." )
file(READ ".clang-format_7" clangFormat) file( READ ".clang-format_7" clangFormat )
elseif ( clangFormatVersion VERSION_LESS 12.0.0) elseif( clangFormatVersion VERSION_LESS 12.0.0 )
message(STATUS " Using .clang-format version 11." ) message( STATUS " Using .clang-format version 11." )
file(READ ".clang-format_11" clangFormat) file( READ ".clang-format_11" clangFormat )
elseif ( clangFormatVersion VERSION_LESS 13.0.0) elseif( clangFormatVersion VERSION_LESS 13.0.0 )
message(STATUS " Using .clang-format version 12." ) message( STATUS " Using .clang-format version 12." )
file(READ ".clang-format_12" clangFormat) file( READ ".clang-format_12" clangFormat )
elseif ( clangFormatVersion VERSION_LESS 14.0.0) elseif( clangFormatVersion VERSION_LESS 14.0.0 )
message(STATUS " Using .clang-format version 13." ) message( STATUS " Using .clang-format version 13." )
file(READ ".clang-format_13" clangFormat) file( READ ".clang-format_13" clangFormat )
elseif ( clangFormatVersion VERSION_LESS 15.0.0) elseif( clangFormatVersion VERSION_LESS 15.0.0 )
message(STATUS " Using .clang-format version 14." ) message( STATUS " Using .clang-format version 14." )
file(READ ".clang-format_14" clangFormat) file( READ ".clang-format_14" clangFormat )
else () else()
message(STATUS " Using .clang-format version 15." ) message(STATUS " Using .clang-format version 15." )
file(READ ".clang-format_15" clangFormat) file( READ ".clang-format_15" clangFormat )
endif () endif()
file(WRITE ".clang-format" ${clangFormat}) file( WRITE ".clang-format" ${clangFormat} )
endif() endif()
else() else()
message(WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted.") message( WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted." )
endif() endif()
if (NOT DEFINED CMAKE_CXX_STANDARD) if( NOT DEFINED VulkanRegistry_DIR )
set(CMAKE_CXX_STANDARD 11) if( DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR )
endif() set( VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry" )
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "CMAKE_CXX_STANDARD = <${CMAKE_CXX_STANDARD}>")
if (NOT DEFINED VulkanRegistry_DIR)
if (DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR)
set(VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry")
else() else()
set(VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry") set( VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry" )
endif() endif()
endif() endif()
file(TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec) file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec )
string(REPLACE "\\" "\\\\" vk_spec ${vk_spec}) string( REPLACE "\\" "\\\\" vk_spec ${vk_spec} )
add_definitions(-DVK_SPEC="${vk_spec}")
if (NOT DEFINED VulkanHeaders_INCLUDE_DIR) project( VulkanHppGenerator LANGUAGES CXX )
if (DEFINED VULKAN_HPP_PATH)
set(VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH}) if( NOT DEFINED VulkanHeaders_INCLUDE_DIR )
if( DEFINED VULKAN_HPP_PATH )
set( VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH} )
else() else()
set(VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set( VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
endif() endif()
endif() endif()
include_directories(${VulkanHeaders_INCLUDE_DIR}) include_directories( ${VulkanHeaders_INCLUDE_DIR} )
set(HEADERS set( HEADERS VulkanHppGenerator.hpp )
VulkanHppGenerator.hpp
)
set(SOURCES set( SOURCES VulkanHppGenerator.cpp )
VulkanHppGenerator.cpp
)
if (NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR) if( NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR )
set(VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2") set( VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2" )
endif() endif()
set(TINYXML2_SOURCES set( TINYXML2_SOURCES ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp )
${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp
)
set(TINYXML2_HEADERS set( TINYXML2_HEADERS ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h )
${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h
)
source_group(headers FILES ${HEADERS}) source_group( headers FILES ${HEADERS} )
source_group(sources FILES ${SOURCES}) source_group( sources FILES ${SOURCES} )
source_group(TinyXML2\\headers FILES ${TINYXML2_HEADERS}) source_group( TinyXML2\\headers FILES ${TINYXML2_HEADERS} )
source_group(TinyXML2\\sources FILES ${TINYXML2_SOURCES}) source_group( TinyXML2\\sources FILES ${TINYXML2_SOURCES} )
add_executable(VulkanHppGenerator add_executable( VulkanHppGenerator
${HEADERS} ${HEADERS}
${SOURCES} ${SOURCES}
${TINYXML2_SOURCES} ${TINYXML2_SOURCES}
${TINYXML2_HEADERS} ${TINYXML2_HEADERS}
) )
set(VK_GENERATED_VULKAN_HEADERS target_compile_definitions( ${PROJECT_NAME} PUBLIC BASE_PATH="${CMAKE_SOURCE_DIR}" VK_SPEC="${vk_spec}" )
set( VK_GENERATED_VULKAN_HEADERS
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_enums.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_enums.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_format_traits.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_format_traits.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp
@ -139,158 +295,58 @@ set(VK_GENERATED_VULKAN_HEADERS
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_assertions.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_assertions.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp
) )
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp) file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp )
string(REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp}) string( REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp} )
target_compile_definitions(${PROJECT_NAME} PUBLIC -DBASE_PATH="${CMAKE_SOURCE_DIR}") set_target_properties( ${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) if( MSVC )
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX )
if(MSVC) if( MSVC_VER GREATER_EQUAL 1910 )
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) target_compile_options( ${PROJECT_NAME} PRIVATE /permissive- )
if (MSVC_VER GREATER_EQUAL 1910)
target_compile_options(${PROJECT_NAME} PRIVATE /permissive-)
endif() endif()
else(MSVC) else( MSVC )
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror) target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror )
endif(MSVC) endif( MSVC )
target_include_directories(${PROJECT_NAME} PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR}) target_include_directories( ${PROJECT_NAME} PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
option (VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF) option( VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF )
if (VULKAN_HPP_RUN_GENERATOR) if( VULKAN_HPP_RUN_GENERATOR )
add_custom_command( add_custom_command(
COMMAND ${PROJECT_NAME} COMMAND ${PROJECT_NAME}
COMMAND ${PROJECT_NAME} -api vulkansc COMMAND ${PROJECT_NAME} -api vulkansc
OUTPUT "${vulkan_hpp}" OUTPUT "${vulkan_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run ${PROJECT_NAME}" COMMENT "run ${PROJECT_NAME}"
DEPENDS ${PROJECT_NAME} "${vk_spec}") DEPENDS ${PROJECT_NAME} "${vk_spec}" )
add_custom_target(build_vulkan_hpp ALL add_custom_target( build_vulkan_hpp ALL DEPENDS "${vulkan_hpp}" "${vk_spec}" )
DEPENDS "${vulkan_hpp}" "${vk_spec}")
endif() endif()
option (VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON) option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON )
function(vulkan_hpp__setup_sample) option( SAMPLES_BUILD "Build samples" OFF )
set(options) if( SAMPLES_BUILD )
set(oneValueArgs FOLDER NAME PCH_REUSE)
set(multiValueArgs HEADERS INCLUDE_DIRS LIBS PCH SOURCES)
cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(${TARGET_NAME} STREQUAL "")
message(FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample")
endif()
project(${TARGET_NAME} LANGUAGES CXX)
add_executable(${TARGET_NAME} ${TARGET_HEADERS} ${TARGET_SOURCES})
if (TARGET_INCLUDE_DIRS)
target_include_directories(${TARGET_NAME} PUBLIC ${TARGET_INCLUDE_DIRS})
endif()
if (TARGET_FOLDER)
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "${TARGET_FOLDER}")
endif()
if (VULKAN_HPP_PRECOMPILE)
if (TARGET_PCH_REUSE)
target_precompile_headers(${TARGET_NAME} REUSE_FROM "${TARGET_PCH_REUSE}")
elseif (TARGET_PCH)
target_precompile_headers(${TARGET_NAME} PRIVATE "${TARGET_PCH}")
endif()
endif()
if (TARGET_LIBS)
target_link_libraries(${TARGET_NAME} PRIVATE "${TARGET_LIBS}")
endif()
endfunction()
function(vulkan_hpp__setup_sample_static)
set(options)
set(oneValueArgs NAME)
set(multiValueArgs)
cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT SAMPLES_BUILD_ONLY_DYNAMIC)
find_package(Vulkan REQUIRED)
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH <vulkan/vulkan.hpp>
SOURCES ${TARGET_NAME}.cpp
LIBS ${Vulkan_LIBRARIES})
target_compile_definitions(01_InitInstance PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0)
endif()
endfunction()
function(vulkan_hpp__setup_sample_dynamic)
set(options)
set(oneValueArgs NAME)
set(multiValueArgs HEADERS INCLUDE_DIRS SOURCES)
cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT TARGET_SOURCES)
set(TARGET_SOURCES ${TARGET_NAME}.cpp)
endif()
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils)
endfunction()
function(vulkan_hpp__setup_sample_raii)
set(options)
set(oneValueArgs NAME)
set(multiValueArgs HEADERS INCLUDE_DIRS SOURCES)
cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT TARGET_SOURCES)
set(TARGET_SOURCES ${TARGET_NAME}.cpp)
endif()
vulkan_hpp__setup_sample(
NAME RAII_${TARGET_NAME}
FOLDER RAII_Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils)
endfunction()
option (SAMPLES_BUILD "Build samples" OFF)
if (SAMPLES_BUILD)
# external libraries # external libraries
add_subdirectory(glm) add_subdirectory( glm )
set(GLFW_BUILD_EXAMPLES OFF) set( GLFW_BUILD_EXAMPLES OFF )
set(GLFW_BUILD_TESTS OFF) set( GLFW_BUILD_TESTS OFF )
add_subdirectory(glfw) add_subdirectory( glfw )
add_subdirectory(glslang) add_subdirectory( glslang )
# samples # samples
add_subdirectory(samples) add_subdirectory( samples )
add_subdirectory(RAII_Samples) add_subdirectory( RAII_Samples )
endif () endif()
option (TESTS_BUILD "Build tests" OFF) option( TESTS_BUILD "Build tests" OFF )
if (TESTS_BUILD) if( TESTS_BUILD )
add_subdirectory(tests) add_subdirectory( tests )
endif () endif()
if (${VULKAN_HPP_INSTALL}) if( ${VULKAN_HPP_INSTALL} )
include(GNUInstallDirs) include( GNUInstallDirs )
install(FILES ${VK_GENERATED_VULKAN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan) install( FILES ${VK_GENERATED_VULKAN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan )
endif() endif()

View File

@ -12,86 +12,76 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
option (SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON) option( SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
option (SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF) option( SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF )
if(NOT (SAMPLES_BUILD_ONLY_DYNAMIC AND SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP)) if( NOT (SAMPLES_BUILD_ONLY_DYNAMIC AND SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP) )
find_package(Vulkan REQUIRED) find_package( Vulkan REQUIRED )
endif() endif()
if(MSVC) if( MSVC )
add_compile_options(/W4 /WX /permissive-) add_compile_options( /W4 /WX /permissive- )
else(MSVC)
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif(MSVC)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DNOMINMAX -DVK_USE_PLATFORM_WIN32_KHR)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
else() else()
message(FATAL_ERROR, "Vulkan-Hpp: unhandled platform for samples!") add_compile_options( -Wall -Wextra -pedantic -Werror )
endif() endif()
if (SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP) if( SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP )
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/.." )
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include") include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include" )
else() else()
include_directories("${Vulkan_INCLUDE_DIRS}") include_directories( "${Vulkan_INCLUDE_DIRS}" )
endif() endif()
add_subdirectory(utils) add_subdirectory( utils )
add_subdirectory(01_InitInstance) add_subdirectory( 01_InitInstance )
add_subdirectory(02_EnumerateDevices) add_subdirectory( 02_EnumerateDevices )
add_subdirectory(03_InitDevice) add_subdirectory( 03_InitDevice )
add_subdirectory(04_InitCommandBuffer) add_subdirectory( 04_InitCommandBuffer )
add_subdirectory(05_InitSwapchain) add_subdirectory( 05_InitSwapchain )
add_subdirectory(06_InitDepthBuffer) add_subdirectory( 06_InitDepthBuffer )
add_subdirectory(07_InitUniformBuffer) add_subdirectory( 07_InitUniformBuffer )
add_subdirectory(08_InitPipelineLayout) add_subdirectory( 08_InitPipelineLayout )
add_subdirectory(09_InitDescriptorSet) add_subdirectory( 09_InitDescriptorSet )
add_subdirectory(10_InitRenderPass) add_subdirectory( 10_InitRenderPass )
add_subdirectory(11_InitShaders) add_subdirectory( 11_InitShaders )
add_subdirectory(12_InitFrameBuffers) add_subdirectory( 12_InitFrameBuffers )
add_subdirectory(13_InitVertexBuffer) add_subdirectory( 13_InitVertexBuffer )
add_subdirectory(14_InitPipeline) add_subdirectory( 14_InitPipeline )
add_subdirectory(15_DrawCube) add_subdirectory( 15_DrawCube )
add_subdirectory(16_Vulkan_1_1) add_subdirectory( 16_Vulkan_1_1 )
add_subdirectory(CopyBlitImage) add_subdirectory( CopyBlitImage )
add_subdirectory(CreateDebugUtilsMessenger) add_subdirectory( CreateDebugUtilsMessenger )
add_subdirectory(DebugUtilsObjectName) add_subdirectory( DebugUtilsObjectName )
add_subdirectory(DrawTexturedCube) add_subdirectory( DrawTexturedCube )
add_subdirectory(DynamicUniform) add_subdirectory( DynamicUniform )
add_subdirectory(EnableValidationWithCallback) add_subdirectory( EnableValidationWithCallback )
add_subdirectory(EnumerateDevicesAdvanced) add_subdirectory( EnumerateDevicesAdvanced )
add_subdirectory(Events) add_subdirectory( Events )
add_subdirectory(ImmutableSampler) add_subdirectory( ImmutableSampler )
add_subdirectory(InitTexture) add_subdirectory( InitTexture )
add_subdirectory(InputAttachment) add_subdirectory( InputAttachment )
add_subdirectory(InstanceExtensionProperties) add_subdirectory( InstanceExtensionProperties )
add_subdirectory(InstanceLayerExtensionProperties) add_subdirectory( InstanceLayerExtensionProperties )
add_subdirectory(InstanceLayerProperties) add_subdirectory( InstanceLayerProperties )
add_subdirectory(InstanceVersion) add_subdirectory( InstanceVersion )
add_subdirectory(MultipleSets) add_subdirectory( MultipleSets )
add_subdirectory(OcclusionQuery) add_subdirectory( OcclusionQuery )
add_subdirectory(PhysicalDeviceExtensions) add_subdirectory( PhysicalDeviceExtensions )
add_subdirectory(PhysicalDeviceFeatures) add_subdirectory( PhysicalDeviceFeatures )
add_subdirectory(PhysicalDeviceGroups) add_subdirectory( PhysicalDeviceGroups )
add_subdirectory(PhysicalDeviceMemoryProperties) add_subdirectory( PhysicalDeviceMemoryProperties )
add_subdirectory(PhysicalDeviceProperties) add_subdirectory( PhysicalDeviceProperties )
add_subdirectory(PhysicalDeviceQueueFamilyProperties) add_subdirectory( PhysicalDeviceQueueFamilyProperties )
add_subdirectory(PipelineCache) add_subdirectory( PipelineCache )
add_subdirectory(PipelineDerivative) add_subdirectory( PipelineDerivative )
add_subdirectory(PushConstants) add_subdirectory( PushConstants )
add_subdirectory(PushDescriptors) add_subdirectory( PushDescriptors )
add_subdirectory(RayTracing) add_subdirectory( RayTracing )
add_subdirectory(SecondaryCommandBuffer) add_subdirectory( SecondaryCommandBuffer )
add_subdirectory(SeparateImageSampler) add_subdirectory( SeparateImageSampler )
add_subdirectory(SurfaceCapabilities) add_subdirectory( SurfaceCapabilities )
add_subdirectory(SurfaceFormats) add_subdirectory( SurfaceFormats )
add_subdirectory(Template) add_subdirectory( Template )
add_subdirectory(TexelBuffer) add_subdirectory( TexelBuffer )

View File

@ -12,26 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(RAII_utils LANGUAGES CXX) vulkan_hpp__setup_library( NAME RAII_utils HEADERS shaders.hpp utils.hpp )
set(HEADERS target_link_libraries( RAII_utils INTERFACE utils )
shaders.hpp target_compile_definitions( RAII_utils INTERFACE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
utils.hpp
)
set(SOURCES
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_library(RAII_utils INTERFACE
${SOURCES}
${HEADERS}
)
target_link_libraries(RAII_utils INTERFACE utils)
target_compile_definitions(RAII_utils INTERFACE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)

View File

@ -12,86 +12,76 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
option (SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON) option( SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
option (SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF) option( SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF )
if(NOT (SAMPLES_BUILD_ONLY_DYNAMIC AND SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP)) if( NOT (SAMPLES_BUILD_ONLY_DYNAMIC AND SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP) )
find_package(Vulkan REQUIRED) find_package( Vulkan REQUIRED )
endif() endif()
if(MSVC) if( MSVC )
add_compile_options(/W4 /WX /permissive-) add_compile_options( /W4 /WX /permissive- )
else(MSVC)
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif(MSVC)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DNOMINMAX -DVK_USE_PLATFORM_WIN32_KHR)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
else() else()
message(FATAL_ERROR, "Vulkan-Hpp: unhandled platform for samples!") add_compile_options( -Wall -Wextra -pedantic -Werror )
endif() endif()
if (SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP) if( SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP )
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/.." )
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include") include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include" )
else() else()
include_directories("${Vulkan_INCLUDE_DIRS}") include_directories( "${Vulkan_INCLUDE_DIRS}" )
endif() endif()
add_subdirectory(utils) add_subdirectory( utils )
add_subdirectory(01_InitInstance) add_subdirectory( 01_InitInstance )
add_subdirectory(02_EnumerateDevices) add_subdirectory( 02_EnumerateDevices )
add_subdirectory(03_InitDevice) add_subdirectory( 03_InitDevice )
add_subdirectory(04_InitCommandBuffer) add_subdirectory( 04_InitCommandBuffer )
add_subdirectory(05_InitSwapchain) add_subdirectory( 05_InitSwapchain )
add_subdirectory(06_InitDepthBuffer) add_subdirectory( 06_InitDepthBuffer )
add_subdirectory(07_InitUniformBuffer) add_subdirectory( 07_InitUniformBuffer )
add_subdirectory(08_InitPipelineLayout) add_subdirectory( 08_InitPipelineLayout )
add_subdirectory(09_InitDescriptorSet) add_subdirectory( 09_InitDescriptorSet )
add_subdirectory(10_InitRenderPass) add_subdirectory( 10_InitRenderPass )
add_subdirectory(11_InitShaders) add_subdirectory( 11_InitShaders )
add_subdirectory(12_InitFrameBuffers) add_subdirectory( 12_InitFrameBuffers )
add_subdirectory(13_InitVertexBuffer) add_subdirectory( 13_InitVertexBuffer )
add_subdirectory(14_InitPipeline) add_subdirectory( 14_InitPipeline )
add_subdirectory(15_DrawCube) add_subdirectory( 15_DrawCube )
add_subdirectory(16_Vulkan_1_1) add_subdirectory( 16_Vulkan_1_1 )
add_subdirectory(CopyBlitImage) add_subdirectory( CopyBlitImage )
add_subdirectory(CreateDebugUtilsMessenger) add_subdirectory( CreateDebugUtilsMessenger )
add_subdirectory(DebugUtilsObjectName) add_subdirectory( DebugUtilsObjectName )
add_subdirectory(DrawTexturedCube) add_subdirectory( DrawTexturedCube )
add_subdirectory(DynamicUniform) add_subdirectory( DynamicUniform )
add_subdirectory(EnableValidationWithCallback) add_subdirectory( EnableValidationWithCallback )
add_subdirectory(EnumerateDevicesAdvanced) add_subdirectory( EnumerateDevicesAdvanced )
add_subdirectory(Events) add_subdirectory( Events )
add_subdirectory(ImmutableSampler) add_subdirectory( ImmutableSampler )
add_subdirectory(InitTexture) add_subdirectory( InitTexture )
add_subdirectory(InputAttachment) add_subdirectory( InputAttachment )
add_subdirectory(InstanceExtensionProperties) add_subdirectory( InstanceExtensionProperties )
add_subdirectory(InstanceLayerExtensionProperties) add_subdirectory( InstanceLayerExtensionProperties )
add_subdirectory(InstanceLayerProperties) add_subdirectory( InstanceLayerProperties )
add_subdirectory(InstanceVersion) add_subdirectory( InstanceVersion )
add_subdirectory(MultipleSets) add_subdirectory( MultipleSets )
add_subdirectory(OcclusionQuery) add_subdirectory( OcclusionQuery )
add_subdirectory(PhysicalDeviceExtensions) add_subdirectory( PhysicalDeviceExtensions )
add_subdirectory(PhysicalDeviceFeatures) add_subdirectory( PhysicalDeviceFeatures )
add_subdirectory(PhysicalDeviceGroups) add_subdirectory( PhysicalDeviceGroups )
add_subdirectory(PhysicalDeviceMemoryProperties) add_subdirectory( PhysicalDeviceMemoryProperties )
add_subdirectory(PhysicalDeviceProperties) add_subdirectory( PhysicalDeviceProperties )
add_subdirectory(PhysicalDeviceQueueFamilyProperties) add_subdirectory( PhysicalDeviceQueueFamilyProperties )
add_subdirectory(PipelineCache) add_subdirectory( PipelineCache )
add_subdirectory(PipelineDerivative) add_subdirectory( PipelineDerivative )
add_subdirectory(PushConstants) add_subdirectory( PushConstants )
add_subdirectory(PushDescriptors) add_subdirectory( PushDescriptors )
add_subdirectory(RayTracing) add_subdirectory( RayTracing )
add_subdirectory(SecondaryCommandBuffer) add_subdirectory( SecondaryCommandBuffer )
add_subdirectory(SeparateImageSampler) add_subdirectory( SeparateImageSampler )
add_subdirectory(SurfaceCapabilities) add_subdirectory( SurfaceCapabilities )
add_subdirectory(SurfaceFormats) add_subdirectory( SurfaceFormats )
add_subdirectory(Template) add_subdirectory( Template )
add_subdirectory(TexelBuffer) add_subdirectory( TexelBuffer )

View File

@ -12,39 +12,19 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(utils LANGUAGES CXX) vulkan_hpp__setup_library( NAME utils HEADERS math.hpp shaders.hpp utils.hpp SOURCES math.cpp shaders.cpp utils.cpp )
set(HEADERS if( VULKAN_HPP_RUN_GENERATOR )
math.hpp add_dependencies( utils build_vulkan_hpp )
shaders.hpp
utils.hpp
)
set(SOURCES
math.cpp
shaders.cpp
utils.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_library(utils
${SOURCES}
${HEADERS}
)
if (VULKAN_HPP_RUN_GENERATOR)
add_dependencies(utils build_vulkan_hpp)
endif() endif()
target_link_libraries(utils PUBLIC glm) target_link_libraries( utils PUBLIC glm )
target_link_libraries(utils PUBLIC glfw) target_link_libraries( utils PUBLIC glfw )
target_link_libraries(utils PUBLIC glslang) target_link_libraries( utils PUBLIC glslang )
target_link_libraries(utils PUBLIC glslang-default-resource-limits) target_link_libraries( utils PUBLIC glslang-default-resource-limits )
target_link_libraries(utils PUBLIC SPIRV) target_link_libraries( utils PUBLIC SPIRV )
target_compile_definitions(utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1) target_compile_definitions (utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
target_precompile_headers(utils PRIVATE <vulkan/vulkan.hpp>) target_precompile_headers( utils PRIVATE <vulkan/vulkan.hpp> )

View File

@ -12,26 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
project(ArrayProxy LANGUAGES CXX) vulkan_hpp__setup_test( NAME ArrayProxy )
set(HEADERS set_target_properties( ArrayProxy PROPERTIES FOLDER "Tests" )
) target_link_libraries( ArrayProxy PRIVATE utils )
set(SOURCES
ArrayProxy.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(ArrayProxy
${HEADERS}
${SOURCES}
)
set_target_properties(ArrayProxy PROPERTIES FOLDER "Tests")
target_link_libraries(ArrayProxy PRIVATE utils)
endif() endif()

View File

@ -12,26 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
project(ArrayProxyNoTemporaries LANGUAGES CXX) vulkan_hpp__setup_test( NAME ArrayProxyNoTemporaries )
set(HEADERS set_target_properties( ArrayProxyNoTemporaries PROPERTIES FOLDER "Tests" )
) target_link_libraries( ArrayProxyNoTemporaries PRIVATE utils )
set(SOURCES
ArrayProxyNoTemporaries.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(ArrayProxyNoTemporaries
${HEADERS}
${SOURCES}
)
set_target_properties(ArrayProxyNoTemporaries PROPERTIES FOLDER "Tests")
target_link_libraries(ArrayProxyNoTemporaries PRIVATE utils)
endif() endif()

View File

@ -12,52 +12,44 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
option (TESTS_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON) option( TESTS_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
option (TESTS_BUILD_ONLY_DYNAMIC "Build only dynamic" OFF) option( TESTS_BUILD_ONLY_DYNAMIC "Build only dynamic" OFF )
if (NOT (TESTS_BUILD_ONLY_DYNAMIC AND TESTS_BUILD_WITH_LOCAL_VULKAN_HPP)) if( NOT (TESTS_BUILD_ONLY_DYNAMIC AND TESTS_BUILD_WITH_LOCAL_VULKAN_HPP) )
find_package(Vulkan REQUIRED) find_package( Vulkan REQUIRED )
endif() endif()
if(MSVC) if( MSVC )
add_compile_options(/W4 /WX /permissive-) add_compile_options( /W4 /WX /permissive- )
else(MSVC)
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif(MSVC)
if (WIN32)
add_definitions(-DNOMINMAX -DVK_USE_PLATFORM_WIN32_KHR)
elseif(APPLE)
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
elseif(UNIX)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR)
endif()
if (TESTS_BUILD_WITH_LOCAL_VULKAN_HPP)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include")
else() else()
include_directories("${Vulkan_INCLUDE_DIRS}") add_compile_options( -Wall -Wextra -pedantic -Werror )
endif() endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../glm") if( TESTS_BUILD_WITH_LOCAL_VULKAN_HPP )
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/.." )
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../Vulkan-Headers/include" )
else()
include_directories( "${Vulkan_INCLUDE_DIRS}" )
endif()
add_subdirectory(ArrayProxy) include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../glm" )
add_subdirectory(ArrayProxyNoTemporaries)
add_subdirectory(DesignatedInitializers) add_subdirectory( ArrayProxy )
add_subdirectory(DeviceFunctions) add_subdirectory( ArrayProxyNoTemporaries )
add_subdirectory(DispatchLoaderDynamic) add_subdirectory( DesignatedInitializers )
add_subdirectory(DispatchLoaderDynamicSharedLibrary) add_subdirectory( DeviceFunctions )
add_subdirectory(DispatchLoaderDynamicSharedLibraryClient) add_subdirectory( DispatchLoaderDynamic )
add_subdirectory(DispatchLoaderStatic) add_subdirectory( DispatchLoaderDynamicSharedLibrary )
add_subdirectory(ExtensionInspection) add_subdirectory( DispatchLoaderDynamicSharedLibraryClient )
add_subdirectory(Flags) add_subdirectory( DispatchLoaderStatic )
add_subdirectory(FormatTraits) add_subdirectory( ExtensionInspection )
add_subdirectory(Hash) add_subdirectory( Flags )
add_subdirectory(NoExceptions) add_subdirectory( FormatTraits )
add_subdirectory(StridedArrayProxy) add_subdirectory( Hash )
add_subdirectory(StructureChain) add_subdirectory( NoExceptions )
add_subdirectory(UniqueHandle) add_subdirectory( StridedArrayProxy )
add_subdirectory(UniqueHandleDefaultArguments) add_subdirectory( StructureChain )
add_subdirectory( UniqueHandle )
add_subdirectory( UniqueHandleDefaultArguments )

View File

@ -12,28 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
project(DesignatedInitializers LANGUAGES CXX) vulkan_hpp__setup_test( NAME DesignatedInitializers CXX_STANDARD 20 )
set(CMAKE_CXX_STANDARD 20) set_target_properties( DesignatedInitializers PROPERTIES FOLDER "Tests" )
target_link_libraries( DesignatedInitializers PRIVATE utils )
set(HEADERS
)
set(SOURCES
DesignatedInitializers.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(DesignatedInitializers
${HEADERS}
${SOURCES}
)
set_target_properties(DesignatedInitializers PROPERTIES FOLDER "Tests")
target_link_libraries(DesignatedInitializers PRIVATE utils)
endif() endif()

View File

@ -12,29 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
vulkan_hpp__setup_test( NAME DeviceFunctions )
find_package(Vulkan REQUIRED) find_package( Vulkan REQUIRED )
project(DeviceFunctions LANGUAGES CXX) set_target_properties( DeviceFunctions PROPERTIES FOLDER "Tests" )
target_link_libraries( DeviceFunctions PRIVATE utils ${Vulkan_LIBRARIES} )
set(HEADERS
)
set(SOURCES
DeviceFunctions.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(DeviceFunctions
${HEADERS}
${SOURCES}
)
set_target_properties(DeviceFunctions PROPERTIES FOLDER "Tests")
target_link_libraries(DeviceFunctions PRIVATE utils ${Vulkan_LIBRARIES})
endif() endif()

View File

@ -12,28 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(DispatchLoaderDynamic LANGUAGES CXX) vulkan_hpp__setup_test( NAME DispatchLoaderDynamic )
set(HEADERS if( UNIX )
) target_link_libraries( DispatchLoaderDynamic PRIVATE ${CMAKE_DL_LIBS} )
set(SOURCES
DispatchLoaderDynamic.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(DispatchLoaderDynamic
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(DispatchLoaderDynamic PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(DispatchLoaderDynamic PROPERTIES FOLDER "Tests") set_target_properties( DispatchLoaderDynamic PROPERTIES FOLDER "Tests" )
target_link_libraries(DispatchLoaderDynamic PRIVATE utils) target_link_libraries( DispatchLoaderDynamic PRIVATE utils )

View File

@ -12,30 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(DispatchLoaderDynamicSharedLibrary LANGUAGES CXX) vulkan_hpp__setup_library( NAME DispatchLoaderDynamicSharedLibrary SHARED SOURCES DispatchLoaderDynamicSharedLibrary.cpp )
set(HEADERS target_compile_definitions( DispatchLoaderDynamicSharedLibrary PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_STORAGE_SHARED VULKAN_HPP_STORAGE_SHARED_EXPORT )
)
set(SOURCES if( UNIX )
DispatchLoaderDynamicSharedLibrary.cpp target_link_libraries( DispatchLoaderDynamicSharedLibrary PRIVATE ${CMAKE_DL_LIBS} )
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_library(DispatchLoaderDynamicSharedLibrary SHARED
${HEADERS}
${SOURCES}
)
target_compile_definitions(DispatchLoaderDynamicSharedLibrary PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_STORAGE_SHARED VULKAN_HPP_STORAGE_SHARED_EXPORT )
if (UNIX)
target_link_libraries(DispatchLoaderDynamicSharedLibrary PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(DispatchLoaderDynamicSharedLibrary PROPERTIES FOLDER "Tests") set_target_properties( DispatchLoaderDynamicSharedLibrary PROPERTIES FOLDER "Tests" )
target_link_libraries(DispatchLoaderDynamicSharedLibrary PRIVATE utils) target_link_libraries( DispatchLoaderDynamicSharedLibrary PRIVATE utils )

View File

@ -12,32 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(DispatchLoaderDynamicSharedLibraryClient LANGUAGES CXX) vulkan_hpp__setup_test( NAME DispatchLoaderDynamicSharedLibraryClient )
set(HEADERS target_compile_definitions( DispatchLoaderDynamicSharedLibraryClient PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_STORAGE_SHARED )
)
set(SOURCES target_link_libraries( DispatchLoaderDynamicSharedLibraryClient PRIVATE DispatchLoaderDynamicSharedLibrary )
DispatchLoaderDynamicSharedLibraryClient.cpp
)
source_group(headers FILES ${HEADERS}) if( UNIX )
source_group(sources FILES ${SOURCES}) target_link_libraries( DispatchLoaderDynamicSharedLibraryClient PRIVATE ${CMAKE_DL_LIBS} )
add_executable(DispatchLoaderDynamicSharedLibraryClient
${HEADERS}
${SOURCES}
)
target_compile_definitions(DispatchLoaderDynamicSharedLibraryClient PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_STORAGE_SHARED)
target_link_libraries(DispatchLoaderDynamicSharedLibraryClient PRIVATE DispatchLoaderDynamicSharedLibrary)
if (UNIX)
target_link_libraries(DispatchLoaderDynamicSharedLibraryClient PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(DispatchLoaderDynamicSharedLibraryClient PROPERTIES FOLDER "Tests") set_target_properties( DispatchLoaderDynamicSharedLibraryClient PROPERTIES FOLDER "Tests" )
target_link_libraries(DispatchLoaderDynamicSharedLibraryClient PRIVATE utils) target_link_libraries( DispatchLoaderDynamicSharedLibraryClient PRIVATE utils )

View File

@ -12,34 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
find_package( Vulkan REQUIRED )
find_package(Vulkan REQUIRED) vulkan_hpp__setup_test( NAME DispatchLoaderStatic )
project(DispatchLoaderStatic LANGUAGES CXX) if( UNIX )
target_link_libraries( DispatchLoaderStatic PRIVATE ${CMAKE_DL_LIBS} )
set(HEADERS
)
set(SOURCES
DispatchLoaderStatic.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(DispatchLoaderStatic
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(DispatchLoaderStatic PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(DispatchLoaderStatic PROPERTIES FOLDER "Tests") set_target_properties( DispatchLoaderStatic PROPERTIES FOLDER "Tests" )
target_link_libraries(DispatchLoaderStatic PRIVATE utils ${Vulkan_LIBRARIES}) target_link_libraries( DispatchLoaderStatic PRIVATE utils ${Vulkan_LIBRARIES} )
endif() endif()

View File

@ -12,24 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(ExtensionInspection LANGUAGES CXX) vulkan_hpp__setup_test( NAME ExtensionInspection )
set(HEADERS set_target_properties( ExtensionInspection PROPERTIES CXX_STANDARD 20 FOLDER "Tests" )
) target_link_libraries( ExtensionInspection PRIVATE utils )
set(SOURCES
ExtensionInspection.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(ExtensionInspection
${HEADERS}
${SOURCES}
)
set_target_properties(ExtensionInspection PROPERTIES CXX_STANDARD 20 FOLDER "Tests")
target_link_libraries(ExtensionInspection PRIVATE utils)

View File

@ -12,24 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(Flags LANGUAGES CXX) vulkan_hpp__setup_test( NAME Flags )
set(HEADERS set_target_properties( Flags PROPERTIES FOLDER "Tests" )
) target_link_libraries( Flags PRIVATE utils )
set(SOURCES
Flags.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(Flags
${HEADERS}
${SOURCES}
)
set_target_properties(Flags PROPERTIES FOLDER "Tests")
target_link_libraries(Flags PRIVATE utils)

View File

@ -12,24 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(FormatTraits LANGUAGES CXX) vulkan_hpp__setup_test( NAME FormatTraits )
set(HEADERS set_target_properties( FormatTraits PROPERTIES FOLDER "Tests" )
) target_link_libraries( FormatTraits PRIVATE utils )
set(SOURCES
FormatTraits.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(FormatTraits
${HEADERS}
${SOURCES}
)
set_target_properties(FormatTraits PROPERTIES FOLDER "Tests")
target_link_libraries(FormatTraits PRIVATE utils)

View File

@ -12,26 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
project(Hash LANGUAGES CXX) vulkan_hpp__setup_test( NAME Hash )
set(HEADERS set_target_properties( Hash PROPERTIES FOLDER "Tests" )
) target_link_libraries( Hash PRIVATE utils )
set(SOURCES
Hash.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(Hash
${HEADERS}
${SOURCES}
)
set_target_properties(Hash PROPERTIES FOLDER "Tests")
target_link_libraries(Hash PRIVATE utils)
endif() endif()

View File

@ -12,27 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(NoExceptions LANGUAGES CXX) vulkan_hpp__setup_test( NAME NoExceptions )
set(HEADERS if( UNIX )
) target_link_libraries( NoExceptions PRIVATE ${CMAKE_DL_LIBS} )
set(SOURCES
NoExceptions.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(NoExceptions
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(NoExceptions PRIVATE ${CMAKE_DL_LIBS})
endif () endif ()
set_target_properties(NoExceptions PROPERTIES FOLDER "Tests") set_target_properties( NoExceptions PROPERTIES FOLDER "Tests" )
target_link_libraries(NoExceptions PRIVATE utils) target_link_libraries( NoExceptions PRIVATE utils )

View File

@ -12,26 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
if (NOT TESTS_BUILD_ONLY_DYNAMIC) if( NOT TESTS_BUILD_ONLY_DYNAMIC )
project(StridedArrayProxy LANGUAGES CXX) vulkan_hpp__setup_test( NAME StridedArrayProxy )
set(HEADERS set_target_properties( StridedArrayProxy PROPERTIES FOLDER "Tests" )
) target_link_libraries( StridedArrayProxy PRIVATE utils )
set(SOURCES
StridedArrayProxy.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(StridedArrayProxy
${HEADERS}
${SOURCES}
)
set_target_properties(StridedArrayProxy PROPERTIES FOLDER "Tests")
target_link_libraries(StridedArrayProxy PRIVATE utils)
endif() endif()

View File

@ -12,28 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(StructureChain LANGUAGES CXX) vulkan_hpp__setup_test( NAME StructureChain )
set(HEADERS if( UNIX )
) target_link_libraries( StructureChain PRIVATE ${CMAKE_DL_LIBS} )
set(SOURCES
StructureChain.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(StructureChain
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(StructureChain PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(StructureChain PROPERTIES FOLDER "Tests") set_target_properties( StructureChain PROPERTIES FOLDER "Tests" )
target_link_libraries(StructureChain PRIVATE utils) target_link_libraries( StructureChain PRIVATE utils )

View File

@ -12,24 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(UniqueHandle LANGUAGES CXX) vulkan_hpp__setup_test( NAME UniqueHandle )
set(HEADERS set_target_properties( UniqueHandle PROPERTIES FOLDER "Tests" )
) target_link_libraries( UniqueHandle PRIVATE utils )
set(SOURCES
UniqueHandle.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable(UniqueHandle
${HEADERS}
${SOURCES}
)
set_target_properties(UniqueHandle PROPERTIES FOLDER "Tests")
target_link_libraries(UniqueHandle PRIVATE utils)

View File

@ -12,28 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.2) cmake_minimum_required( VERSION 3.2 )
project(UniqueHandleDefaultArguments LANGUAGES CXX) vulkan_hpp__setup_library( NAME UniqueHandleDefaultArguments SOURCES UniqueHandleDefaultArguments.cpp )
set(HEADERS if( UNIX )
) target_link_libraries( UniqueHandleDefaultArguments PRIVATE ${CMAKE_DL_LIBS} )
set(SOURCES
UniqueHandleDefaultArguments.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_library(UniqueHandleDefaultArguments
${HEADERS}
${SOURCES}
)
if (UNIX)
target_link_libraries(UniqueHandleDefaultArguments PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(UniqueHandleDefaultArguments PROPERTIES FOLDER "Tests") set_target_properties( UniqueHandleDefaultArguments PROPERTIES FOLDER "Tests" )
target_link_libraries(UniqueHandleDefaultArguments PRIVATE utils) target_link_libraries( UniqueHandleDefaultArguments PRIVATE utils )