CMakeLists.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. # Copyright (c) 2019 Google LLC
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. # See the License for the specific language governing permissions and
  12. # limitations under the License.
  13. if(SPIRV_BUILD_FUZZER)
  14. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/protobufs)
  15. set(PROTOBUF_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/protobufs/spvtoolsfuzz.proto)
  16. set(
  17. SPIRV_FUZZ_PROTOC_COMMAND
  18. "protobuf::protoc"
  19. CACHE
  20. STRING
  21. "The command to invoke the protobuf compiler (protoc). By default it is the protobufs::protoc CMake target. It should be overridden when cross-compiling, such as for Android.")
  22. add_custom_command(
  23. OUTPUT protobufs/spvtoolsfuzz.pb.cc protobufs/spvtoolsfuzz.pb.h
  24. COMMAND "${SPIRV_FUZZ_PROTOC_COMMAND}"
  25. -I=${CMAKE_CURRENT_SOURCE_DIR}/protobufs
  26. --cpp_out=protobufs
  27. ${PROTOBUF_SOURCE}
  28. DEPENDS ${PROTOBUF_SOURCE}
  29. COMMENT "Generate protobuf sources from proto definition file."
  30. )
  31. set(SPIRV_TOOLS_FUZZ_SOURCES
  32. added_function_reducer.h
  33. available_instructions.h
  34. call_graph.h
  35. comparator_deep_blocks_first.h
  36. counter_overflow_id_source.h
  37. data_descriptor.h
  38. equivalence_relation.h
  39. fact_manager/constant_uniform_facts.h
  40. fact_manager/data_synonym_and_id_equation_facts.h
  41. fact_manager/dead_block_facts.h
  42. fact_manager/fact_manager.h
  43. fact_manager/irrelevant_value_facts.h
  44. fact_manager/livesafe_function_facts.h
  45. force_render_red.h
  46. fuzzer.h
  47. fuzzer_context.h
  48. fuzzer_pass.h
  49. fuzzer_pass_add_access_chains.h
  50. fuzzer_pass_add_bit_instruction_synonyms.h
  51. fuzzer_pass_add_composite_extract.h
  52. fuzzer_pass_add_composite_inserts.h
  53. fuzzer_pass_add_composite_types.h
  54. fuzzer_pass_add_copy_memory.h
  55. fuzzer_pass_add_dead_blocks.h
  56. fuzzer_pass_add_dead_breaks.h
  57. fuzzer_pass_add_dead_continues.h
  58. fuzzer_pass_add_equation_instructions.h
  59. fuzzer_pass_add_function_calls.h
  60. fuzzer_pass_add_global_variables.h
  61. fuzzer_pass_add_image_sample_unused_components.h
  62. fuzzer_pass_add_loads.h
  63. fuzzer_pass_add_local_variables.h
  64. fuzzer_pass_add_loop_preheaders.h
  65. fuzzer_pass_add_loops_to_create_int_constant_synonyms.h
  66. fuzzer_pass_add_no_contraction_decorations.h
  67. fuzzer_pass_add_opphi_synonyms.h
  68. fuzzer_pass_add_parameters.h
  69. fuzzer_pass_add_relaxed_decorations.h
  70. fuzzer_pass_add_stores.h
  71. fuzzer_pass_add_synonyms.h
  72. fuzzer_pass_add_vector_shuffle_instructions.h
  73. fuzzer_pass_adjust_branch_weights.h
  74. fuzzer_pass_adjust_function_controls.h
  75. fuzzer_pass_adjust_loop_controls.h
  76. fuzzer_pass_adjust_memory_operands_masks.h
  77. fuzzer_pass_adjust_selection_controls.h
  78. fuzzer_pass_apply_id_synonyms.h
  79. fuzzer_pass_construct_composites.h
  80. fuzzer_pass_copy_objects.h
  81. fuzzer_pass_donate_modules.h
  82. fuzzer_pass_duplicate_regions_with_selections.h
  83. fuzzer_pass_expand_vector_reductions.h
  84. fuzzer_pass_flatten_conditional_branches.h
  85. fuzzer_pass_inline_functions.h
  86. fuzzer_pass_invert_comparison_operators.h
  87. fuzzer_pass_interchange_signedness_of_integer_operands.h
  88. fuzzer_pass_interchange_zero_like_constants.h
  89. fuzzer_pass_make_vector_operations_dynamic.h
  90. fuzzer_pass_merge_blocks.h
  91. fuzzer_pass_merge_function_returns.h
  92. fuzzer_pass_mutate_pointers.h
  93. fuzzer_pass_obfuscate_constants.h
  94. fuzzer_pass_outline_functions.h
  95. fuzzer_pass_permute_blocks.h
  96. fuzzer_pass_permute_function_parameters.h
  97. fuzzer_pass_permute_function_variables.h
  98. fuzzer_pass_permute_instructions.h
  99. fuzzer_pass_permute_phi_operands.h
  100. fuzzer_pass_propagate_instructions_down.h
  101. fuzzer_pass_propagate_instructions_up.h
  102. fuzzer_pass_push_ids_through_variables.h
  103. fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.h
  104. fuzzer_pass_replace_branches_from_dead_blocks_with_exits.h
  105. fuzzer_pass_replace_copy_memories_with_loads_stores.h
  106. fuzzer_pass_replace_copy_objects_with_stores_loads.h
  107. fuzzer_pass_replace_irrelevant_ids.h
  108. fuzzer_pass_replace_linear_algebra_instructions.h
  109. fuzzer_pass_replace_loads_stores_with_copy_memories.h
  110. fuzzer_pass_replace_opphi_ids_from_dead_predecessors.h
  111. fuzzer_pass_replace_opselects_with_conditional_branches.h
  112. fuzzer_pass_replace_parameter_with_global.h
  113. fuzzer_pass_replace_params_with_struct.h
  114. fuzzer_pass_split_blocks.h
  115. fuzzer_pass_swap_commutable_operands.h
  116. fuzzer_pass_swap_conditional_branch_operands.h
  117. fuzzer_pass_swap_functions.h
  118. fuzzer_pass_toggle_access_chain_instruction.h
  119. fuzzer_pass_wrap_regions_in_selections.h
  120. fuzzer_pass_wrap_vector_synonym.h
  121. fuzzer_util.h
  122. id_use_descriptor.h
  123. instruction_descriptor.h
  124. instruction_message.h
  125. overflow_id_source.h
  126. pass_management/repeated_pass_instances.h
  127. pass_management/repeated_pass_manager.h
  128. pass_management/repeated_pass_manager_looped_with_recommendations.h
  129. pass_management/repeated_pass_manager_random_with_recommendations.h
  130. pass_management/repeated_pass_manager_simple.h
  131. pass_management/repeated_pass_recommender.h
  132. pass_management/repeated_pass_recommender_standard.h
  133. protobufs/spirvfuzz_protobufs.h
  134. pseudo_random_generator.h
  135. random_generator.h
  136. replayer.h
  137. shrinker.h
  138. transformation.h
  139. transformation_access_chain.h
  140. transformation_add_bit_instruction_synonym.h
  141. transformation_add_constant_boolean.h
  142. transformation_add_constant_composite.h
  143. transformation_add_constant_null.h
  144. transformation_add_constant_scalar.h
  145. transformation_add_copy_memory.h
  146. transformation_add_dead_block.h
  147. transformation_add_dead_break.h
  148. transformation_add_dead_continue.h
  149. transformation_add_early_terminator_wrapper.h
  150. transformation_add_function.h
  151. transformation_add_global_undef.h
  152. transformation_add_global_variable.h
  153. transformation_add_image_sample_unused_components.h
  154. transformation_add_local_variable.h
  155. transformation_add_loop_preheader.h
  156. transformation_add_loop_to_create_int_constant_synonym.h
  157. transformation_add_no_contraction_decoration.h
  158. transformation_add_opphi_synonym.h
  159. transformation_add_parameter.h
  160. transformation_add_relaxed_decoration.h
  161. transformation_add_spec_constant_op.h
  162. transformation_add_synonym.h
  163. transformation_add_type_array.h
  164. transformation_add_type_boolean.h
  165. transformation_add_type_float.h
  166. transformation_add_type_function.h
  167. transformation_add_type_int.h
  168. transformation_add_type_matrix.h
  169. transformation_add_type_pointer.h
  170. transformation_add_type_struct.h
  171. transformation_add_type_vector.h
  172. transformation_adjust_branch_weights.h
  173. transformation_composite_construct.h
  174. transformation_composite_extract.h
  175. transformation_composite_insert.h
  176. transformation_compute_data_synonym_fact_closure.h
  177. transformation_context.h
  178. transformation_duplicate_region_with_selection.h
  179. transformation_equation_instruction.h
  180. transformation_expand_vector_reduction.h
  181. transformation_flatten_conditional_branch.h
  182. transformation_function_call.h
  183. transformation_inline_function.h
  184. transformation_invert_comparison_operator.h
  185. transformation_load.h
  186. transformation_make_vector_operation_dynamic.h
  187. transformation_merge_blocks.h
  188. transformation_merge_function_returns.h
  189. transformation_move_block_down.h
  190. transformation_move_instruction_down.h
  191. transformation_mutate_pointer.h
  192. transformation_outline_function.h
  193. transformation_permute_function_parameters.h
  194. transformation_permute_phi_operands.h
  195. transformation_propagate_instruction_down.h
  196. transformation_propagate_instruction_up.h
  197. transformation_push_id_through_variable.h
  198. transformation_record_synonymous_constants.h
  199. transformation_replace_add_sub_mul_with_carrying_extended.h
  200. transformation_replace_boolean_constant_with_constant_binary.h
  201. transformation_replace_branch_from_dead_block_with_exit.h
  202. transformation_replace_constant_with_uniform.h
  203. transformation_replace_copy_memory_with_load_store.h
  204. transformation_replace_copy_object_with_store_load.h
  205. transformation_replace_id_with_synonym.h
  206. transformation_replace_irrelevant_id.h
  207. transformation_replace_linear_algebra_instruction.h
  208. transformation_replace_load_store_with_copy_memory.h
  209. transformation_replace_opphi_id_from_dead_predecessor.h
  210. transformation_replace_opselect_with_conditional_branch.h
  211. transformation_replace_parameter_with_global.h
  212. transformation_replace_params_with_struct.h
  213. transformation_set_function_control.h
  214. transformation_set_loop_control.h
  215. transformation_set_memory_operands_mask.h
  216. transformation_set_selection_control.h
  217. transformation_split_block.h
  218. transformation_store.h
  219. transformation_swap_commutable_operands.h
  220. transformation_swap_conditional_branch_operands.h
  221. transformation_swap_function_variables.h
  222. transformation_swap_two_functions.h
  223. transformation_toggle_access_chain_instruction.h
  224. transformation_vector_shuffle.h
  225. transformation_wrap_early_terminator_in_function.h
  226. transformation_wrap_region_in_selection.h
  227. transformation_wrap_vector_synonym.h
  228. uniform_buffer_element_descriptor.h
  229. ${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.h
  230. added_function_reducer.cpp
  231. available_instructions.cpp
  232. call_graph.cpp
  233. counter_overflow_id_source.cpp
  234. data_descriptor.cpp
  235. fact_manager/constant_uniform_facts.cpp
  236. fact_manager/data_synonym_and_id_equation_facts.cpp
  237. fact_manager/dead_block_facts.cpp
  238. fact_manager/fact_manager.cpp
  239. fact_manager/irrelevant_value_facts.cpp
  240. fact_manager/livesafe_function_facts.cpp
  241. force_render_red.cpp
  242. fuzzer.cpp
  243. fuzzer_context.cpp
  244. fuzzer_pass.cpp
  245. fuzzer_pass_add_access_chains.cpp
  246. fuzzer_pass_add_bit_instruction_synonyms.cpp
  247. fuzzer_pass_add_composite_extract.cpp
  248. fuzzer_pass_add_composite_inserts.cpp
  249. fuzzer_pass_add_composite_types.cpp
  250. fuzzer_pass_add_copy_memory.cpp
  251. fuzzer_pass_add_dead_blocks.cpp
  252. fuzzer_pass_add_dead_breaks.cpp
  253. fuzzer_pass_add_dead_continues.cpp
  254. fuzzer_pass_add_equation_instructions.cpp
  255. fuzzer_pass_add_function_calls.cpp
  256. fuzzer_pass_add_global_variables.cpp
  257. fuzzer_pass_add_image_sample_unused_components.cpp
  258. fuzzer_pass_add_loads.cpp
  259. fuzzer_pass_add_local_variables.cpp
  260. fuzzer_pass_add_loop_preheaders.cpp
  261. fuzzer_pass_add_loops_to_create_int_constant_synonyms.cpp
  262. fuzzer_pass_add_no_contraction_decorations.cpp
  263. fuzzer_pass_add_opphi_synonyms.cpp
  264. fuzzer_pass_add_parameters.cpp
  265. fuzzer_pass_add_relaxed_decorations.cpp
  266. fuzzer_pass_add_stores.cpp
  267. fuzzer_pass_add_synonyms.cpp
  268. fuzzer_pass_add_vector_shuffle_instructions.cpp
  269. fuzzer_pass_adjust_branch_weights.cpp
  270. fuzzer_pass_adjust_function_controls.cpp
  271. fuzzer_pass_adjust_loop_controls.cpp
  272. fuzzer_pass_adjust_memory_operands_masks.cpp
  273. fuzzer_pass_adjust_selection_controls.cpp
  274. fuzzer_pass_apply_id_synonyms.cpp
  275. fuzzer_pass_construct_composites.cpp
  276. fuzzer_pass_copy_objects.cpp
  277. fuzzer_pass_donate_modules.cpp
  278. fuzzer_pass_duplicate_regions_with_selections.cpp
  279. fuzzer_pass_expand_vector_reductions.cpp
  280. fuzzer_pass_flatten_conditional_branches.cpp
  281. fuzzer_pass_inline_functions.cpp
  282. fuzzer_pass_invert_comparison_operators.cpp
  283. fuzzer_pass_interchange_signedness_of_integer_operands.cpp
  284. fuzzer_pass_interchange_zero_like_constants.cpp
  285. fuzzer_pass_make_vector_operations_dynamic.cpp
  286. fuzzer_pass_merge_blocks.cpp
  287. fuzzer_pass_merge_function_returns.cpp
  288. fuzzer_pass_mutate_pointers.cpp
  289. fuzzer_pass_obfuscate_constants.cpp
  290. fuzzer_pass_outline_functions.cpp
  291. fuzzer_pass_permute_blocks.cpp
  292. fuzzer_pass_permute_function_parameters.cpp
  293. fuzzer_pass_permute_function_variables.cpp
  294. fuzzer_pass_permute_instructions.cpp
  295. fuzzer_pass_permute_phi_operands.cpp
  296. fuzzer_pass_propagate_instructions_down.cpp
  297. fuzzer_pass_propagate_instructions_up.cpp
  298. fuzzer_pass_push_ids_through_variables.cpp
  299. fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.cpp
  300. fuzzer_pass_replace_branches_from_dead_blocks_with_exits.cpp
  301. fuzzer_pass_replace_copy_memories_with_loads_stores.cpp
  302. fuzzer_pass_replace_copy_objects_with_stores_loads.cpp
  303. fuzzer_pass_replace_irrelevant_ids.cpp
  304. fuzzer_pass_replace_linear_algebra_instructions.cpp
  305. fuzzer_pass_replace_loads_stores_with_copy_memories.cpp
  306. fuzzer_pass_replace_opphi_ids_from_dead_predecessors.cpp
  307. fuzzer_pass_replace_opselects_with_conditional_branches.cpp
  308. fuzzer_pass_replace_parameter_with_global.cpp
  309. fuzzer_pass_replace_params_with_struct.cpp
  310. fuzzer_pass_split_blocks.cpp
  311. fuzzer_pass_swap_commutable_operands.cpp
  312. fuzzer_pass_swap_conditional_branch_operands.cpp
  313. fuzzer_pass_swap_functions.cpp
  314. fuzzer_pass_toggle_access_chain_instruction.cpp
  315. fuzzer_pass_wrap_regions_in_selections.cpp
  316. fuzzer_pass_wrap_vector_synonym.cpp
  317. fuzzer_util.cpp
  318. id_use_descriptor.cpp
  319. instruction_descriptor.cpp
  320. instruction_message.cpp
  321. overflow_id_source.cpp
  322. pass_management/repeated_pass_manager.cpp
  323. pass_management/repeated_pass_manager_looped_with_recommendations.cpp
  324. pass_management/repeated_pass_manager_random_with_recommendations.cpp
  325. pass_management/repeated_pass_manager_simple.cpp
  326. pass_management/repeated_pass_recommender.cpp
  327. pass_management/repeated_pass_recommender_standard.cpp
  328. pseudo_random_generator.cpp
  329. random_generator.cpp
  330. replayer.cpp
  331. shrinker.cpp
  332. transformation.cpp
  333. transformation_access_chain.cpp
  334. transformation_add_bit_instruction_synonym.cpp
  335. transformation_add_constant_boolean.cpp
  336. transformation_add_constant_composite.cpp
  337. transformation_add_constant_null.cpp
  338. transformation_add_constant_scalar.cpp
  339. transformation_add_copy_memory.cpp
  340. transformation_add_dead_block.cpp
  341. transformation_add_dead_break.cpp
  342. transformation_add_dead_continue.cpp
  343. transformation_add_early_terminator_wrapper.cpp
  344. transformation_add_function.cpp
  345. transformation_add_global_undef.cpp
  346. transformation_add_global_variable.cpp
  347. transformation_add_image_sample_unused_components.cpp
  348. transformation_add_local_variable.cpp
  349. transformation_add_loop_preheader.cpp
  350. transformation_add_loop_to_create_int_constant_synonym.cpp
  351. transformation_add_no_contraction_decoration.cpp
  352. transformation_add_opphi_synonym.cpp
  353. transformation_add_parameter.cpp
  354. transformation_add_relaxed_decoration.cpp
  355. transformation_add_spec_constant_op.cpp
  356. transformation_add_synonym.cpp
  357. transformation_add_type_array.cpp
  358. transformation_add_type_boolean.cpp
  359. transformation_add_type_float.cpp
  360. transformation_add_type_function.cpp
  361. transformation_add_type_int.cpp
  362. transformation_add_type_matrix.cpp
  363. transformation_add_type_pointer.cpp
  364. transformation_add_type_struct.cpp
  365. transformation_add_type_vector.cpp
  366. transformation_adjust_branch_weights.cpp
  367. transformation_composite_construct.cpp
  368. transformation_composite_extract.cpp
  369. transformation_composite_insert.cpp
  370. transformation_compute_data_synonym_fact_closure.cpp
  371. transformation_context.cpp
  372. transformation_duplicate_region_with_selection.cpp
  373. transformation_equation_instruction.cpp
  374. transformation_expand_vector_reduction.cpp
  375. transformation_flatten_conditional_branch.cpp
  376. transformation_function_call.cpp
  377. transformation_inline_function.cpp
  378. transformation_invert_comparison_operator.cpp
  379. transformation_load.cpp
  380. transformation_make_vector_operation_dynamic.cpp
  381. transformation_merge_blocks.cpp
  382. transformation_merge_function_returns.cpp
  383. transformation_move_block_down.cpp
  384. transformation_move_instruction_down.cpp
  385. transformation_mutate_pointer.cpp
  386. transformation_outline_function.cpp
  387. transformation_permute_function_parameters.cpp
  388. transformation_permute_phi_operands.cpp
  389. transformation_propagate_instruction_down.cpp
  390. transformation_propagate_instruction_up.cpp
  391. transformation_push_id_through_variable.cpp
  392. transformation_record_synonymous_constants.cpp
  393. transformation_replace_add_sub_mul_with_carrying_extended.cpp
  394. transformation_replace_boolean_constant_with_constant_binary.cpp
  395. transformation_replace_branch_from_dead_block_with_exit.cpp
  396. transformation_replace_constant_with_uniform.cpp
  397. transformation_replace_copy_memory_with_load_store.cpp
  398. transformation_replace_copy_object_with_store_load.cpp
  399. transformation_replace_id_with_synonym.cpp
  400. transformation_replace_irrelevant_id.cpp
  401. transformation_replace_linear_algebra_instruction.cpp
  402. transformation_replace_load_store_with_copy_memory.cpp
  403. transformation_replace_opphi_id_from_dead_predecessor.cpp
  404. transformation_replace_opselect_with_conditional_branch.cpp
  405. transformation_replace_parameter_with_global.cpp
  406. transformation_replace_params_with_struct.cpp
  407. transformation_set_function_control.cpp
  408. transformation_set_loop_control.cpp
  409. transformation_set_memory_operands_mask.cpp
  410. transformation_set_selection_control.cpp
  411. transformation_split_block.cpp
  412. transformation_store.cpp
  413. transformation_swap_commutable_operands.cpp
  414. transformation_swap_conditional_branch_operands.cpp
  415. transformation_swap_function_variables.cpp
  416. transformation_swap_two_functions.cpp
  417. transformation_toggle_access_chain_instruction.cpp
  418. transformation_vector_shuffle.cpp
  419. transformation_wrap_early_terminator_in_function.cpp
  420. transformation_wrap_region_in_selection.cpp
  421. transformation_wrap_vector_synonym.cpp
  422. uniform_buffer_element_descriptor.cpp
  423. ${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.cc
  424. )
  425. if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
  426. # Enable parallel builds across four cores for this lib
  427. add_definitions(/MP4)
  428. endif()
  429. spvtools_pch(SPIRV_TOOLS_FUZZ_SOURCES pch_source_fuzz)
  430. add_library(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SOURCES})
  431. spvtools_default_compile_options(SPIRV-Tools-fuzz)
  432. # Compilation of the auto-generated protobuf source file will yield warnings,
  433. # which we have no control over and thus wish to ignore.
  434. if(${COMPILER_IS_LIKE_GNU})
  435. set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.cc PROPERTIES COMPILE_FLAGS -w)
  436. endif()
  437. if(MSVC)
  438. set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.cc PROPERTIES COMPILE_FLAGS /w)
  439. endif()
  440. target_include_directories(SPIRV-Tools-fuzz
  441. PUBLIC
  442. $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>
  443. $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}>
  444. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  445. PRIVATE ${spirv-tools_BINARY_DIR}
  446. PRIVATE ${CMAKE_BINARY_DIR})
  447. # The fuzzer reuses a lot of functionality from the SPIRV-Tools library.
  448. target_link_libraries(SPIRV-Tools-fuzz
  449. PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}
  450. PUBLIC SPIRV-Tools-opt
  451. PUBLIC SPIRV-Tools-reduce
  452. PUBLIC protobuf::libprotobuf)
  453. set_property(TARGET SPIRV-Tools-fuzz PROPERTY FOLDER "SPIRV-Tools libraries")
  454. spvtools_check_symbol_exports(SPIRV-Tools-fuzz)
  455. if(ENABLE_SPIRV_TOOLS_INSTALL)
  456. install(TARGETS SPIRV-Tools-fuzz EXPORT SPIRV-Tools-fuzzTargets)
  457. export(EXPORT SPIRV-Tools-fuzzTargets FILE SPIRV-Tools-fuzzTarget.cmake)
  458. spvtools_config_package_dir(SPIRV-Tools-fuzz PACKAGE_DIR)
  459. install(EXPORT SPIRV-Tools-fuzzTargets FILE SPIRV-Tools-fuzzTarget.cmake
  460. DESTINATION ${PACKAGE_DIR})
  461. spvtools_generate_config_file(SPIRV-Tools-fuzz)
  462. install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-fuzzConfig.cmake DESTINATION ${PACKAGE_DIR})
  463. endif(ENABLE_SPIRV_TOOLS_INSTALL)
  464. endif(SPIRV_BUILD_FUZZER)