1# Copyright (c) 2022 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_DIFF_SOURCES 15 diff.h 16 lcs.h 17 18 diff.cpp 19) 20 21add_library(SPIRV-Tools-diff ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_DIFF_SOURCES}) 22 23spvtools_default_compile_options(SPIRV-Tools-diff) 24target_include_directories(SPIRV-Tools-diff 25 PUBLIC 26 $<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include> 27 $<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}> 28 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> 29 PRIVATE ${spirv-tools_BINARY_DIR} 30) 31# We need the assembling and disassembling functionalities in the main library. 32target_link_libraries(SPIRV-Tools-diff 33 PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}) 34# We need the internals of spirv-opt. 35target_link_libraries(SPIRV-Tools-diff 36 PUBLIC SPIRV-Tools-opt) 37 38set_property(TARGET SPIRV-Tools-diff PROPERTY FOLDER "SPIRV-Tools libraries") 39spvtools_check_symbol_exports(SPIRV-Tools-diff) 40 41if(ENABLE_SPIRV_TOOLS_INSTALL) 42 install(TARGETS SPIRV-Tools-diff EXPORT SPIRV-Tools-diffTargets) 43 export(EXPORT SPIRV-Tools-diffTargets FILE SPIRV-Tools-diffTargets.cmake) 44 45 spvtools_config_package_dir(SPIRV-Tools-diff PACKAGE_DIR) 46 install(EXPORT SPIRV-Tools-diffTargets FILE SPIRV-Tools-diffTargets.cmake 47 DESTINATION ${PACKAGE_DIR}) 48 49 spvtools_generate_config_file(SPIRV-Tools-diff) 50 install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-diffConfig.cmake DESTINATION ${PACKAGE_DIR}) 51endif(ENABLE_SPIRV_TOOLS_INSTALL) 52