aom_ports.cmake 2.48 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
##
## 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.
##
11
12
13
if (NOT AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)

14
15
16
17
18
19
20
21
22
23
24
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")

25
26
set(AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/emms.asm")

27
28
29
set(AOM_PORTS_INCLUDES_X86
    "${AOM_ROOT}/aom_ports/x86_abi_support.asm")

30
31
32
33
set(AOM_PORTS_SOURCES_ARM
    "${AOM_ROOT}/aom_ports/arm.h"
    "${AOM_ROOT}/aom_ports/arm_cpudetect.c")

34
# For arm and x86 targets:
35
36
37
38
39
40
41
#   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)
42
43
  if ("${AOM_TARGET_CPU}" MATCHES "^x86")
    add_asm_library("aom_ports" "AOM_PORTS_ASM_X86" "aom")
44
    set(aom_ports_has_symbols 1)
45
  elseif ("${AOM_TARGET_CPU}" MATCHES "arm")
46
    add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_ARM})
47
    set(aom_ports_has_symbols 1)
48
    target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
49
50
51
  endif ()

  if (aom_ports_has_symbols)
52
    target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES})
53
54
55

    if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
        "${AOM_TARGET_CPU}" STREQUAL "x86_64")
56
      target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES_X86})
57
58
59
60
    endif ()

    set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
  else ()
61
    target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES})
62
63
64

    if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
        "${AOM_TARGET_CPU}" STREQUAL "x86_64")
65
      target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES_X86})
66
67
68
    endif ()
  endif ()
endfunction ()
69
70

endif ()  # AOM_AOM_PORTS_AOM_PORTS_CMAKE_