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