1# 2# Copyright (c) 2017, Alliance for Open Media. All rights reserved. 3# 4# This source code is subject to the terms of the BSD 2 Clause License and the 5# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was 6# not distributed with this source code in the LICENSE file, you can obtain it 7# at www.aomedia.org/license/software. If the Alliance for Open Media Patent 8# License 1.0 was not distributed with this source code in the PATENTS file, you 9# can obtain it at www.aomedia.org/license/patent. 10# 11if(AOM_AOM_PORTS_AOM_PORTS_CMAKE_) 12 return() 13endif() # AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 14set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1) 15 16list(APPEND AOM_PORTS_INCLUDES "${AOM_ROOT}/aom_ports/aom_once.h" 17 "${AOM_ROOT}/aom_ports/aom_timer.h" "${AOM_ROOT}/aom_ports/bitops.h" 18 "${AOM_ROOT}/aom_ports/emmintrin_compat.h" 19 "${AOM_ROOT}/aom_ports/mem.h" "${AOM_ROOT}/aom_ports/mem_ops.h" 20 "${AOM_ROOT}/aom_ports/mem_ops_aligned.h" 21 "${AOM_ROOT}/aom_ports/sanitizer.h") 22 23list(APPEND AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/float.asm") 24 25list(APPEND AOM_PORTS_INCLUDES_X86 "${AOM_ROOT}/aom_ports/x86_abi_support.asm") 26 27list(APPEND AOM_PORTS_SOURCES_AARCH32 28 "${AOM_ROOT}/aom_ports/aarch32_cpudetect.c") 29list(APPEND AOM_PORTS_SOURCES_AARCH64 30 "${AOM_ROOT}/aom_ports/aarch64_cpudetect.c") 31 32if(CONFIG_RUNTIME_CPU_DETECT AND ANDROID_NDK) 33 include_directories(${ANDROID_NDK}/sources/android/cpufeatures) 34 list(APPEND AOM_PORTS_SOURCES_ARM 35 "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c") 36endif() 37 38list(APPEND AOM_PORTS_SOURCES_PPC "${AOM_ROOT}/aom_ports/ppc.h" 39 "${AOM_ROOT}/aom_ports/ppc_cpudetect.c") 40 41list(APPEND AOM_PORTS_SOURCES_RISCV "${AOM_ROOT}/aom_ports/riscv.h" 42 "${AOM_ROOT}/aom_ports/riscv_cpudetect.c") 43 44# For arm and x86 targets: 45# 46# * Creates the aom_ports build target, adds the includes in aom_ports to the 47# target, and makes libaom depend on it. 48# 49# Otherwise: 50# 51# * Adds the includes in aom_ports to the libaom target. 52# 53# For all target platforms: 54# 55# * The libaom target must exist before this function is called. 56function(setup_aom_ports_targets) 57 if(XCODE AND "${AOM_TARGET_CPU}" STREQUAL "x86_64") 58 add_asm_library("aom_ports" "AOM_PORTS_ASM_X86") 59 # Xcode is the only one 60 set(aom_ports_is_embedded 1) 61 set(aom_ports_has_symbols 1) 62 elseif(WIN32 AND "${AOM_TARGET_CPU}" STREQUAL "x86_64") 63 add_asm_library("aom_ports" "AOM_PORTS_ASM_X86") 64 set(aom_ports_has_symbols 1) 65 elseif("${AOM_TARGET_CPU}" STREQUAL "arm64") 66 add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_AARCH64}) 67 set(aom_ports_has_symbols 1) 68 elseif("${AOM_TARGET_CPU}" MATCHES "arm") 69 add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_AARCH32}) 70 set(aom_ports_has_symbols 1) 71 elseif("${AOM_TARGET_CPU}" MATCHES "ppc") 72 add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_PPC}) 73 set(aom_ports_has_symbols 1) 74 elseif("${AOM_TARGET_CPU}" MATCHES "riscv") 75 add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_RISCV}) 76 set(aom_ports_has_symbols 1) 77 endif() 78 79 if("${AOM_TARGET_CPU}" MATCHES "arm|ppc|riscv") 80 target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>) 81 if(BUILD_SHARED_LIBS) 82 target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_ports>) 83 endif() 84 endif() 85 86 # Note AOM_PORTS_INCLUDES_X86 are not added to the aom_ports, aom or 87 # aom_static targets to avoid compilation issues in projects that enable ASM 88 # language support in project(). These sources were never included in 89 # libaom_srcs.*; if it becomes necessary for a particular generator another 90 # method should be used. 91 if(aom_ports_has_symbols) 92 if(NOT aom_ports_is_embedded) 93 target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES}) 94 endif() 95 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE) 96 else() 97 target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES}) 98 if(BUILD_SHARED_LIBS) 99 target_sources(aom_static PRIVATE ${AOM_PORTS_INCLUDES}) 100 endif() 101 endif() 102endfunction() 103