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