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 merge_blocks_reduction_opportunity.h 18 merge_blocks_reduction_opportunity_finder.h 19 operand_to_const_reduction_opportunity_finder.h 20 operand_to_undef_reduction_opportunity_finder.h 21 operand_to_dominating_id_reduction_opportunity_finder.h 22 reducer.h 23 reduction_opportunity.h 24 reduction_opportunity_finder.h 25 reduction_pass.h 26 reduction_util.h 27 remove_block_reduction_opportunity.h 28 remove_block_reduction_opportunity_finder.h 29 remove_function_reduction_opportunity.h 30 remove_function_reduction_opportunity_finder.h 31 remove_instruction_reduction_opportunity.h 32 remove_selection_reduction_opportunity.h 33 remove_selection_reduction_opportunity_finder.h 34 remove_struct_member_reduction_opportunity.h 35 remove_unused_instruction_reduction_opportunity_finder.h 36 remove_unused_struct_member_reduction_opportunity_finder.h 37 structured_loop_to_selection_reduction_opportunity.h 38 structured_loop_to_selection_reduction_opportunity_finder.h 39 conditional_branch_to_simple_conditional_branch_opportunity_finder.h 40 conditional_branch_to_simple_conditional_branch_reduction_opportunity.h 41 simple_conditional_branch_to_branch_opportunity_finder.h 42 simple_conditional_branch_to_branch_reduction_opportunity.h 43 44 change_operand_reduction_opportunity.cpp 45 change_operand_to_undef_reduction_opportunity.cpp 46 merge_blocks_reduction_opportunity.cpp 47 merge_blocks_reduction_opportunity_finder.cpp 48 operand_to_const_reduction_opportunity_finder.cpp 49 operand_to_undef_reduction_opportunity_finder.cpp 50 operand_to_dominating_id_reduction_opportunity_finder.cpp 51 reducer.cpp 52 reduction_opportunity.cpp 53 reduction_opportunity_finder.cpp 54 reduction_pass.cpp 55 reduction_util.cpp 56 remove_block_reduction_opportunity.cpp 57 remove_block_reduction_opportunity_finder.cpp 58 remove_function_reduction_opportunity.cpp 59 remove_function_reduction_opportunity_finder.cpp 60 remove_instruction_reduction_opportunity.cpp 61 remove_selection_reduction_opportunity.cpp 62 remove_selection_reduction_opportunity_finder.cpp 63 remove_struct_member_reduction_opportunity.cpp 64 remove_unused_instruction_reduction_opportunity_finder.cpp 65 remove_unused_struct_member_reduction_opportunity_finder.cpp 66 structured_loop_to_selection_reduction_opportunity.cpp 67 structured_loop_to_selection_reduction_opportunity_finder.cpp 68 conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp 69 conditional_branch_to_simple_conditional_branch_reduction_opportunity.cpp 70 simple_conditional_branch_to_branch_opportunity_finder.cpp 71 simple_conditional_branch_to_branch_reduction_opportunity.cpp 72) 73 74if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) 75 # Enable parallel builds across four cores for this lib 76 add_definitions(/MP4) 77endif() 78 79spvtools_pch(SPIRV_TOOLS_REDUCE_SOURCES pch_source_reduce) 80 81add_library(SPIRV-Tools-reduce ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_REDUCE_SOURCES}) 82 83spvtools_default_compile_options(SPIRV-Tools-reduce) 84target_include_directories(SPIRV-Tools-reduce 85 PUBLIC 86 $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include> 87 $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}> 88 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> 89 PRIVATE ${spirv-tools_BINARY_DIR} 90) 91# The reducer reuses a lot of functionality from the SPIRV-Tools library. 92target_link_libraries(SPIRV-Tools-reduce 93 PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY} 94 PUBLIC SPIRV-Tools-opt) 95 96set_property(TARGET SPIRV-Tools-reduce PROPERTY FOLDER "SPIRV-Tools libraries") 97spvtools_check_symbol_exports(SPIRV-Tools-reduce) 98 99if(ENABLE_SPIRV_TOOLS_INSTALL) 100 install(TARGETS SPIRV-Tools-reduce EXPORT SPIRV-Tools-reduceTargets 101 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 102 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 103 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 104 export(EXPORT SPIRV-Tools-reduceTargets FILE SPIRV-Tools-reduceTarget.cmake) 105 106 spvtools_config_package_dir(SPIRV-Tools-reduce PACKAGE_DIR) 107 install(EXPORT SPIRV-Tools-reduceTargets FILE SPIRV-Tools-reduceTarget.cmake 108 DESTINATION ${PACKAGE_DIR}) 109 110 spvtools_generate_config_file(SPIRV-Tools-reduce) 111 install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-reduceConfig.cmake DESTINATION ${PACKAGE_DIR}) 112endif(ENABLE_SPIRV_TOOLS_INSTALL) 113