xref: /aosp_15_r20/external/swiftshader/src/Pipeline/CMakeLists.txt (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
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    SpirvProfiler.hpp
39    SpirvProfiler.cpp
40    SpirvShader.cpp
41    SpirvShader.hpp
42    SpirvShaderArithmetic.cpp
43    SpirvShaderControlFlow.cpp
44    SpirvShaderDebugger.cpp
45    SpirvShaderGLSLstd450.cpp
46    SpirvShaderGroup.cpp
47    SpirvShaderImage.cpp
48    SpirvShaderInstructions.cpp
49    SpirvShaderMemory.cpp
50    SpirvShaderSampling.cpp
51    SpirvShaderSpec.cpp
52    VertexProgram.cpp
53    VertexProgram.hpp
54    VertexRoutine.cpp
55    VertexRoutine.hpp
56)
57
58set(PIPELINE_COMPILE_OPTIONS "")
59if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
60    list(APPEND PIPELINE_COMPILE_OPTIONS
61        "-Wexit-time-destructors"  # declaration requires an exit-time destructor
62    )
63endif()
64
65add_library(vk_pipeline EXCLUDE_FROM_ALL
66    ${PIPELINE_SRC_FILES}
67)
68
69# Add SPIRV-Tools dep
70if (NOT TARGET SPIRV-Tools)
71    message(FATAL_ERROR "Missing required target: SPIRV-Tools")
72endif()
73
74set_target_properties(core_tables PROPERTIES FOLDER "SPIRV-Tools build")
75set_target_properties(enum_string_mapping PROPERTIES FOLDER "SPIRV-Tools build")
76set_target_properties(extinst_tables 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        Reactor
108        SPIRV-Tools
109        SPIRV-Tools-opt
110)
111