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