xref: /aosp_15_r20/external/swiftshader/tests/VulkanUnitTests/CMakeLists.txt (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set(ROOT_PROJECT_COMPILE_OPTIONS
16)
17
18set(ROOT_PROJECT_LINK_LIBRARIES
19    ${OS_LIBS}
20    ${SWIFTSHADER_LIBS}
21)
22
23set(VULKAN_UNIT_TESTS_SRC_FILES
24    BasicTests.cpp
25    ComputeTests.cpp
26    Device.cpp
27    Device.hpp
28    DrawTests.cpp
29    Driver.cpp
30    Driver.hpp
31    main.cpp
32    VkGlobalFuncs.hpp
33    VkInstanceFuncs.hpp
34)
35
36add_executable(vk-unittests
37    ${VULKAN_UNIT_TESTS_SRC_FILES}
38)
39
40# vk-unittests loads vk_swiftshader, so make sure it gets built first
41add_dependencies(vk-unittests
42    vk_swiftshader
43)
44
45set_target_properties(vk-unittests PROPERTIES
46    FOLDER "Tests"
47    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
48)
49
50target_include_directories(vk-unittests
51    PRIVATE
52        "${SWIFTSHADER_DIR}/include"
53)
54
55target_compile_definitions(vk-unittests
56    PRIVATE
57        "STANDALONE"
58)
59
60target_compile_options(vk-unittests
61    PRIVATE
62        ${ROOT_PROJECT_COMPILE_OPTIONS}
63)
64
65target_link_options(vk-unittests
66    PRIVATE
67        ${SWIFTSHADER_LINK_FLAGS}
68)
69
70target_link_libraries(vk-unittests
71    PRIVATE
72        gtest
73        gmock
74        SPIRV-Tools
75        VulkanWrapper
76        ${ROOT_PROJECT_LINK_LIBRARIES}
77)
78