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