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