• 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    ${SWIFTSHADER_COMPILE_OPTIONS}
17    ${WARNINGS_AS_ERRORS}
18)
19
20set(PIPELINE_SRC_FILES
21    ComputeProgram.cpp
22    ComputeProgram.hpp
23    Constants.cpp
24    Constants.hpp
25    PixelProgram.cpp
26    PixelProgram.hpp
27    PixelRoutine.cpp
28    PixelRoutine.hpp
29    SamplerCore.cpp
30    SamplerCore.hpp
31    SetupRoutine.cpp
32    SetupRoutine.hpp
33    ShaderCore.cpp
34    ShaderCore.hpp
35    SpirvBinary.hpp
36    SpirvBinary.cpp
37    SpirvID.hpp
38    SpirvShader.cpp
39    SpirvShader.hpp
40    SpirvShaderArithmetic.cpp
41    SpirvShaderControlFlow.cpp
42    SpirvShaderDebugger.cpp
43    SpirvShaderGLSLstd450.cpp
44    SpirvShaderGroup.cpp
45    SpirvShaderImage.cpp
46    SpirvShaderInstructions.cpp
47    SpirvShaderMemory.cpp
48    SpirvShaderSampling.cpp
49    SpirvShaderSpec.cpp
50    VertexProgram.cpp
51    VertexProgram.hpp
52    VertexRoutine.cpp
53    VertexRoutine.hpp
54)
55
56set(PIPELINE_COMPILE_OPTIONS "")
57if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
58    list(APPEND PIPELINE_COMPILE_OPTIONS
59        "-Wexit-time-destructors"  # declaration requires an exit-time destructor
60    )
61endif()
62
63add_library(vk_pipeline EXCLUDE_FROM_ALL
64    ${PIPELINE_SRC_FILES}
65)
66
67# Add SPIRV-Tools dep
68if (NOT TARGET SPIRV-Tools)
69    message(FATAL_ERROR "Missing required target: SPIRV-Tools")
70endif()
71
72set_target_properties(core_tables PROPERTIES FOLDER "SPIRV-Tools build")
73set_target_properties(enum_string_mapping PROPERTIES FOLDER "SPIRV-Tools build")
74set_target_properties(extinst_tables PROPERTIES FOLDER "SPIRV-Tools build")
75set_target_properties(spirv-tools-pkg-config PROPERTIES FOLDER "SPIRV-Tools build")
76set_target_properties(spirv-tools-shared-pkg-config PROPERTIES FOLDER "SPIRV-Tools build")
77
78set_target_properties(vk_pipeline PROPERTIES
79    POSITION_INDEPENDENT_CODE 1
80    FOLDER "SwiftShader VK"
81)
82
83target_include_directories(vk_pipeline
84    PUBLIC
85        ".."
86        "${SWIFTSHADER_DIR}/include"
87        "${SPIRV-Headers_SOURCE_DIR}/include"
88        "${SPIRV_TOOLS_EXT_INC_DIR}"
89)
90
91target_compile_options(vk_pipeline
92    PRIVATE
93        ${ROOT_PROJECT_COMPILE_OPTIONS}
94        ${PIPELINE_COMPILE_OPTIONS}
95)
96
97target_link_options(vk_pipeline
98    PUBLIC
99        ${SWIFTSHADER_LINK_FLAGS}
100)
101
102target_link_libraries(vk_pipeline
103    PUBLIC
104        vk_base
105        vk_system
106        marl
107        SPIRV-Tools
108        SPIRV-Tools-opt
109)
110