1*77c1e3ccSAndroid Build Coastguard Worker# 2*77c1e3ccSAndroid Build Coastguard Worker# Copyright (c) 2018, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker# 4*77c1e3ccSAndroid Build Coastguard Worker# This source code is subject to the terms of the BSD 2 Clause License and the 5*77c1e3ccSAndroid Build Coastguard Worker# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was 6*77c1e3ccSAndroid Build Coastguard Worker# not distributed with this source code in the LICENSE file, you can obtain it 7*77c1e3ccSAndroid Build Coastguard Worker# at www.aomedia.org/license/software. If the Alliance for Open Media Patent 8*77c1e3ccSAndroid Build Coastguard Worker# License 1.0 was not distributed with this source code in the PATENTS file, you 9*77c1e3ccSAndroid Build Coastguard Worker# can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker# 11*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aom.h" 12*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_codec.h" "${AOM_ROOT}/aom/aom_frame_buffer.h" 13*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_image.h" "${AOM_ROOT}/aom/aom_integer.h") 14*77c1e3ccSAndroid Build Coastguard Worker 15*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_DECODER) 16*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aom_decoder.h" 17*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aomdx.h") 18*77c1e3ccSAndroid Build Coastguard Workerendif() 19*77c1e3ccSAndroid Build Coastguard Worker 20*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_ENCODER) 21*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aomcx.h" 22*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_encoder.h" 23*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_external_partition.h") 24*77c1e3ccSAndroid Build Coastguard Workerendif() 25*77c1e3ccSAndroid Build Coastguard Worker 26*77c1e3ccSAndroid Build Coastguard Worker# Generate aom.pc and setup dependencies to ensure it is created when necessary. 27*77c1e3ccSAndroid Build Coastguard Worker# Note: aom.pc generation uses GNUInstallDirs: 28*77c1e3ccSAndroid Build Coastguard Worker# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html 29*77c1e3ccSAndroid Build Coastguard Workermacro(setup_aom_install_targets) 30*77c1e3ccSAndroid Build Coastguard Worker if(NOT XCODE) 31*77c1e3ccSAndroid Build Coastguard Worker include("GNUInstallDirs") 32*77c1e3ccSAndroid Build Coastguard Worker set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") 33*77c1e3ccSAndroid Build Coastguard Worker 34*77c1e3ccSAndroid Build Coastguard Worker # Create a library target for creating aom.pc. 35*77c1e3ccSAndroid Build Coastguard Worker create_no_op_source_file(aom_pc c AOM_PKG_CONFIG_SOURCES) 36*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_pc ${AOM_PKG_CONFIG_SOURCES}) 37*77c1e3ccSAndroid Build Coastguard Worker 38*77c1e3ccSAndroid Build Coastguard Worker # Setup a rule to generate aom.pc. 39*77c1e3ccSAndroid Build Coastguard Worker add_custom_command( 40*77c1e3ccSAndroid Build Coastguard Worker OUTPUT "${AOM_PKG_CONFIG_FILE}" 41*77c1e3ccSAndroid Build Coastguard Worker COMMAND ${CMAKE_COMMAND} ARGS 42*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 43*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT=${AOM_ROOT} 44*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} 45*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} 46*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} 47*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} 48*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME} 49*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_THREAD_LIBS_INIT=${CMAKE_THREAD_LIBS_INIT} 50*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_MULTITHREAD=${CONFIG_MULTITHREAD} 51*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_TUNE_VMAF=${CONFIG_TUNE_VMAF} 52*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_TUNE_BUTTERAUGLI=${CONFIG_TUNE_BUTTERAUGLI} 53*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_SALIENCY_MAP=${CONFIG_SALIENCY_MAP} 54*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_TFLITE=${CONFIG_TFLITE} 55*77c1e3ccSAndroid Build Coastguard Worker -P 56*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/pkg_config.cmake" 57*77c1e3ccSAndroid Build Coastguard Worker COMMENT "Writing aom.pc" 58*77c1e3ccSAndroid Build Coastguard Worker VERBATIM) 59*77c1e3ccSAndroid Build Coastguard Worker 60*77c1e3ccSAndroid Build Coastguard Worker # Explicitly add a dependency on the pkg-config file to ensure it's built. 61*77c1e3ccSAndroid Build Coastguard Worker get_property(aom_pc_sources TARGET aom_pc PROPERTY SOURCES) 62*77c1e3ccSAndroid Build Coastguard Worker set_source_files_properties(${aom_pc_sources} OBJECT_DEPENDS 63*77c1e3ccSAndroid Build Coastguard Worker "${AOM_PKG_CONFIG_FILE}") 64*77c1e3ccSAndroid Build Coastguard Worker 65*77c1e3ccSAndroid Build Coastguard Worker # Our pkg-config file carries version information: add a dependency on the 66*77c1e3ccSAndroid Build Coastguard Worker # version rule. 67*77c1e3ccSAndroid Build Coastguard Worker add_dependencies(aom_pc aom_version) 68*77c1e3ccSAndroid Build Coastguard Worker 69*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_DECODER) 70*77c1e3ccSAndroid Build Coastguard Worker if(ENABLE_EXAMPLES) 71*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_INSTALL_BINS aomdec) 72*77c1e3ccSAndroid Build Coastguard Worker endif() 73*77c1e3ccSAndroid Build Coastguard Worker endif() 74*77c1e3ccSAndroid Build Coastguard Worker 75*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_ENCODER) 76*77c1e3ccSAndroid Build Coastguard Worker if(ENABLE_EXAMPLES) 77*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_INSTALL_BINS aomenc) 78*77c1e3ccSAndroid Build Coastguard Worker endif() 79*77c1e3ccSAndroid Build Coastguard Worker endif() 80*77c1e3ccSAndroid Build Coastguard Worker 81*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 82*77c1e3ccSAndroid Build Coastguard Worker set(AOM_INSTALL_LIBS aom aom_static) 83*77c1e3ccSAndroid Build Coastguard Worker else() 84*77c1e3ccSAndroid Build Coastguard Worker set(AOM_INSTALL_LIBS aom) 85*77c1e3ccSAndroid Build Coastguard Worker endif() 86*77c1e3ccSAndroid Build Coastguard Worker 87*77c1e3ccSAndroid Build Coastguard Worker # Setup the install rules. install() will automatically prepend 88*77c1e3ccSAndroid Build Coastguard Worker # CMAKE_INSTALL_PREFIX to relative paths 89*77c1e3ccSAndroid Build Coastguard Worker install(FILES ${AOM_INSTALL_INCS} 90*77c1e3ccSAndroid Build Coastguard Worker DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom") 91*77c1e3ccSAndroid Build Coastguard Worker install(FILES "${AOM_PKG_CONFIG_FILE}" 92*77c1e3ccSAndroid Build Coastguard Worker DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") 93*77c1e3ccSAndroid Build Coastguard Worker install(TARGETS ${AOM_INSTALL_LIBS};${AOM_INSTALL_BINS} 94*77c1e3ccSAndroid Build Coastguard Worker RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 95*77c1e3ccSAndroid Build Coastguard Worker LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 96*77c1e3ccSAndroid Build Coastguard Worker ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") 97*77c1e3ccSAndroid Build Coastguard Worker endif() 98*77c1e3ccSAndroid Build Coastguard Workerendmacro() 99