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 ${WARNINGS_AS_ERRORS} 17) 18 19set(ROOT_PROJECT_LINK_LIBRARIES 20 ${OS_LIBS} 21 ${SWIFTSHADER_LIBS} 22) 23 24set(VULKAN_UNIT_TESTS_SRC_FILES 25 BasicTests.cpp 26 ComputeTests.cpp 27 Device.cpp 28 Device.hpp 29 DrawTests.cpp 30 Driver.cpp 31 Driver.hpp 32 main.cpp 33 VkGlobalFuncs.hpp 34 VkInstanceFuncs.hpp 35) 36 37add_executable(vk-unittests 38 ${VULKAN_UNIT_TESTS_SRC_FILES} 39) 40 41# vk-unittests loads vk_swiftshader, so make sure it gets built first 42add_dependencies(vk-unittests 43 vk_swiftshader 44) 45 46set_target_properties(vk-unittests PROPERTIES 47 FOLDER "Tests" 48 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 49) 50 51target_include_directories(vk-unittests 52 PRIVATE 53 "${SWIFTSHADER_DIR}/include" 54) 55 56target_compile_definitions(vk-unittests 57 PRIVATE 58 "STANDALONE" 59) 60 61target_compile_options(vk-unittests 62 PRIVATE 63 ${ROOT_PROJECT_COMPILE_OPTIONS} 64) 65 66target_link_options(vk-unittests 67 PRIVATE 68 ${SWIFTSHADER_LINK_FLAGS} 69) 70 71target_link_libraries(vk-unittests 72 PRIVATE 73 gtest 74 gmock 75 SPIRV-Tools 76 VulkanWrapper 77 ${ROOT_PROJECT_LINK_LIBRARIES} 78) 79