blob: e1ffb56f56cafd425b8f5b8f108f292596075ce6 [file] [log] [blame]
Tom Finegan507e2e12017-03-01 19:58:19 -08001##
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
5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6## was not distributed with this source code in the LICENSE file, you can
7## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8## Media Patent License 1.0 was not distributed with this source code in the
9## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10##
Tom Finegan17ccaec2017-05-25 17:47:42 -070011if (NOT AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
12set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
13
Tom Finegan507e2e12017-03-01 19:58:19 -080014set(AOM_PORTS_INCLUDES
15 "${AOM_ROOT}/aom_ports/aom_once.h"
16 "${AOM_ROOT}/aom_ports/aom_timer.h"
17 "${AOM_ROOT}/aom_ports/bitops.h"
18 "${AOM_ROOT}/aom_ports/emmintrin_compat.h"
19 "${AOM_ROOT}/aom_ports/mem.h"
20 "${AOM_ROOT}/aom_ports/mem_ops.h"
21 "${AOM_ROOT}/aom_ports/mem_ops_aligned.h"
22 "${AOM_ROOT}/aom_ports/msvc.h"
23 "${AOM_ROOT}/aom_ports/system_state.h")
24
Tom Finegan67a7d9f2017-08-07 17:23:46 -070025set(AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/emms.asm")
26
Tom Finegan507e2e12017-03-01 19:58:19 -080027set(AOM_PORTS_INCLUDES_X86
28 "${AOM_ROOT}/aom_ports/x86_abi_support.asm")
29
Tom Finegan44d2a462017-03-17 09:44:11 -070030set(AOM_PORTS_SOURCES_ARM
31 "${AOM_ROOT}/aom_ports/arm.h"
32 "${AOM_ROOT}/aom_ports/arm_cpudetect.c")
33
Tom Finegan67a7d9f2017-08-07 17:23:46 -070034# For arm and x86 targets:
Tom Finegan507e2e12017-03-01 19:58:19 -080035# Creates the aom_ports build target, adds the includes in aom_ports to the
36# target, and makes libaom depend on it.
37# Otherwise:
38# Adds the includes in aom_ports to the libaom target.
39# For all target platforms:
40# The libaom target must exist before this function is called.
41function (setup_aom_ports_targets)
Tom Finegan67a7d9f2017-08-07 17:23:46 -070042 if ("${AOM_TARGET_CPU}" MATCHES "^x86")
43 add_asm_library("aom_ports" "AOM_PORTS_ASM_X86" "aom")
Tom Finegan507e2e12017-03-01 19:58:19 -080044 set(aom_ports_has_symbols 1)
Tom Finegan44d2a462017-03-17 09:44:11 -070045 elseif ("${AOM_TARGET_CPU}" MATCHES "arm")
Tom Finegan78516fc2017-06-20 10:46:26 -070046 add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_ARM})
Tom Finegan44d2a462017-03-17 09:44:11 -070047 set(aom_ports_has_symbols 1)
Tom Finegan78516fc2017-06-20 10:46:26 -070048 target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
Tom Finegan507e2e12017-03-01 19:58:19 -080049 endif ()
50
51 if (aom_ports_has_symbols)
Tom Finegan84f2d792017-06-15 23:06:44 -070052 target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES})
Tom Finegan507e2e12017-03-01 19:58:19 -080053
54 if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
55 "${AOM_TARGET_CPU}" STREQUAL "x86_64")
Tom Finegan84f2d792017-06-15 23:06:44 -070056 target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES_X86})
Tom Finegan507e2e12017-03-01 19:58:19 -080057 endif ()
58
59 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
60 else ()
Tom Finegan84f2d792017-06-15 23:06:44 -070061 target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES})
Tom Finegan507e2e12017-03-01 19:58:19 -080062
63 if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
64 "${AOM_TARGET_CPU}" STREQUAL "x86_64")
Tom Finegan84f2d792017-06-15 23:06:44 -070065 target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES_X86})
Tom Finegan507e2e12017-03-01 19:58:19 -080066 endif ()
67 endif ()
68endfunction ()
Tom Finegan17ccaec2017-05-25 17:47:42 -070069
70endif () # AOM_AOM_PORTS_AOM_PORTS_CMAKE_