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