1 # Copyright (c) 2018 Google LLC 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 set(SPIRV_TOOLS_REDUCE_SOURCES 15 change_operand_reduction_opportunity.h 16 operand_to_const_reduction_pass.h 17 operand_to_dominating_id_reduction_pass.h 18 reducer.h 19 reduction_opportunity.h 20 reduction_pass.h 21 remove_instruction_reduction_opportunity.h 22 remove_opname_instruction_reduction_pass.h 23 remove_unreferenced_instruction_reduction_pass.h 24 structured_loop_to_selection_reduction_opportunity.h 25 structured_loop_to_selection_reduction_pass.h 26 27 change_operand_reduction_opportunity.cpp 28 operand_to_const_reduction_pass.cpp 29 operand_to_dominating_id_reduction_pass.cpp 30 reducer.cpp 31 reduction_opportunity.cpp 32 reduction_pass.cpp 33 remove_instruction_reduction_opportunity.cpp 34 remove_unreferenced_instruction_reduction_pass.cpp 35 remove_opname_instruction_reduction_pass.cpp 36 structured_loop_to_selection_reduction_opportunity.cpp 37 structured_loop_to_selection_reduction_pass.cpp 38 ) 39 40 if(MSVC) 41 # Enable parallel builds across four cores for this lib 42 add_definitions(/MP4) 43 endif() 44 45 spvtools_pch(SPIRV_TOOLS_REDUCE_SOURCES pch_source_reduce) 46 47 add_library(SPIRV-Tools-reduce ${SPIRV_TOOLS_REDUCE_SOURCES}) 48 49 spvtools_default_compile_options(SPIRV-Tools-reduce) 50 target_include_directories(SPIRV-Tools-reduce 51 PUBLIC ${spirv-tools_SOURCE_DIR}/include 52 PUBLIC ${SPIRV_HEADER_INCLUDE_DIR} 53 PRIVATE ${spirv-tools_BINARY_DIR} 54 ) 55 # The reducer reuses a lot of functionality from the SPIRV-Tools library. 56 target_link_libraries(SPIRV-Tools-reduce 57 PUBLIC ${SPIRV_TOOLS} 58 PUBLIC SPIRV-Tools-opt) 59 60 set_property(TARGET SPIRV-Tools-reduce PROPERTY FOLDER "SPIRV-Tools libraries") 61 spvtools_check_symbol_exports(SPIRV-Tools-reduce) 62 63 if(ENABLE_SPIRV_TOOLS_INSTALL) 64 install(TARGETS SPIRV-Tools-reduce 65 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 66 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 67 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 68 endif(ENABLE_SPIRV_TOOLS_INSTALL) 69