Debian Codegraph @

tests/framework/CMakeLists.txt

raw
1 # ~~~
2 # Copyright (c) 2021 Valve Corporation
3 # Copyright (c) 2021 LunarG, Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ~~~
17
18 #configure the framework_config.h.in file - used to locate all the binaries generated so that it can be used in the tests
19 #setup framework_config_temp.h.in in the current binary directory
20 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/framework_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/framework_config_temp.h.in")
21
22 # setup framework_config_$<CONFIG> using framework_config_temp.h.in as a source
23 file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$<CONFIG>.h" INPUT "${CMAKE_CURRENT_BINARY_DIR}/framework_config_temp.h.in")
24
25 # Create a variable to hold the path to the correct header file, used as a compiler definition in the utils target
26 set(FRAMEWORK_CONFIG_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$<CONFIG>.h")
27
28 function(AddSharedLibrary LIBRARY_NAME)
29 set(singleValueArgs DEF_FILE)
30 set(multiValueArgs SOURCES DEFINITIONS)
31 cmake_parse_arguments(PARSED_ARGS "" "${singleValueArgs}"
32 "${multiValueArgs}" ${ARGN} )
33
34 add_library(${LIBRARY_NAME} SHARED ${PARSED_ARGS_SOURCES})
35 target_link_libraries(${LIBRARY_NAME} PUBLIC testing_framework_util)
36 target_compile_definitions(${LIBRARY_NAME} PRIVATE ${PARSED_ARGS_DEFINITIONS} VK_NO_PROTOTYPES)
37 # Windows requires export definitions for these libraries
38 if(WIN32)
39 target_sources(${LIBRARY_NAME} PRIVATE export_definitions/${PARSED_ARGS_DEF_FILE}.def)
40 endif()
41 endfunction()
42
43 add_subdirectory(util)
44 add_subdirectory(data)
45 add_subdirectory(shim)
46 add_subdirectory(icd)
47 add_subdirectory(layer)
48
49 add_library(testing_dependencies STATIC test_environment.cpp test_environment.h)
50 target_link_libraries(testing_dependencies
51 PUBLIC gtest Vulkan::Headers testing_framework_util shim-library)
52 target_include_directories(testing_dependencies PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
53