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(VULKAN_WRAPPER_SRC_FILES 19 Buffer.cpp 20 Buffer.hpp 21 DrawTester.cpp 22 DrawTester.hpp 23 Framebuffer.cpp 24 Framebuffer.hpp 25 Image.cpp 26 Image.hpp 27 Swapchain.cpp 28 Swapchain.hpp 29 Util.cpp 30 Util.hpp 31 VulkanHeaders.cpp 32 VulkanHeaders.hpp 33 VulkanTester.cpp 34 VulkanTester.hpp 35 Window.cpp 36 Window.hpp 37) 38 39add_library(VulkanWrapper STATIC 40 ${VULKAN_WRAPPER_SRC_FILES} 41) 42 43if (NOT TARGET glslang) 44 message(FATAL_ERROR "Missing required target: glslang") 45endif() 46 47if (NOT TARGET glslang-default-resource-limits) 48 message(FATAL_ERROR "Missing required target: glslang-default-resource-limits") 49endif() 50 51if (NOT TARGET SPIRV) 52 message(FATAL_ERROR "Missing required target: SPIRV") 53endif() 54 55set_target_properties(VulkanWrapper PROPERTIES 56 FOLDER "Tests" 57 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 58) 59 60target_include_directories(VulkanWrapper 61 PUBLIC 62 "." 63 "${SWIFTSHADER_DIR}/include" 64) 65 66target_compile_definitions(VulkanWrapper 67 PUBLIC 68 "STANDALONE" 69) 70 71target_compile_options(VulkanWrapper 72 PRIVATE 73 ${ROOT_PROJECT_COMPILE_OPTIONS} 74) 75 76target_link_options(VulkanWrapper 77 PRIVATE 78 ${SWIFTSHADER_LINK_FLAGS} 79) 80 81target_link_libraries(VulkanWrapper 82 PUBLIC 83 glslang 84 glslang-default-resource-limits 85 SPIRV 86) 87