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