1# Copyright 2019 The libgav1 Authors 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. 14 15if(LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_) 16 return() 17endif() # LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_ 18set(LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_ 1) 19 20# Sets up the Libgav1 install targets. Must be called after the static library 21# target is created. 22macro(libgav1_setup_install_target) 23 if(NOT (MSVC OR XCODE)) 24 include(GNUInstallDirs) 25 26 # pkg-config: libgav1.pc 27 set(prefix "${CMAKE_INSTALL_PREFIX}") 28 set(exec_prefix "\${prefix}") 29 set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}") 30 set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") 31 set(libgav1_lib_name "libgav1") 32 33 configure_file("${libgav1_root}/cmake/libgav1.pc.template" 34 "${libgav1_build}/libgav1.pc" @ONLY NEWLINE_STYLE UNIX) 35 install(FILES "${libgav1_build}/libgav1.pc" 36 DESTINATION "${prefix}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") 37 38 # CMake config: libgav1-config.cmake 39 set(LIBGAV1_INCLUDE_DIRS "${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") 40 configure_file("${libgav1_root}/cmake/libgav1-config.cmake.template" 41 "${libgav1_build}/libgav1-config.cmake" @ONLY 42 NEWLINE_STYLE UNIX) 43 install( 44 FILES "${libgav1_build}/libgav1-config.cmake" 45 DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/cmake") 46 47 install( 48 FILES ${libgav1_api_includes} 49 DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/gav1") 50 51 if(LIBGAV1_ENABLE_EXAMPLES) 52 install(TARGETS gav1_decode DESTINATION 53 "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") 54 endif() 55 install(TARGETS libgav1_static DESTINATION 56 "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") 57 if(BUILD_SHARED_LIBS) 58 install(TARGETS libgav1_shared DESTINATION 59 "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") 60 endif() 61 endif() 62endmacro() 63