comparison fuhtark_test/Vulkan-Headers-1.4.334/tests/integration/CMakeLists.txt @ 1501:f40d9d814c08 default tip

did: correct vulkan-api generator
author sam <sam@basx.dev>
date Wed, 26 Nov 2025 23:34:29 +0700
parents
children
comparison
equal deleted inserted replaced
1500:91c8c3b7cbf0 1501:f40d9d814c08
1 # ~~~
2 # Copyright 2022-2023 The Khronos Group Inc.
3 # Copyright 2022-2023 Valve Corporation
4 # Copyright 2022-2023 LunarG, Inc.
5 #
6 # SPDX-License-Identifier: Apache-2.0
7 # ~~~
8 cmake_minimum_required(VERSION 3.22.1)
9
10 project(API LANGUAGES C CXX)
11
12 if (FIND_PACKAGE_TESTING)
13 find_package(VulkanHeaders REQUIRED CONFIG)
14 else()
15 add_subdirectory(../../ ${CMAKE_CURRENT_BINARY_DIR}/headers)
16 endif()
17
18 if (NOT TARGET Vulkan::Headers)
19 message(FATAL_ERROR "Vulkan::Headers target not defined")
20 endif()
21 if (NOT TARGET Vulkan::HppModule AND VULKAN_HEADERS_ENABLE_MODULE)
22 message(FATAL_ERROR "Vulkan::HppModule target not defined")
23 endif()
24
25 if (FIND_PACKAGE_TESTING)
26 if (NOT DEFINED VulkanHeaders_VERSION)
27 message(FATAL_ERROR "VulkanHeaders_VERSION not defined!")
28 endif()
29 message(STATUS "VulkanHeaders_VERSION = ${VulkanHeaders_VERSION}")
30 else()
31 # Consuming vulkan-headers via add_subdirectory should NOT add installation code to the parent CMake project.
32 if (DEFINED CMAKE_INSTALL_INCLUDEDIR)
33 message(FATAL_ERROR "CMAKE_INSTALL_INCLUDEDIR was defined!")
34 endif()
35
36 # NOTE: Some users may not be using the namespace target.
37 # Don't accidentally break them unless we have to.
38 if (NOT TARGET Vulkan-Headers)
39 message(FATAL_ERROR "Backcompat for Vulkan-Headers target broken!")
40 endif()
41 if (NOT TARGET Vulkan-HppModule AND VULKAN_HEADERS_ENABLE_MODULE)
42 message(FATAL_ERROR "Backcompat for Vulkan-HppModule target broken!")
43 endif()
44 endif()
45
46 set(CMAKE_C_STANDARD 99)
47 set(CMAKE_C_STANDARD_REQUIRED ON)
48 set(CMAKE_C_EXTENSIONS OFF)
49
50 if(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
51 add_compile_options(
52 -Wpedantic
53 -Wall
54 -Wextra
55 -Werror
56 )
57 endif()
58
59 if (MSVC)
60 add_compile_options(
61 /W4
62 /permissive-
63 /WX
64 )
65 endif()
66
67 # Test the non-API headers provided by this repo
68 # NOTE: For us testing just means that these header files compile
69 # with reasonable warnings.
70
71 # vk_icd.h
72 add_library(vk_icd MODULE ../vk_icd.c)
73 target_link_libraries(vk_icd PRIVATE Vulkan::Headers)
74
75 # vk_layer.h
76 add_library(vk_layer MODULE ../vk_layer.c)
77 target_link_libraries(vk_layer PRIVATE Vulkan::Headers)
78
79 # vulkan.hpp
80 add_library(vk_hpp MODULE ../vk_hpp.cpp)
81 target_compile_features(vk_hpp PUBLIC cxx_std_11)
82 target_link_libraries(vk_hpp PRIVATE Vulkan::Headers)
83
84 # vulkan.cppm
85 if (VULKAN_HEADERS_ENABLE_MODULE)
86 add_library(vk_hpp_module MODULE ../vk_hpp_module.cpp)
87 set_target_properties(vk_hpp_module PROPERTIES CXX_SCAN_FOR_MODULES ON)
88 target_link_libraries(vk_hpp_module PRIVATE Vulkan::HppModule)
89 endif()