blob: c324bf918b8244a3628dfd3508aa8b040ef66247 [file] [log] [blame]
Antonio Maiorano9418b512020-04-08 23:18:13 -04001# 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
Nicolas Capens0c227672021-09-15 10:34:14 -040035 SpirvBinary.hpp
Nicolas Capensce9f17f2021-10-15 17:05:10 -040036 SpirvBinary.cpp
Antonio Maiorano9418b512020-04-08 23:18:13 -040037 SpirvID.hpp
38 SpirvShader.cpp
39 SpirvShader.hpp
40 SpirvShaderArithmetic.cpp
41 SpirvShaderControlFlow.cpp
42 SpirvShaderDebugger.cpp
Antonio Maiorano9418b512020-04-08 23:18:13 -040043 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
Nicolas Capensff91ac52021-11-29 18:29:01 +000056set(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
Antonio Maiorano9418b512020-04-08 23:18:13 -040063add_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
Antonio Maiorano9418b512020-04-08 23:18:13 -040078set_target_properties(vk_pipeline PROPERTIES
79 POSITION_INDEPENDENT_CODE 1
80 FOLDER "SwiftShader VK"
Antonio Maiorano9418b512020-04-08 23:18:13 -040081)
82
83target_include_directories(vk_pipeline
84 PUBLIC
85 ".."
Antonio Maiorano8772b422020-04-15 15:00:36 -040086 "${SWIFTSHADER_DIR}/include"
Antonio Maiorano9418b512020-04-08 23:18:13 -040087 "${SPIRV-Headers_SOURCE_DIR}/include"
88 "${SPIRV_TOOLS_EXT_INC_DIR}"
89)
90
91target_compile_options(vk_pipeline
Antonio Maiorano47d09cb2020-04-15 13:11:38 -040092 PRIVATE
Antonio Maiorano9418b512020-04-08 23:18:13 -040093 ${ROOT_PROJECT_COMPILE_OPTIONS}
Nicolas Capensff91ac52021-11-29 18:29:01 +000094 ${PIPELINE_COMPILE_OPTIONS}
Antonio Maiorano9418b512020-04-08 23:18:13 -040095)
96
Antonio Maiorano63aa9542020-04-20 17:52:01 -040097target_link_options(vk_pipeline
98 PUBLIC
99 ${SWIFTSHADER_LINK_FLAGS}
100)
101
Antonio Maiorano9418b512020-04-08 23:18:13 -0400102target_link_libraries(vk_pipeline
103 PUBLIC
104 vk_base
105 vk_system
106 marl
107 SPIRV-Tools
108 SPIRV-Tools-opt
109)