1*77c1e3ccSAndroid Build Coastguard Worker# 2*77c1e3ccSAndroid Build Coastguard Worker# Copyright (c) 2016, 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 Workerif(CONFIG_TFLITE) 12*77c1e3ccSAndroid Build Coastguard Worker cmake_minimum_required(VERSION 3.11) 13*77c1e3ccSAndroid Build Coastguard Workerelse() 14*77c1e3ccSAndroid Build Coastguard Worker cmake_minimum_required(VERSION 3.9) 15*77c1e3ccSAndroid Build Coastguard Workerendif() 16*77c1e3ccSAndroid Build Coastguard Worker 17*77c1e3ccSAndroid Build Coastguard Workerset(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") 18*77c1e3ccSAndroid Build Coastguard Workerset(AOM_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}") 19*77c1e3ccSAndroid Build Coastguard Workerif("${AOM_ROOT}" STREQUAL "${AOM_CONFIG_DIR}") 20*77c1e3ccSAndroid Build Coastguard Worker message( 21*77c1e3ccSAndroid Build Coastguard Worker FATAL_ERROR "Building from within the aom source tree is not supported.\n" 22*77c1e3ccSAndroid Build Coastguard Worker "Hint: Run these commands\n" 23*77c1e3ccSAndroid Build Coastguard Worker "$ rm -rf CMakeCache.txt CMakeFiles\n" 24*77c1e3ccSAndroid Build Coastguard Worker "$ mkdir -p ../aom_build\n" "$ cd ../aom_build\n" 25*77c1e3ccSAndroid Build Coastguard Worker "And re-run CMake from the aom_build directory.") 26*77c1e3ccSAndroid Build Coastguard Workerendif() 27*77c1e3ccSAndroid Build Coastguard Worker 28*77c1e3ccSAndroid Build Coastguard Workerproject(AOM C CXX) 29*77c1e3ccSAndroid Build Coastguard Worker 30*77c1e3ccSAndroid Build Coastguard Worker# GENERATED source property global visibility. 31*77c1e3ccSAndroid Build Coastguard Workerif(POLICY CMP0118) 32*77c1e3ccSAndroid Build Coastguard Worker cmake_policy(SET CMP0118 NEW) 33*77c1e3ccSAndroid Build Coastguard Workerendif() 34*77c1e3ccSAndroid Build Coastguard Worker 35*77c1e3ccSAndroid Build Coastguard Workerif(NOT EMSCRIPTEN) 36*77c1e3ccSAndroid Build Coastguard Worker if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 37*77c1e3ccSAndroid Build Coastguard Worker set(CMAKE_BUILD_TYPE 38*77c1e3ccSAndroid Build Coastguard Worker "Release" 39*77c1e3ccSAndroid Build Coastguard Worker CACHE STRING "Build type: Debug, Release, RelWithDebInfo or MinSizeRel" 40*77c1e3ccSAndroid Build Coastguard Worker FORCE) 41*77c1e3ccSAndroid Build Coastguard Worker endif() 42*77c1e3ccSAndroid Build Coastguard Workerendif() 43*77c1e3ccSAndroid Build Coastguard Worker 44*77c1e3ccSAndroid Build Coastguard Workerif(MSVC AND MSVC_VERSION LESS 1920) 45*77c1e3ccSAndroid Build Coastguard Worker message( 46*77c1e3ccSAndroid Build Coastguard Worker WARNING 47*77c1e3ccSAndroid Build Coastguard Worker "MSVC versions prior to 2019 (v16) are not supported and may generate" 48*77c1e3ccSAndroid Build Coastguard Worker " incorrect code!") 49*77c1e3ccSAndroid Build Coastguard Workerendif() 50*77c1e3ccSAndroid Build Coastguard Worker 51*77c1e3ccSAndroid Build Coastguard Worker# Library version info. Update LT_CURRENT, LT_REVISION and LT_AGE when making a 52*77c1e3ccSAndroid Build Coastguard Worker# public release by following the guidelines in the libtool document: 53*77c1e3ccSAndroid Build Coastguard Worker# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info 54*77c1e3ccSAndroid Build Coastguard Worker# 55*77c1e3ccSAndroid Build Coastguard Worker# c=<current>, r=<revision>, a=<age> 56*77c1e3ccSAndroid Build Coastguard Worker# 57*77c1e3ccSAndroid Build Coastguard Worker# libtool generates a .so file as .so.[c-a].a.r, while -version-info c:r:a is 58*77c1e3ccSAndroid Build Coastguard Worker# passed to libtool. 59*77c1e3ccSAndroid Build Coastguard Worker# 60*77c1e3ccSAndroid Build Coastguard Worker# We set SO_FILE_VERSION = [c-a].a.r 61*77c1e3ccSAndroid Build Coastguard Workerset(LT_CURRENT 14) 62*77c1e3ccSAndroid Build Coastguard Workerset(LT_REVISION 0) 63*77c1e3ccSAndroid Build Coastguard Workerset(LT_AGE 11) 64*77c1e3ccSAndroid Build Coastguard Workermath(EXPR SO_VERSION "${LT_CURRENT} - ${LT_AGE}") 65*77c1e3ccSAndroid Build Coastguard Workerset(SO_FILE_VERSION "${SO_VERSION}.${LT_AGE}.${LT_REVISION}") 66*77c1e3ccSAndroid Build Coastguard Workerunset(LT_CURRENT) 67*77c1e3ccSAndroid Build Coastguard Workerunset(LT_REVISION) 68*77c1e3ccSAndroid Build Coastguard Workerunset(LT_AGE) 69*77c1e3ccSAndroid Build Coastguard Worker 70*77c1e3ccSAndroid Build Coastguard Worker# Enable generators like Xcode and Visual Studio to place projects in folders. 71*77c1e3ccSAndroid Build Coastguard Workerset_property(GLOBAL PROPERTY USE_FOLDERS TRUE) 72*77c1e3ccSAndroid Build Coastguard Worker 73*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/build/cmake/aom_configure.cmake") 74*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_THREE_PASS) 75*77c1e3ccSAndroid Build Coastguard Worker include("${AOM_ROOT}/common/ivf_dec.cmake") 76*77c1e3ccSAndroid Build Coastguard Workerendif() 77*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/aom_dsp/aom_dsp.cmake") 78*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/aom_mem/aom_mem.cmake") 79*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/aom_ports/aom_ports.cmake") 80*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/aom_scale/aom_scale.cmake") 81*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/aom_util/aom_util.cmake") 82*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/av1/av1.cmake") 83*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/build/cmake/aom_install.cmake") 84*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/build/cmake/sanitizers.cmake") 85*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/build/cmake/util.cmake") 86*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/test/test.cmake") 87*77c1e3ccSAndroid Build Coastguard Worker 88*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_RTCD_SOURCES 89*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h" 90*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h" 91*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/av1_rtcd.h" 92*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl" 93*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c" 94*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl" 95*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" 96*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl" 97*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/common/av1_rtcd.c" 98*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/rtcd.pl") 99*77c1e3ccSAndroid Build Coastguard Worker 100*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_LIBWEBM_SOURCES 101*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/common/hdr_util.cc" 102*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/common/hdr_util.h" 103*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/common/webmids.h" 104*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.cc" 105*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.h" 106*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxertypes.h" 107*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.cc" 108*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.h" 109*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.cc" 110*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.h" 111*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.cc" 112*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.h" 113*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.cc" 114*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.h") 115*77c1e3ccSAndroid Build Coastguard Worker 116*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_LIBYUV_SOURCES 117*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/basic_types.h" 118*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert.h" 119*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_argb.h" 120*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_from.h" 121*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/cpu_id.h" 122*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/planar_functions.h" 123*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/rotate.h" 124*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/row.h" 125*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale.h" 126*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale_row.h" 127*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/convert_argb.cc" 128*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/cpu_id.cc" 129*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/planar_functions.cc" 130*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_any.cc" 131*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_common.cc" 132*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_gcc.cc" 133*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_mips.cc" 134*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_neon.cc" 135*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_neon64.cc" 136*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/row_win.cc" 137*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale.cc" 138*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_any.cc" 139*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_common.cc" 140*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_gcc.cc" 141*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_mips.cc" 142*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_neon.cc" 143*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_neon64.cc" 144*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_win.cc" 145*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/third_party/libyuv/source/scale_uv.cc") 146*77c1e3ccSAndroid Build Coastguard Worker 147*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_SOURCES 148*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_config.c" 149*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_config.h" 150*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom.h" 151*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_codec.h" 152*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_decoder.h" 153*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_encoder.h" 154*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_external_partition.h" 155*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_frame_buffer.h" 156*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_image.h" 157*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aom_integer.h" 158*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aomcx.h" 159*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/aomdx.h" 160*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/internal/aom_codec_internal.h" 161*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/internal/aom_image_internal.h" 162*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/src/aom_codec.c" 163*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/src/aom_decoder.c" 164*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/src/aom_encoder.c" 165*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/src/aom_image.c" 166*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom/src/aom_integer.c") 167*77c1e3ccSAndroid Build Coastguard Worker 168*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_COMMON_APP_UTIL_SOURCES 169*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/arg_defs.c" 170*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/arg_defs.h" 171*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/args_helper.c" 172*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/args_helper.h" 173*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/args.c" 174*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/args.h" 175*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/av1_config.c" 176*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/av1_config.h" 177*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/md5_utils.c" 178*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/md5_utils.h" 179*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/tools_common.c" 180*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/tools_common.h" 181*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/video_common.h" 182*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/rawenc.c" 183*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/rawenc.h" 184*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/y4menc.c" 185*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/y4menc.h" 186*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/ivfdec.c" 187*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/ivfdec.h") 188*77c1e3ccSAndroid Build Coastguard Worker 189*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_DECODER_APP_UTIL_SOURCES "${AOM_ROOT}/common/obudec.c" 190*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/obudec.h" "${AOM_ROOT}/common/video_reader.c" 191*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/video_reader.h") 192*77c1e3ccSAndroid Build Coastguard Worker 193*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_ENCODER_APP_UTIL_SOURCES 194*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/ivfenc.c" 195*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/ivfenc.h" 196*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/video_writer.c" 197*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/video_writer.h" 198*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/warnings.c" 199*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/warnings.h" 200*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/y4minput.c" 201*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/y4minput.h" 202*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/examples/encoder_util.h" 203*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/examples/encoder_util.c") 204*77c1e3ccSAndroid Build Coastguard Worker 205*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_ENCODER_STATS_SOURCES "${AOM_ROOT}/stats/aomstats.c" 206*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/stats/aomstats.h" "${AOM_ROOT}/stats/rate_hist.c" 207*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/stats/rate_hist.h") 208*77c1e3ccSAndroid Build Coastguard Worker 209*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_VERSION_SOURCES "${AOM_CONFIG_DIR}/config/aom_version.h") 210*77c1e3ccSAndroid Build Coastguard Worker 211*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_WEBM_DECODER_SOURCES "${AOM_ROOT}/common/webmdec.cc" 212*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/webmdec.h") 213*77c1e3ccSAndroid Build Coastguard Worker 214*77c1e3ccSAndroid Build Coastguard Workerlist(APPEND AOM_WEBM_ENCODER_SOURCES "${AOM_ROOT}/common/webmenc.cc" 215*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/common/webmenc.h") 216*77c1e3ccSAndroid Build Coastguard Worker 217*77c1e3ccSAndroid Build Coastguard Workerinclude_directories(${AOM_ROOT} ${AOM_CONFIG_DIR} ${AOM_ROOT}/apps 218*77c1e3ccSAndroid Build Coastguard Worker ${AOM_ROOT}/common ${AOM_ROOT}/examples ${AOM_ROOT}/stats) 219*77c1e3ccSAndroid Build Coastguard Worker 220*77c1e3ccSAndroid Build Coastguard Worker# Targets 221*77c1e3ccSAndroid Build Coastguard Workeradd_library(aom_version ${AOM_VERSION_SOURCES}) 222*77c1e3ccSAndroid Build Coastguard Workeradd_no_op_source_file_to_target(aom_version c) 223*77c1e3ccSAndroid Build Coastguard Workeradd_custom_command(OUTPUT "${AOM_CONFIG_DIR}/config/aom_version.h" 224*77c1e3ccSAndroid Build Coastguard Worker COMMAND ${CMAKE_COMMAND} ARGS 225*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 226*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT=${AOM_ROOT} 227*77c1e3ccSAndroid Build Coastguard Worker -DGIT_EXECUTABLE=${GIT_EXECUTABLE} 228*77c1e3ccSAndroid Build Coastguard Worker -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P 229*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/version.cmake" 230*77c1e3ccSAndroid Build Coastguard Worker COMMENT "Writing aom_version.h" 231*77c1e3ccSAndroid Build Coastguard Worker VERBATIM) 232*77c1e3ccSAndroid Build Coastguard Worker 233*77c1e3ccSAndroid Build Coastguard Workeradd_custom_target(aom_version_check 234*77c1e3ccSAndroid Build Coastguard Worker COMMAND ${CMAKE_COMMAND} 235*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 236*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT=${AOM_ROOT} 237*77c1e3ccSAndroid Build Coastguard Worker -DGIT_EXECUTABLE=${GIT_EXECUTABLE} 238*77c1e3ccSAndroid Build Coastguard Worker -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P 239*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/version.cmake" 240*77c1e3ccSAndroid Build Coastguard Worker COMMENT "Updating version info if necessary." 241*77c1e3ccSAndroid Build Coastguard Worker VERBATIM) 242*77c1e3ccSAndroid Build Coastguard Worker 243*77c1e3ccSAndroid Build Coastguard Workerif(BUILD_SHARED_LIBS AND NOT MSVC) 244*77c1e3ccSAndroid Build Coastguard Worker # Generate version file immediately for non-MSVC shared builds: The version 245*77c1e3ccSAndroid Build Coastguard Worker # string is needed for the aom target. 246*77c1e3ccSAndroid Build Coastguard Worker execute_process(COMMAND ${CMAKE_COMMAND} 247*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 248*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT=${AOM_ROOT} 249*77c1e3ccSAndroid Build Coastguard Worker -DGIT_EXECUTABLE=${GIT_EXECUTABLE} 250*77c1e3ccSAndroid Build Coastguard Worker -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P 251*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/version.cmake") 252*77c1e3ccSAndroid Build Coastguard Workerendif() 253*77c1e3ccSAndroid Build Coastguard Worker 254*77c1e3ccSAndroid Build Coastguard Workeradd_dependencies(aom_version aom_version_check) 255*77c1e3ccSAndroid Build Coastguard Worker 256*77c1e3ccSAndroid Build Coastguard Worker# TODO(tomfinegan): Move rtcd target setup where it belongs for each rtcd 257*77c1e3ccSAndroid Build Coastguard Worker# source. 258*77c1e3ccSAndroid Build Coastguard Workeradd_rtcd_build_step("${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl" 259*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h" 260*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c" "aom_dsp_rtcd") 261*77c1e3ccSAndroid Build Coastguard Workeradd_rtcd_build_step("${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl" 262*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h" 263*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" "aom_scale_rtcd") 264*77c1e3ccSAndroid Build Coastguard Workeradd_rtcd_build_step("${AOM_ROOT}/av1/common/av1_rtcd_defs.pl" 265*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/config/av1_rtcd.h" 266*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/common/av1_rtcd.c" "av1_rtcd") 267*77c1e3ccSAndroid Build Coastguard Worker 268*77c1e3ccSAndroid Build Coastguard Workeradd_library(aom_rtcd OBJECT ${AOM_RTCD_SOURCES}) 269*77c1e3ccSAndroid Build Coastguard Workeradd_dependencies(aom_rtcd aom_version) 270*77c1e3ccSAndroid Build Coastguard Worker 271*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES) 272*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_encoder_stats OBJECT ${AOM_ENCODER_STATS_SOURCES}) 273*77c1e3ccSAndroid Build Coastguard Worker set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_encoder_stats) 274*77c1e3ccSAndroid Build Coastguard Workerendif() 275*77c1e3ccSAndroid Build Coastguard Worker 276*77c1e3ccSAndroid Build Coastguard Worker# Xcode generator cannot take a library composed solely of objects. See 277*77c1e3ccSAndroid Build Coastguard Worker# https://gitlab.kitware.com/cmake/cmake/-/issues/17500 278*77c1e3ccSAndroid Build Coastguard Workerif(XCODE) 279*77c1e3ccSAndroid Build Coastguard Worker set(target_objs_aom ${AOM_SOURCES}) 280*77c1e3ccSAndroid Build Coastguard Workerelse() 281*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_obj OBJECT ${AOM_SOURCES}) 282*77c1e3ccSAndroid Build Coastguard Worker set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_obj) 283*77c1e3ccSAndroid Build Coastguard Worker set(target_objs_aom $<TARGET_OBJECTS:aom_obj>) 284*77c1e3ccSAndroid Build Coastguard Workerendif() 285*77c1e3ccSAndroid Build Coastguard Workeradd_library(aom ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>) 286*77c1e3ccSAndroid Build Coastguard Worker 287*77c1e3ccSAndroid Build Coastguard Workerif(BUILD_SHARED_LIBS) 288*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_static STATIC ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>) 289*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom) 290*77c1e3ccSAndroid Build Coastguard Worker if(MSVC OR (WIN32 AND NOT MINGW)) 291*77c1e3ccSAndroid Build Coastguard Worker # Fix race condition between the import library and the static library. 292*77c1e3ccSAndroid Build Coastguard Worker # Affects MSVC in all three flavors (stock, clang-cl, LLVM -- the latter 293*77c1e3ccSAndroid Build Coastguard Worker # sets MSVC and MINGW both to FALSE). 294*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom PROPERTIES ARCHIVE_OUTPUT_NAME "aom_dll") 295*77c1e3ccSAndroid Build Coastguard Worker endif() 296*77c1e3ccSAndroid Build Coastguard Worker 297*77c1e3ccSAndroid Build Coastguard Worker if(NOT MSVC) 298*77c1e3ccSAndroid Build Coastguard Worker # Extract version string and set VERSION/SOVERSION for the aom target. 299*77c1e3ccSAndroid Build Coastguard Worker extract_version_string("${AOM_CONFIG_DIR}/config/aom_version.h" 300*77c1e3ccSAndroid Build Coastguard Worker aom_version_triple) 301*77c1e3ccSAndroid Build Coastguard Worker 302*77c1e3ccSAndroid Build Coastguard Worker # Strip any trailing version information, if present. 303*77c1e3ccSAndroid Build Coastguard Worker string(FIND "${aom_version_triple}" "-" dash_pos) 304*77c1e3ccSAndroid Build Coastguard Worker if(NOT dash_pos EQUAL -1) 305*77c1e3ccSAndroid Build Coastguard Worker string(SUBSTRING "${aom_version_triple}" 0 ${dash_pos} aom_version_triple) 306*77c1e3ccSAndroid Build Coastguard Worker endif() 307*77c1e3ccSAndroid Build Coastguard Worker 308*77c1e3ccSAndroid Build Coastguard Worker # cmake-format: off 309*77c1e3ccSAndroid Build Coastguard Worker # VERSION is embedded in the .so file name. 310*77c1e3ccSAndroid Build Coastguard Worker # libaom.so -> libaom.so.SOVERSION 311*77c1e3ccSAndroid Build Coastguard Worker # libaom.so.SOVERSION -> libaom.so.VERSION 312*77c1e3ccSAndroid Build Coastguard Worker # libaom.so.VERSION 313*77c1e3ccSAndroid Build Coastguard Worker # cmake-format: on 314*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom PROPERTIES SOVERSION ${SO_VERSION}) 315*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom PROPERTIES VERSION ${SO_FILE_VERSION}) 316*77c1e3ccSAndroid Build Coastguard Worker endif() 317*77c1e3ccSAndroid Build Coastguard Workerendif() 318*77c1e3ccSAndroid Build Coastguard Worker 319*77c1e3ccSAndroid Build Coastguard Workerif(NOT WIN32 AND NOT APPLE) 320*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m) 321*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 322*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} m) 323*77c1e3ccSAndroid Build Coastguard Worker endif() 324*77c1e3ccSAndroid Build Coastguard Workerendif() 325*77c1e3ccSAndroid Build Coastguard Worker 326*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_ENCODER) 327*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_AV1_RC_SOURCES "${AOM_ROOT}/av1/ratectrl_rtc.h" 328*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/av1/ratectrl_rtc.cc") 329*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_av1_rc ${AOM_AV1_RC_SOURCES}) 330*77c1e3ccSAndroid Build Coastguard Worker # aom_av1_rc calls libaom's internal functions, so it must be linked with the 331*77c1e3ccSAndroid Build Coastguard Worker # libaom static library. 332*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 333*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_av1_rc ${AOM_LIB_LINK_TYPE} aom_static) 334*77c1e3ccSAndroid Build Coastguard Worker else() 335*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_av1_rc ${AOM_LIB_LINK_TYPE} aom) 336*77c1e3ccSAndroid Build Coastguard Worker endif() 337*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 338*77c1e3ccSAndroid Build Coastguard Worker # On Windows, global symbols are not exported from a DLL by default. Enable 339*77c1e3ccSAndroid Build Coastguard Worker # the WINDOWS_EXPORT_ALL_SYMBOLS property to export all global symbols from 340*77c1e3ccSAndroid Build Coastguard Worker # the aom_av1_rc DLL on Windows, to match the default behavior on other 341*77c1e3ccSAndroid Build Coastguard Worker # platforms. 342*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom_av1_rc PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) 343*77c1e3ccSAndroid Build Coastguard Worker # The aom_av1_rc library and its header "av1/ratectrl_rtc.h" are not 344*77c1e3ccSAndroid Build Coastguard Worker # installed by the "install" command, so we don't need to worry about 345*77c1e3ccSAndroid Build Coastguard Worker # versioning the aom_av1_rc shared library. If we start to install the 346*77c1e3ccSAndroid Build Coastguard Worker # aom_av1_rc library, the library should be versioned. 347*77c1e3ccSAndroid Build Coastguard Worker endif() 348*77c1e3ccSAndroid Build Coastguard Worker if(NOT WIN32 AND NOT APPLE) 349*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_av1_rc ${AOM_LIB_LINK_TYPE} m) 350*77c1e3ccSAndroid Build Coastguard Worker endif() 351*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom_av1_rc PROPERTIES LINKER_LANGUAGE CXX) 352*77c1e3ccSAndroid Build Coastguard Workerendif() 353*77c1e3ccSAndroid Build Coastguard Worker 354*77c1e3ccSAndroid Build Coastguard Worker# List of object and static library targets. 355*77c1e3ccSAndroid Build Coastguard Workerset(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_rtcd aom_mem aom_scale aom) 356*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_ENCODER) 357*77c1e3ccSAndroid Build Coastguard Worker set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_av1_rc) 358*77c1e3ccSAndroid Build Coastguard Workerendif() 359*77c1e3ccSAndroid Build Coastguard Workerif(BUILD_SHARED_LIBS) 360*77c1e3ccSAndroid Build Coastguard Worker set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static) 361*77c1e3ccSAndroid Build Coastguard Workerendif() 362*77c1e3ccSAndroid Build Coastguard Worker 363*77c1e3ccSAndroid Build Coastguard Worker# Setup dependencies. 364*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_THREE_PASS) 365*77c1e3ccSAndroid Build Coastguard Worker setup_ivf_dec_targets() 366*77c1e3ccSAndroid Build Coastguard Workerendif() 367*77c1e3ccSAndroid Build Coastguard Workersetup_aom_dsp_targets() 368*77c1e3ccSAndroid Build Coastguard Workersetup_aom_mem_targets() 369*77c1e3ccSAndroid Build Coastguard Workersetup_aom_ports_targets() 370*77c1e3ccSAndroid Build Coastguard Workersetup_aom_util_targets() 371*77c1e3ccSAndroid Build Coastguard Workersetup_aom_scale_targets() 372*77c1e3ccSAndroid Build Coastguard Workersetup_av1_targets() 373*77c1e3ccSAndroid Build Coastguard Worker 374*77c1e3ccSAndroid Build Coastguard Worker# Make all library targets depend on aom_rtcd to make sure it builds first. 375*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_lib ${AOM_LIB_TARGETS}) 376*77c1e3ccSAndroid Build Coastguard Worker if(NOT "${aom_lib}" STREQUAL "aom_rtcd") 377*77c1e3ccSAndroid Build Coastguard Worker add_dependencies(${aom_lib} aom_rtcd) 378*77c1e3ccSAndroid Build Coastguard Worker endif() 379*77c1e3ccSAndroid Build Coastguard Workerendforeach() 380*77c1e3ccSAndroid Build Coastguard Worker 381*77c1e3ccSAndroid Build Coastguard Worker# Generate a C file containing the function usage_exit(). Users of the 382*77c1e3ccSAndroid Build Coastguard Worker# aom_common_app_util library must define this function. This is a convenience 383*77c1e3ccSAndroid Build Coastguard Worker# to allow omission of the function from applications that might want to use 384*77c1e3ccSAndroid Build Coastguard Worker# other pieces of the util support without defining usage_exit(). 385*77c1e3ccSAndroid Build Coastguard Workerfile(WRITE "${AOM_GEN_SRC_DIR}/usage_exit.c" 386*77c1e3ccSAndroid Build Coastguard Worker "#include <stdlib.h>\n\n#include \"common/tools_common.h\"\n\n" 387*77c1e3ccSAndroid Build Coastguard Worker "void usage_exit(void) { exit(EXIT_FAILURE); }\n") 388*77c1e3ccSAndroid Build Coastguard Worker 389*77c1e3ccSAndroid Build Coastguard Worker# 390*77c1e3ccSAndroid Build Coastguard Worker# Application and application support targets. 391*77c1e3ccSAndroid Build Coastguard Worker# 392*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES OR ENABLE_TESTS OR ENABLE_TOOLS) 393*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_common_app_util OBJECT ${AOM_COMMON_APP_UTIL_SOURCES}) 394*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_usage_exit OBJECT "${AOM_GEN_SRC_DIR}/usage_exit.c") 395*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${example} PROPERTY FOLDER examples) 396*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_DECODER) 397*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES}) 398*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${example} PROPERTY FOLDER examples) 399*77c1e3ccSAndroid Build Coastguard Worker # obudec depends on internal headers that require *rtcd.h 400*77c1e3ccSAndroid Build Coastguard Worker add_dependencies(aom_decoder_app_util aom_rtcd) 401*77c1e3ccSAndroid Build Coastguard Worker endif() 402*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_ENCODER) 403*77c1e3ccSAndroid Build Coastguard Worker add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES}) 404*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${example} PROPERTY FOLDER examples) 405*77c1e3ccSAndroid Build Coastguard Worker endif() 406*77c1e3ccSAndroid Build Coastguard Workerendif() 407*77c1e3ccSAndroid Build Coastguard Worker 408*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_DECODER AND ENABLE_EXAMPLES) 409*77c1e3ccSAndroid Build Coastguard Worker add_executable(aomdec "${AOM_ROOT}/apps/aomdec.c" 410*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 411*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 412*77c1e3ccSAndroid Build Coastguard Worker add_executable(decode_to_md5 "${AOM_ROOT}/examples/decode_to_md5.c" 413*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 414*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 415*77c1e3ccSAndroid Build Coastguard Worker add_executable(decode_with_drops "${AOM_ROOT}/examples/decode_with_drops.c" 416*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 417*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 418*77c1e3ccSAndroid Build Coastguard Worker add_executable(simple_decoder "${AOM_ROOT}/examples/simple_decoder.c" 419*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 420*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 421*77c1e3ccSAndroid Build Coastguard Worker add_executable(scalable_decoder "${AOM_ROOT}/examples/scalable_decoder.c" 422*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 423*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 424*77c1e3ccSAndroid Build Coastguard Worker 425*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_ANALYZER) 426*77c1e3ccSAndroid Build Coastguard Worker add_executable(analyzer "${AOM_ROOT}/examples/analyzer.cc" 427*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 428*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 429*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(analyzer ${AOM_LIB_LINK_TYPE} ${wxWidgets_LIBRARIES}) 430*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS analyzer) 431*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DECODER_EXAMPLE_TARGETS analyzer) 432*77c1e3ccSAndroid Build Coastguard Worker endif() 433*77c1e3ccSAndroid Build Coastguard Worker 434*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_INSPECTION) 435*77c1e3ccSAndroid Build Coastguard Worker add_executable(inspect "${AOM_ROOT}/examples/inspect.c" 436*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 437*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 438*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DECODER_EXAMPLE_TARGETS inspect) 439*77c1e3ccSAndroid Build Coastguard Worker 440*77c1e3ccSAndroid Build Coastguard Worker if(EMSCRIPTEN) 441*77c1e3ccSAndroid Build Coastguard Worker add_preproc_definition(_POSIX_SOURCE) 442*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "--emrun") 443*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "-s USE_PTHREADS=0") 444*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "-s WASM=1") 445*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "-s MODULARIZE=1") 446*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "-s ALLOW_MEMORY_GROWTH=1") 447*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target( 448*77c1e3ccSAndroid Build Coastguard Worker "inspect" "-s \'EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF8ToString\"]\'") 449*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" 450*77c1e3ccSAndroid Build Coastguard Worker "-s EXPORT_NAME=\"\'DecoderModule\'\"") 451*77c1e3ccSAndroid Build Coastguard Worker append_link_flag_to_target("inspect" "--memory-init-file 0") 452*77c1e3ccSAndroid Build Coastguard Worker 453*77c1e3ccSAndroid Build Coastguard Worker if("${CMAKE_BUILD_TYPE}" STREQUAL "") 454*77c1e3ccSAndroid Build Coastguard Worker 455*77c1e3ccSAndroid Build Coastguard Worker # Default to -O3 when no build type is specified. 456*77c1e3ccSAndroid Build Coastguard Worker append_compiler_flag("-O3") 457*77c1e3ccSAndroid Build Coastguard Worker endif() 458*77c1e3ccSAndroid Build Coastguard Worker 459*77c1e3ccSAndroid Build Coastguard Worker em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js") 460*77c1e3ccSAndroid Build Coastguard Worker endif() 461*77c1e3ccSAndroid Build Coastguard Worker endif() 462*77c1e3ccSAndroid Build Coastguard Worker 463*77c1e3ccSAndroid Build Coastguard Worker # Maintain a list of decoder example targets. 464*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DECODER_EXAMPLE_TARGETS aomdec decode_to_md5 decode_with_drops 465*77c1e3ccSAndroid Build Coastguard Worker scalable_decoder simple_decoder) 466*77c1e3ccSAndroid Build Coastguard Worker 467*77c1e3ccSAndroid Build Coastguard Worker # Add decoder examples to the app targets list. 468*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS}) 469*77c1e3ccSAndroid Build Coastguard Workerendif() 470*77c1e3ccSAndroid Build Coastguard Worker 471*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_LIBYUV OR CONFIG_TUNE_BUTTERAUGLI) 472*77c1e3ccSAndroid Build Coastguard Worker add_library(yuv OBJECT ${AOM_LIBYUV_SOURCES}) 473*77c1e3ccSAndroid Build Coastguard Worker if(NOT MSVC) 474*77c1e3ccSAndroid Build Coastguard Worker target_compile_options(yuv PRIVATE -Wno-shadow) 475*77c1e3ccSAndroid Build Coastguard Worker # Many functions in libyuv trigger this warning when enabled with gcc and 476*77c1e3ccSAndroid Build Coastguard Worker # clang. 477*77c1e3ccSAndroid Build Coastguard Worker is_flag_present(AOM_CXX_FLAGS "-Wmissing-declarations" flag_present) 478*77c1e3ccSAndroid Build Coastguard Worker if(flag_present) 479*77c1e3ccSAndroid Build Coastguard Worker target_compile_options(yuv PRIVATE -Wno-missing-declarations) 480*77c1e3ccSAndroid Build Coastguard Worker endif() 481*77c1e3ccSAndroid Build Coastguard Worker # Many functions in libyuv trigger this warning when enabled with clang. 482*77c1e3ccSAndroid Build Coastguard Worker is_flag_present(AOM_CXX_FLAGS "-Wmissing-prototypes" flag_present) 483*77c1e3ccSAndroid Build Coastguard Worker if(flag_present) 484*77c1e3ccSAndroid Build Coastguard Worker target_compile_options(yuv PRIVATE -Wno-missing-prototypes) 485*77c1e3ccSAndroid Build Coastguard Worker endif() 486*77c1e3ccSAndroid Build Coastguard Worker endif() 487*77c1e3ccSAndroid Build Coastguard Worker include_directories("${AOM_ROOT}/third_party/libyuv/include") 488*77c1e3ccSAndroid Build Coastguard Workerendif() 489*77c1e3ccSAndroid Build Coastguard Worker 490*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_ENCODER) 491*77c1e3ccSAndroid Build Coastguard Worker if(ENABLE_EXAMPLES) 492*77c1e3ccSAndroid Build Coastguard Worker add_executable(aomenc "${AOM_ROOT}/apps/aomenc.c" 493*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 494*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util> 495*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_stats>) 496*77c1e3ccSAndroid Build Coastguard Worker add_executable(lossless_encoder "${AOM_ROOT}/examples/lossless_encoder.c" 497*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 498*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 499*77c1e3ccSAndroid Build Coastguard Worker add_executable(set_maps "${AOM_ROOT}/examples/set_maps.c" 500*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 501*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 502*77c1e3ccSAndroid Build Coastguard Worker add_executable(simple_encoder "${AOM_ROOT}/examples/simple_encoder.c" 503*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 504*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 505*77c1e3ccSAndroid Build Coastguard Worker add_executable(twopass_encoder "${AOM_ROOT}/examples/twopass_encoder.c" 506*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 507*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 508*77c1e3ccSAndroid Build Coastguard Worker if(NOT BUILD_SHARED_LIBS AND NOT CONFIG_REALTIME_ONLY) 509*77c1e3ccSAndroid Build Coastguard Worker add_executable(noise_model "${AOM_ROOT}/examples/noise_model.c" 510*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 511*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 512*77c1e3ccSAndroid Build Coastguard Worker add_executable(photon_noise_table 513*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/examples/photon_noise_table.c" 514*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 515*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 516*77c1e3ccSAndroid Build Coastguard Worker endif() 517*77c1e3ccSAndroid Build Coastguard Worker add_executable(scalable_encoder "${AOM_ROOT}/examples/scalable_encoder.c" 518*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 519*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 520*77c1e3ccSAndroid Build Coastguard Worker add_executable(svc_encoder_rtc "${AOM_ROOT}/examples/svc_encoder_rtc.cc" 521*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 522*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 523*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(svc_encoder_rtc ${AOM_LIB_LINK_TYPE} aom_av1_rc) 524*77c1e3ccSAndroid Build Coastguard Worker 525*77c1e3ccSAndroid Build Coastguard Worker # Maintain a list of encoder example targets. 526*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_ENCODER_EXAMPLE_TARGETS aomenc lossless_encoder set_maps 527*77c1e3ccSAndroid Build Coastguard Worker simple_encoder scalable_encoder svc_encoder_rtc twopass_encoder) 528*77c1e3ccSAndroid Build Coastguard Worker if(NOT BUILD_SHARED_LIBS AND NOT CONFIG_REALTIME_ONLY) 529*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_ENCODER_EXAMPLE_TARGETS noise_model photon_noise_table) 530*77c1e3ccSAndroid Build Coastguard Worker endif() 531*77c1e3ccSAndroid Build Coastguard Worker 532*77c1e3ccSAndroid Build Coastguard Worker endif() 533*77c1e3ccSAndroid Build Coastguard Worker 534*77c1e3ccSAndroid Build Coastguard Worker if(ENABLE_TOOLS) 535*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_ENTROPY_STATS AND NOT BUILD_SHARED_LIBS) 536*77c1e3ccSAndroid Build Coastguard Worker 537*77c1e3ccSAndroid Build Coastguard Worker # TODO(tomfinegan): Sort out why a simple link command with 538*77c1e3ccSAndroid Build Coastguard Worker # aom_entropy_optimizer.c won't work on macos, but dragging in all the 539*77c1e3ccSAndroid Build Coastguard Worker # helper machinery allows the link to succeed. 540*77c1e3ccSAndroid Build Coastguard Worker add_executable(aom_entropy_optimizer 541*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/tools/aom_entropy_optimizer.c" 542*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 543*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util> 544*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_usage_exit>) 545*77c1e3ccSAndroid Build Coastguard Worker 546*77c1e3ccSAndroid Build Coastguard Worker # Maintain a list of encoder tool targets. 547*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_ENCODER_TOOL_TARGETS aom_entropy_optimizer) 548*77c1e3ccSAndroid Build Coastguard Worker endif() 549*77c1e3ccSAndroid Build Coastguard Worker endif() 550*77c1e3ccSAndroid Build Coastguard Worker 551*77c1e3ccSAndroid Build Coastguard Worker # Add encoder examples and tools to the targets list. 552*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS ${AOM_ENCODER_EXAMPLE_TARGETS} 553*77c1e3ccSAndroid Build Coastguard Worker ${AOM_ENCODER_TOOL_TARGETS}) 554*77c1e3ccSAndroid Build Coastguard Worker 555*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_TUNE_BUTTERAUGLI) 556*77c1e3ccSAndroid Build Coastguard Worker find_package(PkgConfig) 557*77c1e3ccSAndroid Build Coastguard Worker # Use find_library() with STATIC_LINK_JXL for static build since 558*77c1e3ccSAndroid Build Coastguard Worker # pkg_check_modules() with LIBJXL_STATIC is not working. 559*77c1e3ccSAndroid Build Coastguard Worker if(STATIC_LINK_JXL OR NOT PKG_CONFIG_FOUND) 560*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBJXL_LIBRARIES libjxl.a) 561*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBHWY_LIBRARIES libhwy.a) 562*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBSKCMS_LIBRARIES libskcms.a) 563*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBBROTLICOMMON_LIBRARIES libbrotlicommon-static.a) 564*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBBROTLIENC_LIBRARIES libbrotlienc-static.a) 565*77c1e3ccSAndroid Build Coastguard Worker find_library(LIBBROTLIDEC_LIBRARIES libbrotlidec-static.a) 566*77c1e3ccSAndroid Build Coastguard Worker find_path(LIBJXL_INCLUDE_DIRS butteraugli.h PATH_SUFFIXES jxl) 567*77c1e3ccSAndroid Build Coastguard Worker if(LIBJXL_LIBRARIES 568*77c1e3ccSAndroid Build Coastguard Worker AND LIBHWY_LIBRARIES 569*77c1e3ccSAndroid Build Coastguard Worker AND LIBSKCMS_LIBRARIES 570*77c1e3ccSAndroid Build Coastguard Worker AND LIBBROTLICOMMON_LIBRARIES 571*77c1e3ccSAndroid Build Coastguard Worker AND LIBBROTLIENC_LIBRARIES 572*77c1e3ccSAndroid Build Coastguard Worker AND LIBBROTLIDEC_LIBRARIES 573*77c1e3ccSAndroid Build Coastguard Worker AND LIBJXL_INCLUDE_DIRS) 574*77c1e3ccSAndroid Build Coastguard Worker message(STATUS "Found JXL library: ${LIBJXL_LIBRARIES} " 575*77c1e3ccSAndroid Build Coastguard Worker "${LIBHWY_LIBRARIES} ${LIBSKCMS_LIBRARIES} " 576*77c1e3ccSAndroid Build Coastguard Worker "${LIBBROTLICOMMON_LIBRARIES} ${LIBBROTLIENC_LIBRARIES}" 577*77c1e3ccSAndroid Build Coastguard Worker "${LIBBROTLIDEC_LIBRARIES}") 578*77c1e3ccSAndroid Build Coastguard Worker message(STATUS "Found JXL include: ${LIBJXL_INCLUDE_DIRS}") 579*77c1e3ccSAndroid Build Coastguard Worker else() 580*77c1e3ccSAndroid Build Coastguard Worker message(FATAL_ERROR "JXL library not found.") 581*77c1e3ccSAndroid Build Coastguard Worker endif() 582*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom 583*77c1e3ccSAndroid Build Coastguard Worker PRIVATE ${LIBJXL_LIBRARIES} ${LIBHWY_LIBRARIES} 584*77c1e3ccSAndroid Build Coastguard Worker ${LIBSKCMS_LIBRARIES} 585*77c1e3ccSAndroid Build Coastguard Worker ${LIBBROTLIENC_LIBRARIES} 586*77c1e3ccSAndroid Build Coastguard Worker ${LIBBROTLIDEC_LIBRARIES} 587*77c1e3ccSAndroid Build Coastguard Worker ${LIBBROTLICOMMON_LIBRARIES}) 588*77c1e3ccSAndroid Build Coastguard Worker target_include_directories(aom_dsp_encoder PRIVATE ${LIBJXL_INCLUDE_DIRS}) 589*77c1e3ccSAndroid Build Coastguard Worker else() 590*77c1e3ccSAndroid Build Coastguard Worker pkg_check_modules(LIBJXL REQUIRED libjxl) 591*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom PRIVATE ${LIBJXL_LDFLAGS}) 592*77c1e3ccSAndroid Build Coastguard Worker target_include_directories(aom_dsp_encoder PRIVATE ${LIBJXL_INCLUDE_DIRS}) 593*77c1e3ccSAndroid Build Coastguard Worker if(LIBJXL_CFLAGS) 594*77c1e3ccSAndroid Build Coastguard Worker append_compiler_flag("${LIBJXL_CFLAGS}") 595*77c1e3ccSAndroid Build Coastguard Worker endif() 596*77c1e3ccSAndroid Build Coastguard Worker pkg_check_modules(LIBHWY REQUIRED libhwy) 597*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom PRIVATE ${LIBHWY_LDFLAGS}) 598*77c1e3ccSAndroid Build Coastguard Worker target_include_directories(aom_dsp_encoder 599*77c1e3ccSAndroid Build Coastguard Worker PRIVATE ${LIBLIBHWY_INCLUDE_DIRS}) 600*77c1e3ccSAndroid Build Coastguard Worker if(LIBHWY_CFLAGS) 601*77c1e3ccSAndroid Build Coastguard Worker append_compiler_flag("${LIBHWY_CFLAGS}") 602*77c1e3ccSAndroid Build Coastguard Worker endif() 603*77c1e3ccSAndroid Build Coastguard Worker endif() 604*77c1e3ccSAndroid Build Coastguard Worker 605*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom PROPERTIES LINKER_LANGUAGE CXX) 606*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 607*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX) 608*77c1e3ccSAndroid Build Coastguard Worker endif() 609*77c1e3ccSAndroid Build Coastguard Worker 610*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_LIB_TARGETS yuv) 611*77c1e3ccSAndroid Build Coastguard Worker target_sources(aom PRIVATE $<TARGET_OBJECTS:yuv>) 612*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 613*77c1e3ccSAndroid Build Coastguard Worker target_sources(aom_static PRIVATE $<TARGET_OBJECTS:yuv>) 614*77c1e3ccSAndroid Build Coastguard Worker endif() 615*77c1e3ccSAndroid Build Coastguard Worker endif() 616*77c1e3ccSAndroid Build Coastguard Worker 617*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_TFLITE) 618*77c1e3ccSAndroid Build Coastguard Worker include(FetchContent) 619*77c1e3ccSAndroid Build Coastguard Worker 620*77c1e3ccSAndroid Build Coastguard Worker set(TFLITE_TAG "v2.6.1") 621*77c1e3ccSAndroid Build Coastguard Worker 622*77c1e3ccSAndroid Build Coastguard Worker message(STATUS "Fetching TFLite ${TFLITE_TAG}...") 623*77c1e3ccSAndroid Build Coastguard Worker 624*77c1e3ccSAndroid Build Coastguard Worker # static linking makes life with TFLite much easier 625*77c1e3ccSAndroid Build Coastguard Worker set(TFLITE_C_BUILD_SHARED_LIBS OFF) 626*77c1e3ccSAndroid Build Coastguard Worker 627*77c1e3ccSAndroid Build Coastguard Worker # We don't care about comparing against these delegates (yet), and disabling 628*77c1e3ccSAndroid Build Coastguard Worker # it reduces compile time meaningfully 629*77c1e3ccSAndroid Build Coastguard Worker set(TFLITE_ENABLE_RUY OFF) 630*77c1e3ccSAndroid Build Coastguard Worker set(TFLITE_ENABLE_XNNPACK OFF) 631*77c1e3ccSAndroid Build Coastguard Worker 632*77c1e3ccSAndroid Build Coastguard Worker fetchcontent_declare(tflite 633*77c1e3ccSAndroid Build Coastguard Worker GIT_REPOSITORY https://github.com/tensorflow/tensorflow 634*77c1e3ccSAndroid Build Coastguard Worker GIT_TAG ${TFLITE_TAG} 635*77c1e3ccSAndroid Build Coastguard Worker GIT_SHALLOW TRUE) 636*77c1e3ccSAndroid Build Coastguard Worker 637*77c1e3ccSAndroid Build Coastguard Worker fetchcontent_getproperties(tflite) 638*77c1e3ccSAndroid Build Coastguard Worker if(NOT tflite_POPULATED) 639*77c1e3ccSAndroid Build Coastguard Worker fetchcontent_populate(tflite) 640*77c1e3ccSAndroid Build Coastguard Worker # Some of the subprojects (e.g. Eigen) are very noisy and emit status 641*77c1e3ccSAndroid Build Coastguard Worker # messages all the time. Temporary ignore status messages while adding 642*77c1e3ccSAndroid Build Coastguard Worker # this to silence it. Ugly but effective. 643*77c1e3ccSAndroid Build Coastguard Worker set(OLD_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL}) 644*77c1e3ccSAndroid Build Coastguard Worker set(CMAKE_MESSAGE_LOG_LEVEL WARNING) 645*77c1e3ccSAndroid Build Coastguard Worker add_subdirectory(${tflite_SOURCE_DIR}/tensorflow/lite/c 646*77c1e3ccSAndroid Build Coastguard Worker ${tflite_BINARY_DIR}) 647*77c1e3ccSAndroid Build Coastguard Worker set(CMAKE_MESSAGE_LOG_LEVEL ${OLD_CMAKE_MESSAGE_LOG_LEVEL}) 648*77c1e3ccSAndroid Build Coastguard Worker endif() 649*77c1e3ccSAndroid Build Coastguard Worker 650*77c1e3ccSAndroid Build Coastguard Worker # Disable some noisy warnings in tflite 651*77c1e3ccSAndroid Build Coastguard Worker target_compile_options(tensorflow-lite PRIVATE -w) 652*77c1e3ccSAndroid Build Coastguard Worker 653*77c1e3ccSAndroid Build Coastguard Worker # tensorflowlite_c is implicitly declared by this FetchContent 654*77c1e3ccSAndroid Build Coastguard Worker include_directories(${tflite_SOURCE_DIR}) 655*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom PRIVATE tensorflow-lite) 656*77c1e3ccSAndroid Build Coastguard Worker endif() 657*77c1e3ccSAndroid Build Coastguard Worker 658*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_TUNE_VMAF) 659*77c1e3ccSAndroid Build Coastguard Worker find_package(PkgConfig) 660*77c1e3ccSAndroid Build Coastguard Worker if(PKG_CONFIG_FOUND) 661*77c1e3ccSAndroid Build Coastguard Worker pkg_check_modules(VMAF REQUIRED libvmaf) 662*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 663*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_static PRIVATE ${VMAF_LDFLAGS}) 664*77c1e3ccSAndroid Build Coastguard Worker endif() 665*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom PRIVATE ${VMAF_LDFLAGS}) 666*77c1e3ccSAndroid Build Coastguard Worker target_include_directories(aom_dsp_encoder PRIVATE ${VMAF_INCLUDE_DIRS}) 667*77c1e3ccSAndroid Build Coastguard Worker if(VMAF_CFLAGS) 668*77c1e3ccSAndroid Build Coastguard Worker foreach(flag "${VMAF_CFLAGS}") 669*77c1e3ccSAndroid Build Coastguard Worker append_compiler_flag("${flag}") 670*77c1e3ccSAndroid Build Coastguard Worker endforeach() 671*77c1e3ccSAndroid Build Coastguard Worker endif() 672*77c1e3ccSAndroid Build Coastguard Worker else() 673*77c1e3ccSAndroid Build Coastguard Worker message(FATAL_ERROR "CONFIG_TUNE_VMAF error: pkg-config not found.") 674*77c1e3ccSAndroid Build Coastguard Worker endif() 675*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom PROPERTIES LINKER_LANGUAGE CXX) 676*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 677*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX) 678*77c1e3ccSAndroid Build Coastguard Worker endif() 679*77c1e3ccSAndroid Build Coastguard Worker endif() 680*77c1e3ccSAndroid Build Coastguard Workerendif() 681*77c1e3ccSAndroid Build Coastguard Worker 682*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES) 683*77c1e3ccSAndroid Build Coastguard Worker 684*77c1e3ccSAndroid Build Coastguard Worker # Maintain a separate variable listing only the examples to facilitate 685*77c1e3ccSAndroid Build Coastguard Worker # installation of example programs into an examples sub directory of 686*77c1e3ccSAndroid Build Coastguard Worker # $AOM_DIST_DIR/bin when building the dist target. 687*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS} 688*77c1e3ccSAndroid Build Coastguard Worker ${AOM_ENCODER_EXAMPLE_TARGETS}) 689*77c1e3ccSAndroid Build Coastguard Workerendif() 690*77c1e3ccSAndroid Build Coastguard Worker 691*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_TOOLS) 692*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_DECODER) 693*77c1e3ccSAndroid Build Coastguard Worker add_executable(dump_obu "${AOM_ROOT}/tools/dump_obu.cc" 694*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/tools/obu_parser.cc" 695*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/tools/obu_parser.h" 696*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 697*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util> 698*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_usage_exit>) 699*77c1e3ccSAndroid Build Coastguard Worker 700*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_TOOL_TARGETS dump_obu) 701*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS dump_obu) 702*77c1e3ccSAndroid Build Coastguard Worker 703*77c1e3ccSAndroid Build Coastguard Worker # Maintain a separate variable listing only the examples to facilitate 704*77c1e3ccSAndroid Build Coastguard Worker # installation of example programs into an tools sub directory of 705*77c1e3ccSAndroid Build Coastguard Worker # $AOM_DIST_DIR/bin when building the dist target. 706*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_TOOL_TARGETS ${AOM_DECODER_TOOL_TARGETS} 707*77c1e3ccSAndroid Build Coastguard Worker ${AOM_ENCODER_TOOL_TARGETS}) 708*77c1e3ccSAndroid Build Coastguard Worker endif() 709*77c1e3ccSAndroid Build Coastguard Workerendif() 710*77c1e3ccSAndroid Build Coastguard Worker 711*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER) 712*77c1e3ccSAndroid Build Coastguard Worker add_executable(aom_cx_set_ref "${AOM_ROOT}/examples/aom_cx_set_ref.c" 713*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 714*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 715*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS aom_cx_set_ref) 716*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS aom_cx_set_ref) 717*77c1e3ccSAndroid Build Coastguard Workerendif() 718*77c1e3ccSAndroid Build Coastguard Worker 719*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND CONFIG_AV1_ENCODER) 720*77c1e3ccSAndroid Build Coastguard Worker add_executable(lightfield_encoder "${AOM_ROOT}/examples/lightfield_encoder.c" 721*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 722*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util>) 723*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS lightfield_encoder) 724*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS lightfield_encoder) 725*77c1e3ccSAndroid Build Coastguard Workerendif() 726*77c1e3ccSAndroid Build Coastguard Worker 727*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER) 728*77c1e3ccSAndroid Build Coastguard Worker add_executable(lightfield_tile_list_decoder 729*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/examples/lightfield_tile_list_decoder.c" 730*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 731*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 732*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS lightfield_tile_list_decoder) 733*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS lightfield_tile_list_decoder) 734*77c1e3ccSAndroid Build Coastguard Workerendif() 735*77c1e3ccSAndroid Build Coastguard Worker 736*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER) 737*77c1e3ccSAndroid Build Coastguard Worker add_executable(lightfield_decoder "${AOM_ROOT}/examples/lightfield_decoder.c" 738*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 739*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 740*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS lightfield_decoder) 741*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS lightfield_decoder) 742*77c1e3ccSAndroid Build Coastguard Workerendif() 743*77c1e3ccSAndroid Build Coastguard Worker 744*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND CONFIG_AV1_ENCODER AND CONFIG_AV1_DECODER) 745*77c1e3ccSAndroid Build Coastguard Worker add_executable(lightfield_bitstream_parsing 746*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/examples/lightfield_bitstream_parsing.c" 747*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_common_app_util> 748*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_encoder_app_util> 749*77c1e3ccSAndroid Build Coastguard Worker $<TARGET_OBJECTS:aom_decoder_app_util>) 750*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_EXAMPLE_TARGETS lightfield_bitstream_parsing) 751*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_APP_TARGETS lightfield_bitstream_parsing) 752*77c1e3ccSAndroid Build Coastguard Workerendif() 753*77c1e3ccSAndroid Build Coastguard Worker 754*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_app ${AOM_APP_TARGETS}) 755*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(${aom_app} ${AOM_LIB_LINK_TYPE} aom) 756*77c1e3ccSAndroid Build Coastguard Workerendforeach() 757*77c1e3ccSAndroid Build Coastguard Worker 758*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES OR ENABLE_TESTS OR ENABLE_TOOLS) 759*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_LIBYUV) 760*77c1e3ccSAndroid Build Coastguard Worker # Add to existing targets. 761*77c1e3ccSAndroid Build Coastguard Worker foreach(aom_app ${AOM_APP_TARGETS}) 762*77c1e3ccSAndroid Build Coastguard Worker target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:yuv>) 763*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX) 764*77c1e3ccSAndroid Build Coastguard Worker endforeach() 765*77c1e3ccSAndroid Build Coastguard Worker endif() 766*77c1e3ccSAndroid Build Coastguard Worker 767*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_WEBM_IO) 768*77c1e3ccSAndroid Build Coastguard Worker add_library(webm OBJECT ${AOM_LIBWEBM_SOURCES}) 769*77c1e3ccSAndroid Build Coastguard Worker include_directories("${AOM_ROOT}/third_party/libwebm") 770*77c1e3ccSAndroid Build Coastguard Worker target_compile_definitions(webm PRIVATE __STDC_CONSTANT_MACROS) 771*77c1e3ccSAndroid Build Coastguard Worker target_compile_definitions(webm PRIVATE __STDC_LIMIT_MACROS) 772*77c1e3ccSAndroid Build Coastguard Worker 773*77c1e3ccSAndroid Build Coastguard Worker if(NOT MSVC) 774*77c1e3ccSAndroid Build Coastguard Worker target_compile_options(webm PRIVATE -Wno-shadow) 775*77c1e3ccSAndroid Build Coastguard Worker endif() 776*77c1e3ccSAndroid Build Coastguard Worker 777*77c1e3ccSAndroid Build Coastguard Worker # Add to existing targets. 778*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_DECODER) 779*77c1e3ccSAndroid Build Coastguard Worker target_sources(aom_decoder_app_util PRIVATE ${AOM_WEBM_DECODER_SOURCES}) 780*77c1e3ccSAndroid Build Coastguard Worker endif() 781*77c1e3ccSAndroid Build Coastguard Worker 782*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_AV1_ENCODER) 783*77c1e3ccSAndroid Build Coastguard Worker target_sources(aom_encoder_app_util PRIVATE ${AOM_WEBM_ENCODER_SOURCES}) 784*77c1e3ccSAndroid Build Coastguard Worker endif() 785*77c1e3ccSAndroid Build Coastguard Worker 786*77c1e3ccSAndroid Build Coastguard Worker foreach(aom_app ${AOM_APP_TARGETS}) 787*77c1e3ccSAndroid Build Coastguard Worker target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:webm>) 788*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX) 789*77c1e3ccSAndroid Build Coastguard Worker endforeach() 790*77c1e3ccSAndroid Build Coastguard Worker endif() 791*77c1e3ccSAndroid Build Coastguard Workerendif() 792*77c1e3ccSAndroid Build Coastguard Worker 793*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_TESTS) 794*77c1e3ccSAndroid Build Coastguard Worker 795*77c1e3ccSAndroid Build Coastguard Worker # Create test_libaom target and the targets it depends on. 796*77c1e3ccSAndroid Build Coastguard Worker setup_aom_test_targets() 797*77c1e3ccSAndroid Build Coastguard Workerendif() 798*77c1e3ccSAndroid Build Coastguard Worker 799*77c1e3ccSAndroid Build Coastguard Workerif(HAVE_PTHREAD_H AND CONFIG_MULTITHREAD) 800*77c1e3ccSAndroid Build Coastguard Worker find_package(Threads) 801*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom ${AOM_LIB_LINK_TYPE} Threads::Threads) 802*77c1e3ccSAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 803*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} Threads::Threads) 804*77c1e3ccSAndroid Build Coastguard Worker endif() 805*77c1e3ccSAndroid Build Coastguard Workerendif() 806*77c1e3ccSAndroid Build Coastguard Worker 807*77c1e3ccSAndroid Build Coastguard Workerif(XCODE) 808*77c1e3ccSAndroid Build Coastguard Worker 809*77c1e3ccSAndroid Build Coastguard Worker # TODO(tomfinegan): Make sure target has no C++ files before doing this as 810*77c1e3ccSAndroid Build Coastguard Worker # it's not necessary in that case. 811*77c1e3ccSAndroid Build Coastguard Worker if(CONFIG_LIBYUV OR CONFIG_WEBM_IO) 812*77c1e3ccSAndroid Build Coastguard Worker 813*77c1e3ccSAndroid Build Coastguard Worker # The Xcode generator does not obey LINKER_LANGUAGE. Because of the issue 814*77c1e3ccSAndroid Build Coastguard Worker # what looks like a C++ file needs to be in any target that Xcode will link 815*77c1e3ccSAndroid Build Coastguard Worker # when the target contains a C++ dependency. Without this Xcode will try to 816*77c1e3ccSAndroid Build Coastguard Worker # link with the C linker, which always ends badly when a dependency actually 817*77c1e3ccSAndroid Build Coastguard Worker # includes C++. 818*77c1e3ccSAndroid Build Coastguard Worker 819*77c1e3ccSAndroid Build Coastguard Worker # Note: LINKER_LANGUAGE is explicitly set to C++ for all targets touched 820*77c1e3ccSAndroid Build Coastguard Worker # here, it really is the Xcode generator's fault, or just a deficiency in 821*77c1e3ccSAndroid Build Coastguard Worker # Xcode itself. 822*77c1e3ccSAndroid Build Coastguard Worker foreach(aom_app ${AOM_APP_TARGETS}) 823*77c1e3ccSAndroid Build Coastguard Worker add_no_op_source_file_to_target("${aom_app}" "cc") 824*77c1e3ccSAndroid Build Coastguard Worker endforeach() 825*77c1e3ccSAndroid Build Coastguard Worker endif() 826*77c1e3ccSAndroid Build Coastguard Workerendif() 827*77c1e3ccSAndroid Build Coastguard Worker 828*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES AND "${CMAKE_GENERATOR}" MATCHES "Makefiles$") 829*77c1e3ccSAndroid Build Coastguard Worker 830*77c1e3ccSAndroid Build Coastguard Worker # For historical purposes place the example binaries in the example directory. 831*77c1e3ccSAndroid Build Coastguard Worker file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/examples") 832*77c1e3ccSAndroid Build Coastguard Worker 833*77c1e3ccSAndroid Build Coastguard Worker foreach(target ${AOM_EXAMPLE_TARGETS}) 834*77c1e3ccSAndroid Build Coastguard Worker if(NOT "${target}" MATCHES "aomdec\|aomenc") 835*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(${target} 836*77c1e3ccSAndroid Build Coastguard Worker PROPERTIES RUNTIME_OUTPUT_DIRECTORY 837*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/examples") 838*77c1e3ccSAndroid Build Coastguard Worker endif() 839*77c1e3ccSAndroid Build Coastguard Worker endforeach() 840*77c1e3ccSAndroid Build Coastguard Worker 841*77c1e3ccSAndroid Build Coastguard Worker if(ENABLE_TOOLS AND AOM_TOOL_TARGETS) 842*77c1e3ccSAndroid Build Coastguard Worker 843*77c1e3ccSAndroid Build Coastguard Worker # The same expectation is true for tool targets. 844*77c1e3ccSAndroid Build Coastguard Worker file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/tools") 845*77c1e3ccSAndroid Build Coastguard Worker set_target_properties(${AOM_TOOL_TARGETS} 846*77c1e3ccSAndroid Build Coastguard Worker PROPERTIES RUNTIME_OUTPUT_DIRECTORY 847*77c1e3ccSAndroid Build Coastguard Worker "${AOM_CONFIG_DIR}/tools") 848*77c1e3ccSAndroid Build Coastguard Worker endif() 849*77c1e3ccSAndroid Build Coastguard Workerendif() 850*77c1e3ccSAndroid Build Coastguard Worker 851*77c1e3ccSAndroid Build Coastguard Workerif(BUILD_SHARED_LIBS) 852*77c1e3ccSAndroid Build Coastguard Worker # Don't use -Wl,-z,defs with Clang's sanitizers. 853*77c1e3ccSAndroid Build Coastguard Worker # 854*77c1e3ccSAndroid Build Coastguard Worker # Clang's AddressSanitizer documentation says "When linking shared libraries, 855*77c1e3ccSAndroid Build Coastguard Worker # the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link 856*77c1e3ccSAndroid Build Coastguard Worker # errors (don't use it with AddressSanitizer)." See 857*77c1e3ccSAndroid Build Coastguard Worker # https://clang.llvm.org/docs/AddressSanitizer.html#usage. Similarly, see 858*77c1e3ccSAndroid Build Coastguard Worker # https://clang.llvm.org/docs/MemorySanitizer.html#usage. 859*77c1e3ccSAndroid Build Coastguard Worker if(NOT WIN32 860*77c1e3ccSAndroid Build Coastguard Worker AND NOT APPLE 861*77c1e3ccSAndroid Build Coastguard Worker AND NOT (CMAKE_C_COMPILER_ID MATCHES "Clang" AND SANITIZE)) 862*77c1e3ccSAndroid Build Coastguard Worker # The -z defs linker option reports unresolved symbol references from object 863*77c1e3ccSAndroid Build Coastguard Worker # files when building a shared library. 864*77c1e3ccSAndroid Build Coastguard Worker if("${CMAKE_VERSION}" VERSION_LESS "3.13") 865*77c1e3ccSAndroid Build Coastguard Worker # target_link_options() is not available before CMake 3.13. 866*77c1e3ccSAndroid Build Coastguard Worker target_link_libraries(aom PRIVATE -Wl,-z,defs) 867*77c1e3ccSAndroid Build Coastguard Worker else() 868*77c1e3ccSAndroid Build Coastguard Worker target_link_options(aom PRIVATE LINKER:-z,defs) 869*77c1e3ccSAndroid Build Coastguard Worker endif() 870*77c1e3ccSAndroid Build Coastguard Worker endif() 871*77c1e3ccSAndroid Build Coastguard Worker 872*77c1e3ccSAndroid Build Coastguard Worker include("${AOM_ROOT}/build/cmake/exports.cmake") 873*77c1e3ccSAndroid Build Coastguard Worker setup_exports_target() 874*77c1e3ccSAndroid Build Coastguard Workerendif() 875*77c1e3ccSAndroid Build Coastguard Worker 876*77c1e3ccSAndroid Build Coastguard Worker# Handle user supplied compile and link flags last to ensure they're obeyed. 877*77c1e3ccSAndroid Build Coastguard Workerset_user_flags() 878*77c1e3ccSAndroid Build Coastguard Worker 879*77c1e3ccSAndroid Build Coastguard Worker# Aomedia documentation rule. 880*77c1e3ccSAndroid Build Coastguard Workerset(DOXYGEN_VERSION_VALUE 0) 881*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_DOCS) 882*77c1e3ccSAndroid Build Coastguard Worker find_package(Doxygen) 883*77c1e3ccSAndroid Build Coastguard Worker if(DOXYGEN_FOUND) 884*77c1e3ccSAndroid Build Coastguard Worker # Check if Doxygen version is >= minimum required version(i.e. 1.8.10). 885*77c1e3ccSAndroid Build Coastguard Worker set(MINIMUM_DOXYGEN_VERSION 1008010) 886*77c1e3ccSAndroid Build Coastguard Worker 887*77c1e3ccSAndroid Build Coastguard Worker if(DOXYGEN_VERSION) 888*77c1e3ccSAndroid Build Coastguard Worker # Strip SHA1 from version string if present. 889*77c1e3ccSAndroid Build Coastguard Worker string(REGEX 890*77c1e3ccSAndroid Build Coastguard Worker REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" DOXYGEN_VERSION 891*77c1e3ccSAndroid Build Coastguard Worker ${DOXYGEN_VERSION}) 892*77c1e3ccSAndroid Build Coastguard Worker # Replace dots with semicolons to create a list. 893*77c1e3ccSAndroid Build Coastguard Worker string(REGEX REPLACE "\\." ";" DOXYGEN_VERSION_LIST ${DOXYGEN_VERSION}) 894*77c1e3ccSAndroid Build Coastguard Worker # Parse version components from the list. 895*77c1e3ccSAndroid Build Coastguard Worker list(GET DOXYGEN_VERSION_LIST 0 DOXYGEN_MAJOR) 896*77c1e3ccSAndroid Build Coastguard Worker list(GET DOXYGEN_VERSION_LIST 1 DOXYGEN_MINOR) 897*77c1e3ccSAndroid Build Coastguard Worker list(GET DOXYGEN_VERSION_LIST 2 DOXYGEN_PATCH) 898*77c1e3ccSAndroid Build Coastguard Worker endif() 899*77c1e3ccSAndroid Build Coastguard Worker 900*77c1e3ccSAndroid Build Coastguard Worker # Construct a version value for comparison. 901*77c1e3ccSAndroid Build Coastguard Worker math(EXPR DOXYGEN_MAJOR "${DOXYGEN_MAJOR}*1000000") 902*77c1e3ccSAndroid Build Coastguard Worker math(EXPR DOXYGEN_MINOR "${DOXYGEN_MINOR}*1000") 903*77c1e3ccSAndroid Build Coastguard Worker math(EXPR DOXYGEN_VERSION_VALUE 904*77c1e3ccSAndroid Build Coastguard Worker "${DOXYGEN_MAJOR} + ${DOXYGEN_MINOR} + ${DOXYGEN_PATCH}") 905*77c1e3ccSAndroid Build Coastguard Worker 906*77c1e3ccSAndroid Build Coastguard Worker if(${DOXYGEN_VERSION_VALUE} LESS ${MINIMUM_DOXYGEN_VERSION}) 907*77c1e3ccSAndroid Build Coastguard Worker set(DOXYGEN_FOUND NO) 908*77c1e3ccSAndroid Build Coastguard Worker endif() 909*77c1e3ccSAndroid Build Coastguard Worker endif() 910*77c1e3ccSAndroid Build Coastguard Worker 911*77c1e3ccSAndroid Build Coastguard Worker if(DOXYGEN_FOUND) 912*77c1e3ccSAndroid Build Coastguard Worker include("${AOM_ROOT}/docs.cmake") 913*77c1e3ccSAndroid Build Coastguard Worker setup_documentation_targets() 914*77c1e3ccSAndroid Build Coastguard Worker else() 915*77c1e3ccSAndroid Build Coastguard Worker message( 916*77c1e3ccSAndroid Build Coastguard Worker "--- Cannot find doxygen(version 1.8.10 or newer), ENABLE_DOCS turned off." 917*77c1e3ccSAndroid Build Coastguard Worker ) 918*77c1e3ccSAndroid Build Coastguard Worker set(ENABLE_DOCS OFF) 919*77c1e3ccSAndroid Build Coastguard Worker endif() 920*77c1e3ccSAndroid Build Coastguard Workerendif() 921*77c1e3ccSAndroid Build Coastguard Worker 922*77c1e3ccSAndroid Build Coastguard Worker# Aomedia dist rule. 923*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_DECODER AND ENABLE_EXAMPLES) 924*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DIST_APPS $<TARGET_FILE:aomdec>) 925*77c1e3ccSAndroid Build Coastguard Workerendif() 926*77c1e3ccSAndroid Build Coastguard Workerif(CONFIG_AV1_ENCODER AND ENABLE_EXAMPLES) 927*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DIST_APPS $<TARGET_FILE:aomenc>) 928*77c1e3ccSAndroid Build Coastguard Workerendif() 929*77c1e3ccSAndroid Build Coastguard Worker 930*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_EXAMPLES) 931*77c1e3ccSAndroid Build Coastguard Worker foreach(example ${AOM_EXAMPLE_TARGETS}) 932*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DIST_EXAMPLES $<TARGET_FILE:${example}>) 933*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${example} PROPERTY FOLDER examples) 934*77c1e3ccSAndroid Build Coastguard Worker endforeach() 935*77c1e3ccSAndroid Build Coastguard Workerendif() 936*77c1e3ccSAndroid Build Coastguard Worker 937*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_TOOLS) 938*77c1e3ccSAndroid Build Coastguard Worker foreach(tool ${AOM_TOOL_TARGETS}) 939*77c1e3ccSAndroid Build Coastguard Worker list(APPEND AOM_DIST_TOOLS $<TARGET_FILE:${tool}>) 940*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET ${tool} PROPERTY FOLDER tools) 941*77c1e3ccSAndroid Build Coastguard Worker endforeach() 942*77c1e3ccSAndroid Build Coastguard Workerendif() 943*77c1e3ccSAndroid Build Coastguard Worker 944*77c1e3ccSAndroid Build Coastguard Workerif(NOT AOM_DIST_DIR) 945*77c1e3ccSAndroid Build Coastguard Worker set(AOM_DIST_DIR "${AOM_CONFIG_DIR}/dist") 946*77c1e3ccSAndroid Build Coastguard Workerendif() 947*77c1e3ccSAndroid Build Coastguard Worker 948*77c1e3ccSAndroid Build Coastguard Workeradd_custom_target(dist 949*77c1e3ccSAndroid Build Coastguard Worker COMMAND ${CMAKE_COMMAND} 950*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT=${AOM_ROOT} 951*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 952*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_DIR=${AOM_DIST_DIR} 953*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_APPS="${AOM_DIST_APPS}" 954*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_EXAMPLES="${AOM_DIST_EXAMPLES}" 955*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_TOOLS="${AOM_DIST_TOOLS}" 956*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_INCLUDES="${AOM_INSTALL_INCS}" 957*77c1e3ccSAndroid Build Coastguard Worker -DAOM_DIST_LIBS=$<TARGET_FILE:aom> 958*77c1e3ccSAndroid Build Coastguard Worker -DENABLE_DOCS=${ENABLE_DOCS} -P 959*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/dist.cmake" 960*77c1e3ccSAndroid Build Coastguard Worker DEPENDS ${AOM_INSTALL_BINS} ${AOM_INSTALL_LIBS} 961*77c1e3ccSAndroid Build Coastguard Worker ${AOM_INSTALL_INCS} ${AOM_EXAMPLE_TARGETS} 962*77c1e3ccSAndroid Build Coastguard Worker ${AOM_TOOL_TARGETS}) 963*77c1e3ccSAndroid Build Coastguard Worker 964*77c1e3ccSAndroid Build Coastguard Workerif(ENABLE_DOCS) 965*77c1e3ccSAndroid Build Coastguard Worker add_dependencies(dist docs) 966*77c1e3ccSAndroid Build Coastguard Workerendif() 967*77c1e3ccSAndroid Build Coastguard Worker 968*77c1e3ccSAndroid Build Coastguard Worker# Collect all variables containing libaom source files. 969*77c1e3ccSAndroid Build Coastguard Workerget_cmake_property(all_cmake_vars VARIABLES) 970*77c1e3ccSAndroid Build Coastguard Workerforeach(var ${all_cmake_vars}) 971*77c1e3ccSAndroid Build Coastguard Worker if("${var}" MATCHES "SOURCES$\|_INTRIN_\|_ASM_" 972*77c1e3ccSAndroid Build Coastguard Worker AND NOT "${var}" MATCHES "DOXYGEN\|LIBYUV\|_PKG_\|TEST" 973*77c1e3ccSAndroid Build Coastguard Worker AND NOT "${var}" MATCHES "_ASM_NASM\|_ASM_COMPILER") 974*77c1e3ccSAndroid Build Coastguard Worker list(APPEND aom_source_vars ${var}) 975*77c1e3ccSAndroid Build Coastguard Worker endif() 976*77c1e3ccSAndroid Build Coastguard Workerendforeach() 977*77c1e3ccSAndroid Build Coastguard Worker 978*77c1e3ccSAndroid Build Coastguard Workerif(NOT CONFIG_AV1_DECODER) 979*77c1e3ccSAndroid Build Coastguard Worker list(FILTER aom_source_vars EXCLUDE REGEX "_DECODER_") 980*77c1e3ccSAndroid Build Coastguard Workerendif() 981*77c1e3ccSAndroid Build Coastguard Worker 982*77c1e3ccSAndroid Build Coastguard Worker# Libaom_srcs.txt generation. 983*77c1e3ccSAndroid Build Coastguard Workerset(libaom_srcs_txt_file "${AOM_CONFIG_DIR}/libaom_srcs.txt") 984*77c1e3ccSAndroid Build Coastguard Workerfile(WRITE "${libaom_srcs_txt_file}" "# This file is generated. DO NOT EDIT.\n") 985*77c1e3ccSAndroid Build Coastguard Worker 986*77c1e3ccSAndroid Build Coastguard Worker# Static source file list first. 987*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_source_var ${aom_source_vars}) 988*77c1e3ccSAndroid Build Coastguard Worker foreach(file ${${aom_source_var}}) 989*77c1e3ccSAndroid Build Coastguard Worker if(NOT "${file}" MATCHES "${AOM_CONFIG_DIR}") 990*77c1e3ccSAndroid Build Coastguard Worker string(REPLACE "${AOM_ROOT}/" "" file "${file}") 991*77c1e3ccSAndroid Build Coastguard Worker if(NOT CONFIG_AV1_DECODER AND "${file}" MATCHES "aom_decoder") 992*77c1e3ccSAndroid Build Coastguard Worker continue() 993*77c1e3ccSAndroid Build Coastguard Worker endif() 994*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_txt_file}" "${file}\n") 995*77c1e3ccSAndroid Build Coastguard Worker endif() 996*77c1e3ccSAndroid Build Coastguard Worker endforeach() 997*77c1e3ccSAndroid Build Coastguard Workerendforeach() 998*77c1e3ccSAndroid Build Coastguard Worker 999*77c1e3ccSAndroid Build Coastguard Workerfile(APPEND "${libaom_srcs_txt_file}" 1000*77c1e3ccSAndroid Build Coastguard Worker "# Files below this line are generated by the libaom build system.\n") 1001*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_source_var ${aom_source_vars}) 1002*77c1e3ccSAndroid Build Coastguard Worker foreach(file ${${aom_source_var}}) 1003*77c1e3ccSAndroid Build Coastguard Worker if("${file}" MATCHES "${AOM_CONFIG_DIR}") 1004*77c1e3ccSAndroid Build Coastguard Worker string(REPLACE "${AOM_CONFIG_DIR}/" "" file "${file}") 1005*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_txt_file}" "${file}\n") 1006*77c1e3ccSAndroid Build Coastguard Worker endif() 1007*77c1e3ccSAndroid Build Coastguard Worker endforeach() 1008*77c1e3ccSAndroid Build Coastguard Workerendforeach() 1009*77c1e3ccSAndroid Build Coastguard Worker 1010*77c1e3ccSAndroid Build Coastguard Worker# Libaom_srcs.gni generation. 1011*77c1e3ccSAndroid Build Coastguard Workerset(libaom_srcs_gni_file "${AOM_CONFIG_DIR}/libaom_srcs.gni") 1012*77c1e3ccSAndroid Build Coastguard Workerfile(WRITE "${libaom_srcs_gni_file}" "# This file is generated. DO NOT EDIT.\n") 1013*77c1e3ccSAndroid Build Coastguard Worker 1014*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_source_var ${aom_source_vars}) 1015*77c1e3ccSAndroid Build Coastguard Worker if("${${aom_source_var}}" MATCHES "${AOM_ROOT}") 1016*77c1e3ccSAndroid Build Coastguard Worker string(TOLOWER ${aom_source_var} aom_source_var_lowercase) 1017*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" "\n${aom_source_var_lowercase} = [\n") 1018*77c1e3ccSAndroid Build Coastguard Worker endif() 1019*77c1e3ccSAndroid Build Coastguard Worker 1020*77c1e3ccSAndroid Build Coastguard Worker foreach(file ${${aom_source_var}}) 1021*77c1e3ccSAndroid Build Coastguard Worker if(NOT "${file}" MATCHES "${AOM_CONFIG_DIR}") 1022*77c1e3ccSAndroid Build Coastguard Worker string(REPLACE "${AOM_ROOT}" "//third_party/libaom/source/libaom" file 1023*77c1e3ccSAndroid Build Coastguard Worker "${file}") 1024*77c1e3ccSAndroid Build Coastguard Worker if(NOT CONFIG_AV1_DECODER AND "${file}" MATCHES "aom_decoder") 1025*77c1e3ccSAndroid Build Coastguard Worker continue() 1026*77c1e3ccSAndroid Build Coastguard Worker endif() 1027*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n") 1028*77c1e3ccSAndroid Build Coastguard Worker endif() 1029*77c1e3ccSAndroid Build Coastguard Worker endforeach() 1030*77c1e3ccSAndroid Build Coastguard Worker 1031*77c1e3ccSAndroid Build Coastguard Worker if("${${aom_source_var}}" MATCHES "${AOM_ROOT}") 1032*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" "]\n") 1033*77c1e3ccSAndroid Build Coastguard Worker endif() 1034*77c1e3ccSAndroid Build Coastguard Workerendforeach() 1035*77c1e3ccSAndroid Build Coastguard Worker 1036*77c1e3ccSAndroid Build Coastguard Workerfile(APPEND "${libaom_srcs_gni_file}" 1037*77c1e3ccSAndroid Build Coastguard Worker "\n# Files below this line are generated by the libaom build system.\n") 1038*77c1e3ccSAndroid Build Coastguard Worker 1039*77c1e3ccSAndroid Build Coastguard Workerforeach(aom_source_var ${aom_source_vars}) 1040*77c1e3ccSAndroid Build Coastguard Worker if("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}") 1041*77c1e3ccSAndroid Build Coastguard Worker string(TOLOWER ${aom_source_var} aom_source_var_lowercase) 1042*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" 1043*77c1e3ccSAndroid Build Coastguard Worker "\n${aom_source_var_lowercase}_gen = [\n") 1044*77c1e3ccSAndroid Build Coastguard Worker endif() 1045*77c1e3ccSAndroid Build Coastguard Worker foreach(file ${${aom_source_var}}) 1046*77c1e3ccSAndroid Build Coastguard Worker if(NOT "${file}" MATCHES "${AOM_ROOT}") 1047*77c1e3ccSAndroid Build Coastguard Worker string(REPLACE "${AOM_CONFIG_DIR}" "//third_party/libaom/source/libaom" 1048*77c1e3ccSAndroid Build Coastguard Worker file "${file}") 1049*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n") 1050*77c1e3ccSAndroid Build Coastguard Worker endif() 1051*77c1e3ccSAndroid Build Coastguard Worker endforeach() 1052*77c1e3ccSAndroid Build Coastguard Worker 1053*77c1e3ccSAndroid Build Coastguard Worker if("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}") 1054*77c1e3ccSAndroid Build Coastguard Worker file(APPEND "${libaom_srcs_gni_file}" "]\n") 1055*77c1e3ccSAndroid Build Coastguard Worker endif() 1056*77c1e3ccSAndroid Build Coastguard Workerendforeach() 1057*77c1e3ccSAndroid Build Coastguard Worker 1058*77c1e3ccSAndroid Build Coastguard Worker# Generate aom.pc and setup install rule. 1059*77c1e3ccSAndroid Build Coastguard Workersetup_aom_install_targets() 1060