CMakeLists.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Copyright (c) 2021 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_LINT_SOURCES
  14. divergence_analysis.h
  15. lints.h
  16. linter.cpp
  17. divergence_analysis.cpp
  18. lint_divergent_derivatives.cpp
  19. )
  20. if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
  21. # Enable parallel builds across four cores for this lib.
  22. add_definitions(/MP4)
  23. endif()
  24. add_library(SPIRV-Tools-lint ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_LINT_SOURCES})
  25. spvtools_default_compile_options(SPIRV-Tools-lint)
  26. target_include_directories(SPIRV-Tools-lint
  27. PUBLIC
  28. $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>
  29. $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}>
  30. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  31. PRIVATE ${spirv-tools_BINARY_DIR}
  32. )
  33. # We need the assembling and disassembling functionalities in the main library.
  34. target_link_libraries(SPIRV-Tools-lint
  35. PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY})
  36. # We need the internals of spirv-opt.
  37. target_link_libraries(SPIRV-Tools-lint
  38. PUBLIC SPIRV-Tools-opt)
  39. set_property(TARGET SPIRV-Tools-lint PROPERTY FOLDER "SPIRV-Tools libraries")
  40. spvtools_check_symbol_exports(SPIRV-Tools-lint)
  41. if(ENABLE_SPIRV_TOOLS_INSTALL)
  42. install(TARGETS SPIRV-Tools-lint EXPORT SPIRV-Tools-lintTargets)
  43. export(EXPORT SPIRV-Tools-lintTargets FILE SPIRV-Tools-lintTargets.cmake)
  44. spvtools_config_package_dir(SPIRV-Tools-lint PACKAGE_DIR)
  45. install(EXPORT SPIRV-Tools-lintTargets FILE SPIRV-Tools-lintTargets.cmake
  46. DESTINATION ${PACKAGE_DIR})
  47. spvtools_generate_config_file(SPIRV-Tools-lint)
  48. install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-lintConfig.cmake DESTINATION ${PACKAGE_DIR})
  49. endif(ENABLE_SPIRV_TOOLS_INSTALL)