hadamard: Add 4x4 test.
[aom.git] / aom_ports / aom_ports.cmake
blobb4cceb78a2f63144d1207884f980c04e95cf3d02
2 # Copyright (c) 2017, Alliance for Open Media. All rights reserved
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.
11 if(AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
12   return()
13 endif() # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
14 set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
16 list(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/msvc.h" "${AOM_ROOT}/aom_ports/sanitizer.h")
23 list(APPEND AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/float.asm")
25 list(APPEND AOM_PORTS_INCLUDES_X86 "${AOM_ROOT}/aom_ports/x86_abi_support.asm")
27 list(APPEND AOM_PORTS_SOURCES_ARM "${AOM_ROOT}/aom_ports/arm.h"
28             "${AOM_ROOT}/aom_ports/arm_cpudetect.c")
30 list(APPEND AOM_PORTS_SOURCES_PPC "${AOM_ROOT}/aom_ports/ppc.h"
31             "${AOM_ROOT}/aom_ports/ppc_cpudetect.c")
33 # For arm and x86 targets:
35 # * Creates the aom_ports build target, adds the includes in aom_ports to the
36 #   target, and makes libaom depend on it.
38 # Otherwise:
40 # * Adds the includes in aom_ports to the libaom target.
42 # For all target platforms:
44 # * The libaom target must exist before this function is called.
45 function(setup_aom_ports_targets)
46   if(WIN32 AND "${AOM_TARGET_CPU}" STREQUAL "x86_64")
47     add_asm_library("aom_ports" "AOM_PORTS_ASM_X86")
48     set(aom_ports_has_symbols 1)
49   elseif("${AOM_TARGET_CPU}" MATCHES "arm")
50     add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_ARM})
51     set(aom_ports_has_symbols 1)
52   elseif("${AOM_TARGET_CPU}" MATCHES "ppc")
53     add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_PPC})
54     set(aom_ports_has_symbols 1)
55   endif()
57   if("${AOM_TARGET_CPU}" MATCHES "arm|ppc")
58     target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
59     if(BUILD_SHARED_LIBS)
60       target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_ports>)
61     endif()
62   endif()
64   # Note AOM_PORTS_INCLUDES_X86 are not added to the aom_ports, aom or
65   # aom_static targets to avoid compilation issues in projects that enable ASM
66   # language support in project(). These sources were never included in
67   # libaom_srcs.*; if it becomes necessary for a particular generator another
68   # method should be used.
69   if(aom_ports_has_symbols)
70     target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES})
71     set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
72   else()
73     target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES})
74     if(BUILD_SHARED_LIBS)
75       target_sources(aom_static PRIVATE ${AOM_PORTS_INCLUDES})
76     endif()
77   endif()
78 endfunction()