Commit 589bae87 authored by Johann's avatar Johann Committed by Johann Koenig

cmake: apply cmake-format

Use cmake-format from:
https://github.com/cheshirekow/cmake_format
to enforce a consistent style.

Extra line breaks to work around:
https://github.com/cheshirekow/cmake_format/issues/33

Upstream bug for overzealous 'if' expansion:
https://github.com/cheshirekow/cmake_format/issues/34

Change-Id: Ib709f06ce37e9b89ddaf3eb0b28612aabbe36aed
parent b8c5832b
# How wide to allow formatted cmake files
line_width = 80
# How many spaces to tab for indent
tab_size = 2
# If arglists are longer than this, break them always. This introduces some
# interesting effects with complicated 'if' statements. However, we want file
# lists to look reasonable. Try to strike a balance.
max_subargs_per_line = 10
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on it's own line
dangle_parens = False
# What character to use for bulleted lists
bullet_char = u'*'
# What character to use as punctuation after numerals in an enumerated list
enum_char = u'.'
# What style line endings to use in the output.
line_ending = u'unix'
# Format command names consistently as 'lower' or 'upper' case
command_case = u'lower'
# Specify structure for custom cmake functions
additional_commands = {
"foo": {
"flags": [
"BAR",
"BAZ"
],
"kwargs": {
"HEADERS": "*",
"DEPENDS": "*",
"SOURCES": "*"
}
}
}
This diff is collapsed.
##
## 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.
##
if (AOM_AOM_MEM_AOM_MEM_CMAKE_)
#
# 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.
#
if(AOM_AOM_MEM_AOM_MEM_CMAKE_)
return()
endif () # AOM_AOM_MEM_AOM_MEM_CMAKE_
endif() # AOM_AOM_MEM_AOM_MEM_CMAKE_
set(AOM_AOM_MEM_AOM_MEM_CMAKE_ 1)
set(AOM_MEM_SOURCES
"${AOM_ROOT}/aom_mem/aom_mem.c"
set(AOM_MEM_SOURCES "${AOM_ROOT}/aom_mem/aom_mem.c"
"${AOM_ROOT}/aom_mem/aom_mem.h"
"${AOM_ROOT}/aom_mem/include/aom_mem_intrnl.h")
# Creates the aom_mem build target and makes libaom depend on it. The libaom
# target must exist before this function is called.
function (setup_aom_mem_targets)
function(setup_aom_mem_targets)
add_library(aom_mem OBJECT ${AOM_MEM_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_mem PARENT_SCOPE)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_mem>)
endfunction ()
endfunction()
##
## 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.
##
if (AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
#
# 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.
#
if(AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
return()
endif () # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
endif() # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
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 "${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_ASM_X86 "${AOM_ROOT}/aom_ports/emms.asm")
set(AOM_PORTS_INCLUDES_X86
"${AOM_ROOT}/aom_ports/x86_abi_support.asm")
set(AOM_PORTS_INCLUDES_X86 "${AOM_ROOT}/aom_ports/x86_abi_support.asm")
set(AOM_PORTS_SOURCES_ARM
"${AOM_ROOT}/aom_ports/arm.h"
set(AOM_PORTS_SOURCES_ARM "${AOM_ROOT}/aom_ports/arm.h"
"${AOM_ROOT}/aom_ports/arm_cpudetect.c")
# For arm and x86 targets:
# Creates the aom_ports build target, adds the includes in aom_ports to the
#
# * 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.
#
# * 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 ("${AOM_TARGET_CPU}" MATCHES "^x86")
#
# * The libaom target must exist before this function is called.
function(setup_aom_ports_targets)
if("${AOM_TARGET_CPU}" MATCHES "^x86")
add_asm_library("aom_ports" "AOM_PORTS_ASM_X86" "aom")
set(aom_ports_has_symbols 1)
elseif ("${AOM_TARGET_CPU}" MATCHES "arm")
elseif("${AOM_TARGET_CPU}" MATCHES "arm")
add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_ARM})
set(aom_ports_has_symbols 1)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
endif ()
endif()
if (aom_ports_has_symbols)
if(aom_ports_has_symbols)
target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES})
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
"${AOM_TARGET_CPU}" STREQUAL "x86_64")
if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL
"x86_64")
target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES_X86})
endif ()
endif()
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
else ()
else()
target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES})
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
"${AOM_TARGET_CPU}" STREQUAL "x86_64")
if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL
"x86_64")
target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES_X86})
endif ()
endif ()
endfunction ()
endif()
endif()
endfunction()
##
## 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.
##
if (AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
#
# 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.
#
if(AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
return()
endif () # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
endif() # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
set(AOM_AOM_SCALE_AOM_SCALE_CMAKE_ 1)
set(AOM_SCALE_SOURCES
"${AOM_ROOT}/aom_scale/aom_scale.h"
set(AOM_SCALE_SOURCES "${AOM_ROOT}/aom_scale/aom_scale.h"
"${AOM_ROOT}/aom_scale/generic/aom_scale.c"
"${AOM_ROOT}/aom_scale/generic/gen_scalers.c"
"${AOM_ROOT}/aom_scale/generic/yv12config.c"
......@@ -26,14 +25,14 @@ set(AOM_SCALE_INTRIN_DSPR2
# Creates the aom_scale build target and makes libaom depend on it. The libaom
# target must exist before this function is called.
function (setup_aom_scale_targets)
function(setup_aom_scale_targets)
add_library(aom_scale OBJECT ${AOM_SCALE_SOURCES})
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_scale>)
if (HAVE_DSPR2)
if(HAVE_DSPR2)
add_intrinsics_object_library("" "dspr2" "aom_scale"
"AOM_SCALE_INTRIN_DSPR2" "aom")
endif ()
endif()
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_scale PARENT_SCOPE)
endfunction ()
endfunction()
##
## 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.
##
if (AOM_AOM_UTIL_AOM_UTIL_CMAKE_)
#
# 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.
#
if(AOM_AOM_UTIL_AOM_UTIL_CMAKE_)
return()
endif () # AOM_AOM_UTIL_AOM_UTIL_CMAKE_
endif() # AOM_AOM_UTIL_AOM_UTIL_CMAKE_
set(AOM_AOM_UTIL_AOM_UTIL_CMAKE_ 1)
set(AOM_UTIL_SOURCES
"${AOM_ROOT}/aom_util/aom_thread.c"
"${AOM_ROOT}/aom_util/aom_thread.h"
"${AOM_ROOT}/aom_util/endian_inl.h"
"${AOM_ROOT}/aom_util/debug_util.c"
"${AOM_ROOT}/aom_util/debug_util.h")
set(AOM_UTIL_SOURCES "${AOM_ROOT}/aom_util/aom_thread.c"
"${AOM_ROOT}/aom_util/aom_thread.h" "${AOM_ROOT}/aom_util/endian_inl.h"
"${AOM_ROOT}/aom_util/debug_util.c" "${AOM_ROOT}/aom_util/debug_util.h")
# Creates the aom_util build target and makes libaom depend on it. The libaom
# target must exist before this function is called.
function (setup_aom_util_targets)
function(setup_aom_util_targets)
add_library(aom_util OBJECT ${AOM_UTIL_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_util PARENT_SCOPE)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_util>)
endfunction ()
endfunction()
This diff is collapsed.
##
## Copyright (c) 2016, 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.
##
#
# Copyright (c) 2016, 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.
#
# Defaults for every libaom configuration variable. Here we add all libaom
# config variables to the cmake variable cache, but omit the FORCE parameter to
# allow users to specify values when executing cmake to generate build files.
......
This diff is collapsed.
##
## 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.
##
if (AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_)
#
# 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.
#
if(AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_)
return()
endif () # AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_
endif() # AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_
set(AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_ 1)
# Adjusts CONFIG_* CMake variables to address conflicts between active AV1
# experiments.
macro (fix_experiment_configs)
macro(fix_experiment_configs)
if (CONFIG_ANALYZER)
if (NOT CONFIG_INSPECTION)
if(CONFIG_ANALYZER)
if(NOT CONFIG_INSPECTION)
change_config_and_warn(CONFIG_INSPECTION 1 CONFIG_ANALYZER)
endif ()
endif ()
endif()
endif()
if (CONFIG_RD_DEBUG)
if(CONFIG_RD_DEBUG)
change_config_and_warn(CONFIG_RD_DEBUG 0 CONFIG_JNT_COMP)
endif()
endmacro ()
endmacro()
This diff is collapsed.
This diff is collapsed.
##
## Copyright (c) 2016, 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.
##
if (AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_)
#
# Copyright (c) 2016, 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.
#
if(AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_)
return()
endif () # AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_
endif() # AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_
set(AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_ 1)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
# CMake passes command line flags like this:
# $compiler $lang_flags $lang_flags_config ...
#
# * $compiler $lang_flags $lang_flags_config ...
#
# To ensure the flags tested here and elsewhere are obeyed a list of active
# build configuration types is built, and flags are applied to the flag strings
# for each configuration currently active for C and CXX builds as determined by
# reading $CMAKE_CONFIGURATION_TYPES and $CMAKE_BUILD_TYPE. When
# $CMAKE_CONFIGURATION_TYPES is non-empty a multi-configuration generator is in
# $CMAKE_CONFIGURATION_TYPES is non-empty a multi- configuration generator is in
# use: currently this includes MSVC and Xcode. For other generators
# $CMAKE_BUILD_TYPE is used. For both cases AOM_<LANG>_CONFIGS is populated with
# CMake string variable names that contain flags for the currently available
......@@ -30,19 +32,19 @@ include(CheckCXXSourceCompiles)
unset(AOM_C_CONFIGS)
unset(AOM_CXX_CONFIGS)
list(LENGTH CMAKE_CONFIGURATION_TYPES num_configs)
if (${num_configs} GREATER 0)
foreach (config ${CMAKE_CONFIGURATION_TYPES})
if(${num_configs} GREATER 0)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
list(APPEND AOM_C_CONFIGS "CMAKE_C_FLAGS_${config}")
list(APPEND AOM_CXX_CONFIGS "CMAKE_CXX_FLAGS_${config}")
list(APPEND AOM_EXE_LINKER_CONFIGS "CMAKE_EXE_LINKER_FLAGS_${config}")
endforeach ()
else ()
endforeach()
else()
string(TOUPPER ${CMAKE_BUILD_TYPE} config)
set(AOM_C_CONFIGS "CMAKE_C_FLAGS_${config}")
set(AOM_CXX_CONFIGS "CMAKE_CXX_FLAGS_${config}")
set(AOM_EXE_LINKER_CONFIGS "CMAKE_EXE_LINKER_FLAGS_${config}")
endif ()
endif()
# The basic main() function used in all compile tests.
set(AOM_C_MAIN "\nint main(void) { return 0; }")
......@@ -57,118 +59,117 @@ set(AOM_CXX_FAILED_TESTS)
function(aom_push_var var new_value)
set(SAVED_${var} ${${var}} PARENT_SCOPE)
set(${var} "${${var}} ${new_value}" PARENT_SCOPE)
endfunction ()
endfunction()
function(aom_pop_var var)
set(var ${SAVED_${var}} PARENT_SCOPE)
unset(SAVED_${var} PARENT_SCOPE)
endfunction ()
endfunction()
# Confirms $test_source compiles and stores $test_name in one of
# $AOM_C_PASSED_TESTS or $AOM_C_FAILED_TESTS depending on out come. When the
# test passes $result_var is set to 1. When it fails $result_var is unset.
# The test is not run if the test name is found in either of the passed or
# failed test variables.
# test passes $result_var is set to 1. When it fails $result_var is unset. The
# test is not run if the test name is found in either of the passed or failed
# test variables.
function(aom_check_c_compiles test_name test_source result_var)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
if(DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
endif()
unset(C_TEST_PASSED CACHE)
unset(C_TEST_FAILED CACHE)
string(FIND "${AOM_C_PASSED_TESTS}" "${test_name}" C_TEST_PASSED)
string(FIND "${AOM_C_FAILED_TESTS}" "${test_name}" C_TEST_FAILED)
if (${C_TEST_PASSED} EQUAL -1 AND ${C_TEST_FAILED} EQUAL -1)
if(${C_TEST_PASSED} EQUAL -1 AND ${C_TEST_FAILED} EQUAL -1)
unset(C_TEST_COMPILED CACHE)
message("Running C compiler test: ${test_name}")
check_c_source_compiles("${test_source} ${AOM_C_MAIN}" C_TEST_COMPILED)
set(${result_var} ${C_TEST_COMPILED} PARENT_SCOPE)
if (C_TEST_COMPILED)
set(AOM_C_PASSED_TESTS "${AOM_C_PASSED_TESTS} ${test_name}" CACHE STRING
"" FORCE)
else ()
set(AOM_C_FAILED_TESTS "${AOM_C_FAILED_TESTS} ${test_name}" CACHE STRING
"" FORCE)
if(C_TEST_COMPILED)
set(AOM_C_PASSED_TESTS "${AOM_C_PASSED_TESTS} ${test_name}"
CACHE STRING "" FORCE)
else()
set(AOM_C_FAILED_TESTS "${AOM_C_FAILED_TESTS} ${test_name}"
CACHE STRING "" FORCE)
message("C Compiler test ${test_name} failed.")
endif ()
elseif (NOT ${C_TEST_PASSED} EQUAL -1)
endif()
elseif(NOT ${C_TEST_PASSED} EQUAL -1)
set(${result_var} 1 PARENT_SCOPE)
else () # ${C_TEST_FAILED} NOT EQUAL -1
else() # ${C_TEST_FAILED} NOT EQUAL -1
unset(${result_var} PARENT_SCOPE)
endif ()
endfunction ()
endif()
endfunction()
# Confirms $test_source compiles and stores $test_name in one of
# $AOM_CXX_PASSED_TESTS or $AOM_CXX_FAILED_TESTS depending on out come. When the
# test passes $result_var is set to 1. When it fails $result_var is unset.
# The test is not run if the test name is found in either of the passed or
# failed test variables.
# test passes $result_var is set to 1. When it fails $result_var is unset. The
# test is not run if the test name is found in either of the passed or failed
# test variables.
function(aom_check_cxx_compiles test_name test_source result_var)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
if(DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
endif()
unset(CXX_TEST_PASSED CACHE)
unset(CXX_TEST_FAILED CACHE)
string(FIND "${AOM_CXX_PASSED_TESTS}" "${test_name}" CXX_TEST_PASSED)
string(FIND "${AOM_CXX_FAILED_TESTS}" "${test_name}" CXX_TEST_FAILED)
if (${CXX_TEST_PASSED} EQUAL -1 AND ${CXX_TEST_FAILED} EQUAL -1)
if(${CXX_TEST_PASSED} EQUAL -1 AND ${CXX_TEST_FAILED} EQUAL -1)
unset(CXX_TEST_COMPILED CACHE)
message("Running CXX compiler test: ${test_name}")
check_cxx_source_compiles("${test_source} ${AOM_CXX_MAIN}"
CXX_TEST_COMPILED)
set(${result_var} ${CXX_TEST_COMPILED} PARENT_SCOPE)
if (CXX_TEST_COMPILED)
set(AOM_CXX_PASSED_TESTS "${AOM_CXX_PASSED_TESTS} ${test_name}" CACHE
STRING "" FORCE)
else ()
set(AOM_CXX_FAILED_TESTS "${AOM_CXX_FAILED_TESTS} ${test_name}" CACHE
STRING "" FORCE)
if(CXX_TEST_COMPILED)
set(AOM_CXX_PASSED_TESTS "${AOM_CXX_PASSED_TESTS} ${test_name}"
CACHE STRING "" FORCE)
else()
set(AOM_CXX_FAILED_TESTS "${AOM_CXX_FAILED_TESTS} ${test_name}"
CACHE STRING "" FORCE)
message("CXX Compiler test ${test_name} failed.")
endif ()
elseif (NOT ${CXX_TEST_PASSED} EQUAL -1)
endif()
elseif(NOT ${CXX_TEST_PASSED} EQUAL -1)
set(${result_var} 1 PARENT_SCOPE)
else () # ${CXX_TEST_FAILED} NOT EQUAL -1
else() # ${CXX_TEST_FAILED} NOT EQUAL -1
unset(${result_var} PARENT_SCOPE)
endif ()
endfunction ()
endif()
endfunction()
# Convenience function that confirms $test_source compiles as C and C++.
# $result_var is set to 1 when both tests are successful, and 0 when one or both
# tests fail.
# Note: This function is intended to be used to write to result variables that
# are expanded via configure_file(). $result_var is set to 1 or 0 to allow
# direct usage of the value in generated source files.
# tests fail. Note: This function is intended to be used to write to result
# variables that are expanded via configure_file(). $result_var is set to 1 or 0
# to allow direct usage of the value in generated source files.
function(aom_check_source_compiles test_name test_source result_var)
unset(C_PASSED)
unset(CXX_PASSED)
aom_check_c_compiles(${test_name} ${test_source} C_PASSED)
aom_check_cxx_compiles(${test_name} ${test_source} CXX_PASSED)
if (C_PASSED AND CXX_PASSED)
if(C_PASSED AND CXX_PASSED)
set(${result_var} 1 PARENT_SCOPE)
else ()
else()
set(${result_var} 0 PARENT_SCOPE)
endif ()
endfunction ()
endif()
endfunction()
# When inline support is detected for the current compiler the supported
# inlining keyword is written to $result in caller scope.
function (aom_get_inline result)
function(aom_get_inline result)
aom_check_source_compiles("inline_check_1"
"static inline void function(void) {}"
HAVE_INLINE_1)
if (HAVE_INLINE_1 EQUAL 1)
if(HAVE_INLINE_1 EQUAL 1)
set(${result} "inline" PARENT_SCOPE)
return()
endif ()
endif()
# Check __inline.
aom_check_source_compiles("inline_check_2"
"static __inline void function(void) {}"
HAVE_INLINE_2)
if (HAVE_INLINE_2 EQUAL 1)
if(HAVE_INLINE_2 EQUAL 1)
set(${result} "__inline" PARENT_SCOPE)
endif ()
endfunction ()
endif()
endfunction()
##
## 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.
##
#
# 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.
#
if ("${AOM_TARGET_CPU}" STREQUAL "arm64")
if("${AOM_TARGET_CPU}" STREQUAL "arm64")
set(ARCH_ARM 1)
set(RTCD_ARCH_ARM "yes")
if (ENABLE_NEON)
if(ENABLE_NEON)
set(HAVE_NEON 1)
set(RTCD_HAVE_NEON "yes")
else ()
else()
set(HAVE_NEON 0)
set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-neon)
endif ()
elseif ("${AOM_TARGET_CPU}" MATCHES "^armv7")
endif()
elseif("${AOM_TARGET_CPU}" MATCHES "^armv7")
set(ARCH_ARM 1)
set(RTCD_ARCH_ARM "yes")
if (ENABLE_NEON)
if(ENABLE_NEON)
set(HAVE_NEON 1)
set(RTCD_HAVE_NEON "yes")
else ()
else()
set(HAVE_NEON 0)
set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-neon)
endif ()
endif()
if (ENABLE_NEON_ASM)
if(ENABLE_NEON_ASM)
set(HAVE_NEON_ASM 1)
set(RTCD_HAVE_NEON_ASM "yes")
else ()
else()
set(HAVE_NEON_ASM 0)
endif ()
set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-neon_asm)
elseif ("${AOM_TARGET_CPU}" MATCHES "^mips")
endif()
set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-neon_asm)
elseif("${AOM_TARGET_CPU}" MATCHES "^mips")
set(ARCH_MIPS 1)
set(RTCD_ARCH_MIPS "yes")
if ("${AOM_TARGET_CPU}" STREQUAL "mips32")
if("${AOM_TARGET_CPU}" STREQUAL "mips32")
set(HAVE_MIPS32 1)
set(RTCD_HAVE_MIPS32 "yes")
elseif ("${AOM_TARGET_CPU}" STREQUAL "mips64")
elseif("${AOM_TARGET_CPU}" STREQUAL "mips64")
set(HAVE_MIPS64 1)
set(RTCD_HAVE_MIPS64 "yes")
endif ()
endif()
# HAVE_DSPR2 is set by mips toolchain files.
if (ENABLE_DSPR2 AND HAVE_DSPR2)
if(ENABLE_DSPR2 AND HAVE_DSPR2)
set(RTCD_HAVE_DSPR2 "yes")
else ()
else()
set(HAVE_DSPR2 0)
set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-dspr2)
endif ()
endif()
# HAVE_MSA is set by mips toolchain files.
if (ENABLE_MSA AND HAVE_MSA)
if(ENABLE_MSA AND HAVE_MSA)
set(RTCD_HAVE_MSA "yes")
else ()
else()
set(HAVE_MSA 0)