CMakeLists.txt 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright (c) 2018 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. set(SPIRV_TOOLS_REDUCE_SOURCES
  14. change_operand_reduction_opportunity.h
  15. change_operand_to_undef_reduction_opportunity.h
  16. conditional_branch_to_simple_conditional_branch_opportunity_finder.h
  17. conditional_branch_to_simple_conditional_branch_reduction_opportunity.h
  18. merge_blocks_reduction_opportunity.h
  19. merge_blocks_reduction_opportunity_finder.h
  20. operand_to_const_reduction_opportunity_finder.h
  21. operand_to_undef_reduction_opportunity_finder.h
  22. operand_to_dominating_id_reduction_opportunity_finder.h
  23. reducer.h
  24. reduction_opportunity.h
  25. reduction_opportunity_finder.h
  26. reduction_pass.h
  27. reduction_util.h
  28. remove_block_reduction_opportunity.h
  29. remove_block_reduction_opportunity_finder.h
  30. remove_function_reduction_opportunity.h
  31. remove_function_reduction_opportunity_finder.h
  32. remove_instruction_reduction_opportunity.h
  33. remove_selection_reduction_opportunity.h
  34. remove_selection_reduction_opportunity_finder.h
  35. remove_struct_member_reduction_opportunity.h
  36. remove_unused_instruction_reduction_opportunity_finder.h
  37. remove_unused_struct_member_reduction_opportunity_finder.h
  38. simple_conditional_branch_to_branch_opportunity_finder.h
  39. simple_conditional_branch_to_branch_reduction_opportunity.h
  40. structured_construct_to_block_reduction_opportunity.h
  41. structured_construct_to_block_reduction_opportunity_finder.h
  42. structured_loop_to_selection_reduction_opportunity.h
  43. structured_loop_to_selection_reduction_opportunity_finder.h
  44. change_operand_reduction_opportunity.cpp
  45. change_operand_to_undef_reduction_opportunity.cpp
  46. conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp
  47. conditional_branch_to_simple_conditional_branch_reduction_opportunity.cpp
  48. merge_blocks_reduction_opportunity.cpp
  49. merge_blocks_reduction_opportunity_finder.cpp
  50. operand_to_const_reduction_opportunity_finder.cpp
  51. operand_to_undef_reduction_opportunity_finder.cpp
  52. operand_to_dominating_id_reduction_opportunity_finder.cpp
  53. reducer.cpp
  54. reduction_opportunity.cpp
  55. reduction_opportunity_finder.cpp
  56. reduction_pass.cpp
  57. reduction_util.cpp
  58. remove_block_reduction_opportunity.cpp
  59. remove_block_reduction_opportunity_finder.cpp
  60. remove_function_reduction_opportunity.cpp
  61. remove_function_reduction_opportunity_finder.cpp
  62. remove_instruction_reduction_opportunity.cpp
  63. remove_selection_reduction_opportunity.cpp
  64. remove_selection_reduction_opportunity_finder.cpp
  65. remove_struct_member_reduction_opportunity.cpp
  66. remove_unused_instruction_reduction_opportunity_finder.cpp
  67. remove_unused_struct_member_reduction_opportunity_finder.cpp
  68. simple_conditional_branch_to_branch_opportunity_finder.cpp
  69. simple_conditional_branch_to_branch_reduction_opportunity.cpp
  70. structured_construct_to_block_reduction_opportunity.cpp
  71. structured_construct_to_block_reduction_opportunity_finder.cpp
  72. structured_loop_to_selection_reduction_opportunity.cpp
  73. structured_loop_to_selection_reduction_opportunity_finder.cpp
  74. )
  75. if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
  76. # Enable parallel builds across four cores for this lib
  77. add_definitions(/MP4)
  78. endif()
  79. spvtools_pch(SPIRV_TOOLS_REDUCE_SOURCES pch_source_reduce)
  80. add_library(SPIRV-Tools-reduce ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_REDUCE_SOURCES})
  81. spvtools_default_compile_options(SPIRV-Tools-reduce)
  82. target_include_directories(SPIRV-Tools-reduce
  83. PUBLIC
  84. $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>
  85. $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}>
  86. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  87. PRIVATE ${spirv-tools_BINARY_DIR}
  88. )
  89. # The reducer reuses a lot of functionality from the SPIRV-Tools library.
  90. target_link_libraries(SPIRV-Tools-reduce
  91. PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}
  92. PUBLIC SPIRV-Tools-opt)
  93. set_property(TARGET SPIRV-Tools-reduce PROPERTY FOLDER "SPIRV-Tools libraries")
  94. spvtools_check_symbol_exports(SPIRV-Tools-reduce)
  95. if(ENABLE_SPIRV_TOOLS_INSTALL)
  96. install(TARGETS SPIRV-Tools-reduce EXPORT SPIRV-Tools-reduceTargets)
  97. export(EXPORT SPIRV-Tools-reduceTargets FILE SPIRV-Tools-reduceTarget.cmake)
  98. spvtools_config_package_dir(SPIRV-Tools-reduce PACKAGE_DIR)
  99. install(EXPORT SPIRV-Tools-reduceTargets FILE SPIRV-Tools-reduceTarget.cmake
  100. DESTINATION ${PACKAGE_DIR})
  101. spvtools_generate_config_file(SPIRV-Tools-reduce)
  102. install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-reduceConfig.cmake DESTINATION ${PACKAGE_DIR})
  103. endif(ENABLE_SPIRV_TOOLS_INSTALL)