Move aom_ports build commands into aom_ports/aom_ports.cmake. - Stop abuse of the aom_util target to expose aom_ports includes to IDEs. - Create aom_ports target only on appropriate platforms. - Otherwise add the include only sources to the libaom target (aka abuse the libaom target instead of the aom_util target). BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76 Change-Id: I82a27a0fc2d6ab13ea273726a4777e21ebdbd247
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3381389..13d2ccd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ include("${AOM_ROOT}/build/cmake/aom_optimization.cmake") include("${AOM_ROOT}/aom_dsp/aom_dsp.cmake") include("${AOM_ROOT}/aom_mem/aom_mem.cmake") +include("${AOM_ROOT}/aom_ports/aom_ports.cmake") include("${AOM_ROOT}/av1/av1.cmake") include("${AOM_ROOT}/test/test.cmake") @@ -106,15 +107,6 @@ "${AOM_ROOT}/aom_scale/yv12config.h") set(AOM_UTIL_SOURCES - "${AOM_ROOT}/aom_ports/aom_once.h" - "${AOM_ROOT}/aom_ports/aom_timer.h" - "${AOM_ROOT}/aom_ports/bitops.h" - "${AOM_ROOT}/aom_ports/emmintrin_compat.h" - "${AOM_ROOT}/aom_ports/mem.h" - "${AOM_ROOT}/aom_ports/mem_ops.h" - "${AOM_ROOT}/aom_ports/mem_ops_aligned.h" - "${AOM_ROOT}/aom_ports/msvc.h" - "${AOM_ROOT}/aom_ports/system_state.h" "${AOM_ROOT}/aom_util/aom_thread.c" "${AOM_ROOT}/aom_util/aom_thread.h" "${AOM_ROOT}/aom_util/endian_inl.h") @@ -161,11 +153,6 @@ "${AOM_ROOT}/webmenc.cc" "${AOM_ROOT}/webmenc.h") -set(AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/x86_abi_support.asm") -set(AOM_PORTS_ASM_MMX "${AOM_ROOT}/aom_ports/emms.asm") - - - include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR}) # Targets @@ -197,19 +184,10 @@ set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_rtcd aom_util aom_encoder_stats aom_mem aom_scale aom) -# -# Assembly and intrinsic targets. -# -if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64") - add_asm_library("aom_util_x86" "AOM_PORTS_ASM_X86" "aom") -endif () - -if (HAVE_MMX) - add_asm_library("aom_util_mmx" "AOM_PORTS_ASM_MMX" "aom") -endif () - +# Setup dependencies. setup_aom_dsp_targets() setup_aom_mem_targets() +setup_aom_ports_targets() setup_av1_targets() # Make all library targets depend on aom_rtcd to make sure it builds first.
diff --git a/aom_ports/aom_ports.cmake b/aom_ports/aom_ports.cmake new file mode 100644 index 0000000..5f67eab --- /dev/null +++ b/aom_ports/aom_ports.cmake
@@ -0,0 +1,57 @@ +## +## Copyright (c) 2017, Alliance for Open Media. All rights reserved +## +## This source code is subject to the terms of the BSD 2 Clause License and +## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License +## was not distributed with this source code in the LICENSE file, you can +## obtain it at www.aomedia.org/license/software. If the Alliance for Open +## Media Patent License 1.0 was not distributed with this source code in the +## PATENTS file, you can obtain it at www.aomedia.org/license/patent. +## +set(AOM_PORTS_INCLUDES + "${AOM_ROOT}/aom_ports/aom_once.h" + "${AOM_ROOT}/aom_ports/aom_timer.h" + "${AOM_ROOT}/aom_ports/bitops.h" + "${AOM_ROOT}/aom_ports/emmintrin_compat.h" + "${AOM_ROOT}/aom_ports/mem.h" + "${AOM_ROOT}/aom_ports/mem_ops.h" + "${AOM_ROOT}/aom_ports/mem_ops_aligned.h" + "${AOM_ROOT}/aom_ports/msvc.h" + "${AOM_ROOT}/aom_ports/system_state.h") + +set(AOM_PORTS_INCLUDES_X86 + "${AOM_ROOT}/aom_ports/x86_abi_support.asm") + +set(AOM_PORTS_ASM_MMX "${AOM_ROOT}/aom_ports/emms.asm") + +# For targets where HAVE_MMX is true: +# Creates the aom_ports build target, adds the includes in aom_ports to the +# target, and makes libaom depend on it. +# Otherwise: +# Adds the includes in aom_ports to the libaom target. +# For all target platforms: +# The libaom target must exist before this function is called. +function (setup_aom_ports_targets) + if (HAVE_MMX) + add_asm_library("aom_ports" "AOM_PORTS_ASM_MMX" "aom") + set(aom_ports_has_symbols 1) + endif () + + if (aom_ports_has_symbols) + target_sources(aom_ports PUBLIC ${AOM_PORTS_INCLUDES}) + + if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR + "${AOM_TARGET_CPU}" STREQUAL "x86_64") + target_sources(aom_ports PUBLIC ${AOM_PORTS_INCLUDES_X86}) + endif () + + set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE) + else () + target_sources(aom PUBLIC ${AOM_PORTS_INCLUDES}) + + if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR + "${AOM_TARGET_CPU}" STREQUAL "x86_64") + target_sources(aom PUBLIC ${AOM_PORTS_INCLUDES_X86}) + endif () + endif () +endfunction ()