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