1# Copyright (c) 2016 Google Inc. 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_OPT_SOURCES 15 aggressive_dead_code_elim_pass.h 16 amd_ext_to_khr.h 17 basic_block.h 18 block_merge_pass.h 19 block_merge_util.h 20 build_module.h 21 ccp_pass.h 22 cfg_cleanup_pass.h 23 cfg.h 24 code_sink.h 25 combine_access_chains.h 26 compact_ids_pass.h 27 composite.h 28 const_folding_rules.h 29 constants.h 30 convert_to_half_pass.h 31 copy_prop_arrays.h 32 dead_branch_elim_pass.h 33 dead_insert_elim_pass.h 34 dead_variable_elimination.h 35 decoration_manager.h 36 debug_info_manager.h 37 def_use_manager.h 38 desc_sroa.h 39 dominator_analysis.h 40 dominator_tree.h 41 eliminate_dead_constant_pass.h 42 eliminate_dead_functions_pass.h 43 eliminate_dead_functions_util.h 44 eliminate_dead_members_pass.h 45 empty_pass.h 46 feature_manager.h 47 fix_storage_class.h 48 flatten_decoration_pass.h 49 fold.h 50 folding_rules.h 51 fold_spec_constant_op_and_composite_pass.h 52 freeze_spec_constant_value_pass.h 53 function.h 54 graphics_robust_access_pass.h 55 if_conversion.h 56 inline_exhaustive_pass.h 57 inline_opaque_pass.h 58 inline_pass.h 59 inst_bindless_check_pass.h 60 inst_buff_addr_check_pass.h 61 inst_debug_printf_pass.h 62 instruction.h 63 instruction_list.h 64 instrument_pass.h 65 interp_fixup_pass.h 66 ir_builder.h 67 ir_context.h 68 ir_loader.h 69 licm_pass.h 70 local_access_chain_convert_pass.h 71 local_redundancy_elimination.h 72 local_single_block_elim_pass.h 73 local_single_store_elim_pass.h 74 log.h 75 loop_dependence.h 76 loop_descriptor.h 77 loop_fission.h 78 loop_fusion.h 79 loop_fusion_pass.h 80 loop_peeling.h 81 loop_unroller.h 82 loop_utils.h 83 loop_unswitch_pass.h 84 mem_pass.h 85 merge_return_pass.h 86 module.h 87 null_pass.h 88 passes.h 89 pass.h 90 pass_manager.h 91 private_to_local_pass.h 92 propagator.h 93 reduce_load_size.h 94 redundancy_elimination.h 95 reflect.h 96 register_pressure.h 97 relax_float_ops_pass.h 98 remove_duplicates_pass.h 99 replace_invalid_opc.h 100 scalar_analysis.h 101 scalar_analysis_nodes.h 102 scalar_replacement_pass.h 103 set_spec_constant_default_value_pass.h 104 simplification_pass.h 105 ssa_rewrite_pass.h 106 strength_reduction_pass.h 107 strip_debug_info_pass.h 108 strip_reflect_info_pass.h 109 struct_cfg_analysis.h 110 tree_iterator.h 111 type_manager.h 112 types.h 113 unify_const_pass.h 114 upgrade_memory_model.h 115 value_number_table.h 116 vector_dce.h 117 workaround1209.h 118 wrap_opkill.h 119 120 aggressive_dead_code_elim_pass.cpp 121 amd_ext_to_khr.cpp 122 basic_block.cpp 123 block_merge_pass.cpp 124 block_merge_util.cpp 125 build_module.cpp 126 ccp_pass.cpp 127 cfg_cleanup_pass.cpp 128 cfg.cpp 129 code_sink.cpp 130 combine_access_chains.cpp 131 compact_ids_pass.cpp 132 composite.cpp 133 const_folding_rules.cpp 134 constants.cpp 135 convert_to_half_pass.cpp 136 copy_prop_arrays.cpp 137 dead_branch_elim_pass.cpp 138 dead_insert_elim_pass.cpp 139 dead_variable_elimination.cpp 140 decoration_manager.cpp 141 debug_info_manager.cpp 142 def_use_manager.cpp 143 desc_sroa.cpp 144 dominator_analysis.cpp 145 dominator_tree.cpp 146 eliminate_dead_constant_pass.cpp 147 eliminate_dead_functions_pass.cpp 148 eliminate_dead_functions_util.cpp 149 eliminate_dead_members_pass.cpp 150 feature_manager.cpp 151 fix_storage_class.cpp 152 flatten_decoration_pass.cpp 153 fold.cpp 154 folding_rules.cpp 155 fold_spec_constant_op_and_composite_pass.cpp 156 freeze_spec_constant_value_pass.cpp 157 function.cpp 158 graphics_robust_access_pass.cpp 159 if_conversion.cpp 160 inline_exhaustive_pass.cpp 161 inline_opaque_pass.cpp 162 inline_pass.cpp 163 inst_bindless_check_pass.cpp 164 inst_buff_addr_check_pass.cpp 165 inst_debug_printf_pass.cpp 166 instruction.cpp 167 instruction_list.cpp 168 instrument_pass.cpp 169 interp_fixup_pass.cpp 170 ir_context.cpp 171 ir_loader.cpp 172 licm_pass.cpp 173 local_access_chain_convert_pass.cpp 174 local_redundancy_elimination.cpp 175 local_single_block_elim_pass.cpp 176 local_single_store_elim_pass.cpp 177 loop_dependence.cpp 178 loop_dependence_helpers.cpp 179 loop_descriptor.cpp 180 loop_fission.cpp 181 loop_fusion.cpp 182 loop_fusion_pass.cpp 183 loop_peeling.cpp 184 loop_utils.cpp 185 loop_unroller.cpp 186 loop_unswitch_pass.cpp 187 mem_pass.cpp 188 merge_return_pass.cpp 189 module.cpp 190 optimizer.cpp 191 pass.cpp 192 pass_manager.cpp 193 private_to_local_pass.cpp 194 propagator.cpp 195 reduce_load_size.cpp 196 redundancy_elimination.cpp 197 register_pressure.cpp 198 relax_float_ops_pass.cpp 199 remove_duplicates_pass.cpp 200 replace_invalid_opc.cpp 201 scalar_analysis.cpp 202 scalar_analysis_simplification.cpp 203 scalar_replacement_pass.cpp 204 set_spec_constant_default_value_pass.cpp 205 simplification_pass.cpp 206 ssa_rewrite_pass.cpp 207 strength_reduction_pass.cpp 208 strip_debug_info_pass.cpp 209 strip_reflect_info_pass.cpp 210 struct_cfg_analysis.cpp 211 type_manager.cpp 212 types.cpp 213 unify_const_pass.cpp 214 upgrade_memory_model.cpp 215 value_number_table.cpp 216 vector_dce.cpp 217 workaround1209.cpp 218 wrap_opkill.cpp 219) 220 221if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))) 222 # Enable parallel builds across four cores for this lib 223 add_definitions(/MP4) 224endif() 225 226spvtools_pch(SPIRV_TOOLS_OPT_SOURCES pch_source_opt) 227 228add_library(SPIRV-Tools-opt ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_OPT_SOURCES}) 229 230spvtools_default_compile_options(SPIRV-Tools-opt) 231target_include_directories(SPIRV-Tools-opt 232 PUBLIC 233 $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include> 234 $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}> 235 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> 236 PRIVATE ${spirv-tools_BINARY_DIR} 237) 238# We need the assembling and disassembling functionalities in the main library. 239target_link_libraries(SPIRV-Tools-opt 240 PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}) 241 242set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries") 243spvtools_check_symbol_exports(SPIRV-Tools-opt) 244 245if(ENABLE_SPIRV_TOOLS_INSTALL) 246 install(TARGETS SPIRV-Tools-opt EXPORT SPIRV-Tools-optTargets 247 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 248 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 249 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 250 export(EXPORT SPIRV-Tools-optTargets FILE SPIRV-Tools-optTargets.cmake) 251 252 spvtools_config_package_dir(SPIRV-Tools-opt PACKAGE_DIR) 253 install(EXPORT SPIRV-Tools-optTargets FILE SPIRV-Tools-optTargets.cmake 254 DESTINATION ${PACKAGE_DIR}) 255 256 spvtools_generate_config_file(SPIRV-Tools-opt) 257 install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-optConfig.cmake DESTINATION ${PACKAGE_DIR}) 258endif(ENABLE_SPIRV_TOOLS_INSTALL) 259