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