Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 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 | |
| 15 | set(ROOT_PROJECT_COMPILE_OPTIONS |
| 16 | ${SWIFTSHADER_COMPILE_OPTIONS} |
| 17 | ${WARNINGS_AS_ERRORS} |
| 18 | ) |
| 19 | |
| 20 | set(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 Capens | 0c22767 | 2021-09-15 10:34:14 -0400 | [diff] [blame] | 35 | SpirvBinary.hpp |
Nicolas Capens | ce9f17f | 2021-10-15 17:05:10 -0400 | [diff] [blame] | 36 | SpirvBinary.cpp |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 37 | SpirvID.hpp |
| 38 | SpirvShader.cpp |
| 39 | SpirvShader.hpp |
| 40 | SpirvShaderArithmetic.cpp |
| 41 | SpirvShaderControlFlow.cpp |
| 42 | SpirvShaderDebugger.cpp |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 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 | |
Nicolas Capens | ff91ac5 | 2021-11-29 18:29:01 +0000 | [diff] [blame] | 56 | set(PIPELINE_COMPILE_OPTIONS "") |
| 57 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 58 | list(APPEND PIPELINE_COMPILE_OPTIONS |
| 59 | "-Wexit-time-destructors" # declaration requires an exit-time destructor |
| 60 | ) |
| 61 | endif() |
| 62 | |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 63 | add_library(vk_pipeline EXCLUDE_FROM_ALL |
| 64 | ${PIPELINE_SRC_FILES} |
| 65 | ) |
| 66 | |
| 67 | # Add SPIRV-Tools dep |
| 68 | if (NOT TARGET SPIRV-Tools) |
| 69 | message(FATAL_ERROR "Missing required target: SPIRV-Tools") |
| 70 | endif() |
| 71 | |
| 72 | set_target_properties(core_tables PROPERTIES FOLDER "SPIRV-Tools build") |
| 73 | set_target_properties(enum_string_mapping PROPERTIES FOLDER "SPIRV-Tools build") |
| 74 | set_target_properties(extinst_tables PROPERTIES FOLDER "SPIRV-Tools build") |
| 75 | set_target_properties(spirv-tools-pkg-config PROPERTIES FOLDER "SPIRV-Tools build") |
| 76 | set_target_properties(spirv-tools-shared-pkg-config PROPERTIES FOLDER "SPIRV-Tools build") |
| 77 | |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 78 | set_target_properties(vk_pipeline PROPERTIES |
| 79 | POSITION_INDEPENDENT_CODE 1 |
| 80 | FOLDER "SwiftShader VK" |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 81 | ) |
| 82 | |
| 83 | target_include_directories(vk_pipeline |
| 84 | PUBLIC |
| 85 | ".." |
Antonio Maiorano | 8772b42 | 2020-04-15 15:00:36 -0400 | [diff] [blame] | 86 | "${SWIFTSHADER_DIR}/include" |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 87 | "${SPIRV-Headers_SOURCE_DIR}/include" |
| 88 | "${SPIRV_TOOLS_EXT_INC_DIR}" |
| 89 | ) |
| 90 | |
| 91 | target_compile_options(vk_pipeline |
Antonio Maiorano | 47d09cb | 2020-04-15 13:11:38 -0400 | [diff] [blame] | 92 | PRIVATE |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 93 | ${ROOT_PROJECT_COMPILE_OPTIONS} |
Nicolas Capens | ff91ac5 | 2021-11-29 18:29:01 +0000 | [diff] [blame] | 94 | ${PIPELINE_COMPILE_OPTIONS} |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 95 | ) |
| 96 | |
Antonio Maiorano | 63aa954 | 2020-04-20 17:52:01 -0400 | [diff] [blame] | 97 | target_link_options(vk_pipeline |
| 98 | PUBLIC |
| 99 | ${SWIFTSHADER_LINK_FLAGS} |
| 100 | ) |
| 101 | |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 102 | target_link_libraries(vk_pipeline |
| 103 | PUBLIC |
| 104 | vk_base |
| 105 | vk_system |
| 106 | marl |
| 107 | SPIRV-Tools |
| 108 | SPIRV-Tools-opt |
| 109 | ) |