xref: /aosp_15_r20/external/libgav1/cmake/libgav1_install.cmake (revision 095378508e87ed692bf8dfeb34008b65b3735891)
1*09537850SAkhilesh Sanikop# Copyright 2019 The libgav1 Authors
2*09537850SAkhilesh Sanikop#
3*09537850SAkhilesh Sanikop# Licensed under the Apache License, Version 2.0 (the "License");
4*09537850SAkhilesh Sanikop# you may not use this file except in compliance with the License.
5*09537850SAkhilesh Sanikop# You may obtain a copy of the License at
6*09537850SAkhilesh Sanikop#
7*09537850SAkhilesh Sanikop#      http://www.apache.org/licenses/LICENSE-2.0
8*09537850SAkhilesh Sanikop#
9*09537850SAkhilesh Sanikop# Unless required by applicable law or agreed to in writing, software
10*09537850SAkhilesh Sanikop# distributed under the License is distributed on an "AS IS" BASIS,
11*09537850SAkhilesh Sanikop# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*09537850SAkhilesh Sanikop# See the License for the specific language governing permissions and
13*09537850SAkhilesh Sanikop# limitations under the License.
14*09537850SAkhilesh Sanikop
15*09537850SAkhilesh Sanikopif(LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_)
16*09537850SAkhilesh Sanikop  return()
17*09537850SAkhilesh Sanikopendif() # LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_
18*09537850SAkhilesh Sanikopset(LIBGAV1_CMAKE_LIBGAV1_INSTALL_CMAKE_ 1)
19*09537850SAkhilesh Sanikop
20*09537850SAkhilesh Sanikop# Sets up the Libgav1 install targets. Must be called after the static library
21*09537850SAkhilesh Sanikop# target is created.
22*09537850SAkhilesh Sanikopmacro(libgav1_setup_install_target)
23*09537850SAkhilesh Sanikop  if(NOT (MSVC OR XCODE))
24*09537850SAkhilesh Sanikop    include(GNUInstallDirs)
25*09537850SAkhilesh Sanikop
26*09537850SAkhilesh Sanikop    # pkg-config: libgav1.pc
27*09537850SAkhilesh Sanikop    set(prefix "${CMAKE_INSTALL_PREFIX}")
28*09537850SAkhilesh Sanikop    set(exec_prefix "\${prefix}")
29*09537850SAkhilesh Sanikop    set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
30*09537850SAkhilesh Sanikop    set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
31*09537850SAkhilesh Sanikop    set(libgav1_lib_name "libgav1")
32*09537850SAkhilesh Sanikop
33*09537850SAkhilesh Sanikop    configure_file("${libgav1_root}/cmake/libgav1.pc.template"
34*09537850SAkhilesh Sanikop                   "${libgav1_build}/libgav1.pc" @ONLY NEWLINE_STYLE UNIX)
35*09537850SAkhilesh Sanikop    install(FILES "${libgav1_build}/libgav1.pc"
36*09537850SAkhilesh Sanikop            DESTINATION "${prefix}/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
37*09537850SAkhilesh Sanikop
38*09537850SAkhilesh Sanikop    # CMake config: libgav1-config.cmake
39*09537850SAkhilesh Sanikop    set(LIBGAV1_INCLUDE_DIRS "${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
40*09537850SAkhilesh Sanikop    configure_file("${libgav1_root}/cmake/libgav1-config.cmake.template"
41*09537850SAkhilesh Sanikop                   "${libgav1_build}/libgav1-config.cmake" @ONLY
42*09537850SAkhilesh Sanikop                   NEWLINE_STYLE UNIX)
43*09537850SAkhilesh Sanikop    install(
44*09537850SAkhilesh Sanikop      FILES "${libgav1_build}/libgav1-config.cmake"
45*09537850SAkhilesh Sanikop      DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/cmake")
46*09537850SAkhilesh Sanikop
47*09537850SAkhilesh Sanikop    install(
48*09537850SAkhilesh Sanikop      FILES ${libgav1_api_includes}
49*09537850SAkhilesh Sanikop      DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/gav1")
50*09537850SAkhilesh Sanikop
51*09537850SAkhilesh Sanikop    if(LIBGAV1_ENABLE_EXAMPLES)
52*09537850SAkhilesh Sanikop      install(TARGETS gav1_decode DESTINATION
53*09537850SAkhilesh Sanikop                      "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
54*09537850SAkhilesh Sanikop    endif()
55*09537850SAkhilesh Sanikop    install(TARGETS libgav1_static DESTINATION
56*09537850SAkhilesh Sanikop                    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
57*09537850SAkhilesh Sanikop    if(BUILD_SHARED_LIBS)
58*09537850SAkhilesh Sanikop      install(TARGETS libgav1_shared DESTINATION
59*09537850SAkhilesh Sanikop                      "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
60*09537850SAkhilesh Sanikop    endif()
61*09537850SAkhilesh Sanikop  endif()
62*09537850SAkhilesh Sanikopendmacro()
63