summaryrefslogtreecommitdiffstats
path: root/third_party/aom/build/cmake/aom_configure.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/build/cmake/aom_configure.cmake')
-rw-r--r--third_party/aom/build/cmake/aom_configure.cmake298
1 files changed, 122 insertions, 176 deletions
diff --git a/third_party/aom/build/cmake/aom_configure.cmake b/third_party/aom/build/cmake/aom_configure.cmake
index 1c373e589..3553710d3 100644
--- a/third_party/aom/build/cmake/aom_configure.cmake
+++ b/third_party/aom/build/cmake/aom_configure.cmake
@@ -33,9 +33,11 @@ endforeach()
string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)
include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
+include("${AOM_ROOT}/build/cmake/aom_experiment_deps.cmake")
include("${AOM_ROOT}/build/cmake/aom_optimization.cmake")
include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
include("${AOM_ROOT}/build/cmake/compiler_tests.cmake")
+include("${AOM_ROOT}/build/cmake/util.cmake")
# Build a list of all configurable variables.
get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
@@ -45,6 +47,24 @@ foreach (var ${cmake_cache_vars})
endif ()
endforeach ()
+# Adopted experiments get enabled by default. For debugging, make it possible to
+# to turn them all off with a single option.
+if (NOT ENABLE_ADOPTED_EXPERIMENTS)
+ get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
+ unset(var)
+ foreach (var ${cmake_cache_vars})
+ unset(var_helpstring)
+ get_property(var_helpstring CACHE ${var} PROPERTY HELPSTRING)
+ if ("${var_helpstring}" STREQUAL "AV1 experiment flag.")
+ if ("${var}" STREQUAL "CONFIG_CB4X4")
+ # CB4X4 is required and can not be disabled.
+ else ()
+ set(${var} 0)
+ endif ()
+ endif ()
+ endforeach ()
+endif ()
+
# Detect target CPU.
if (NOT AOM_TARGET_CPU)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR
@@ -83,17 +103,28 @@ string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)
message("--- aom_configure: Detected CPU: ${AOM_TARGET_CPU}")
set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME})
-if (BUILD_SHARED_LIBS)
- set(CONFIG_PIC 1)
- set(CONFIG_SHARED 1)
- set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+if ("${CMAKE_BUILD_TYPE}" MATCHES "Deb")
+ set(CONFIG_DEBUG 1)
+endif ()
- if ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux" AND
- "${AOM_TARGET_CPU}" MATCHES "^armv7")
- set(AOM_AS_FLAGS ${AOM_AS_FLAGS} --defsym PIC=1)
- else ()
- set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -DPIC)
+if (NOT MSVC)
+ if (BUILD_SHARED_LIBS)
+ set(CONFIG_PIC 1)
+ set(CONFIG_SHARED 1)
+ set(CONFIG_STATIC 0)
+ endif ()
+
+ if (CONFIG_PIC)
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+ if ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux" AND
+ "${AOM_TARGET_CPU}" MATCHES "^armv7")
+ set(AOM_AS_FLAGS ${AOM_AS_FLAGS} --defsym PIC=1)
+ else ()
+ set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -DPIC)
+ endif ()
endif ()
+else ()
+ set(CONFIG_MSVS 1)
endif ()
if (NOT "${AOM_SUPPORTED_CPU_TARGETS}" MATCHES "${AOM_TARGET_CPU}")
@@ -112,8 +143,9 @@ if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
endif ()
if (NOT AS_EXECUTABLE)
- message(FATAL_ERROR "Unable to find yasm. To build without optimizations, "
- "add -DAOM_TARGET_CPU=generic to your cmake command line.")
+ message(FATAL_ERROR "Unable to find assembler. To build without "
+ "optimizations, add -DAOM_TARGET_CPU=generic to your cmake command "
+ "line.")
endif ()
get_asm_obj_format("objformat")
set(AOM_AS_FLAGS -f ${objformat} ${AOM_AS_FLAGS})
@@ -134,26 +166,71 @@ elseif ("${AOM_TARGET_CPU}" MATCHES "arm")
string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
endif ()
+if (CONFIG_ANALYZER)
+ find_package(wxWidgets REQUIRED adv base core)
+ include(${wxWidgets_USE_FILE})
+endif ()
+
+if (NOT MSVC AND CMAKE_C_COMPILER_ID MATCHES "GNU\|Clang")
+ set(CONFIG_GCC 1)
+endif ()
+
+if (CONFIG_GCOV)
+ message("--- Testing for CONFIG_GCOV support.")
+ require_linker_flag("-fprofile-arcs -ftest-coverage")
+ require_compiler_flag("-fprofile-arcs -ftest-coverage" YES)
+endif ()
+
+if (CONFIG_GPROF)
+ message("--- Testing for CONFIG_GPROF support.")
+ require_compiler_flag("-pg" YES)
+endif ()
+
+if ("${AOM_TARGET_SYSTEM}" MATCHES "Darwin\|Linux\|Windows")
+ set(CONFIG_OS_SUPPORT 1)
+endif ()
+
+################################################################################
+# Fix CONFIG_* dependencies. This must be done before including cpu.cmake to
+# ensure RTCD_CONFIG_* are properly set.
+fix_experiment_configs()
+
+# Test compiler support.
+aom_get_inline("INLINE")
+
+# TODO(tomfinegan): aom_ports_check is legacy; HAVE_AOM_PORTS is not used
+# anywhere in the aom sources. To be removed after parity with the legacy
+# build system stops being important.
+aom_check_source_compiles("aom_ports_check"
+ "#include \"${AOM_ROOT}/aom/aom_integer.h\""
+ HAVE_AOM_PORTS)
+aom_check_source_compiles("pthread_check" "#include <pthread.h>" HAVE_PTHREAD_H)
+aom_check_source_compiles("unistd_check" "#include <unistd.h>" HAVE_UNISTD_H)
+
+if (NOT MSVC)
+ aom_push_var(CMAKE_REQUIRED_LIBRARIES "m")
+ aom_check_c_compiles("fenv_check"
+ "#define _GNU_SOURCE
+ #include <fenv.h>
+ void unused(void) {
+ (void)unused;
+ (void)feenableexcept(FE_DIVBYZERO | FE_INVALID);
+ }" HAVE_FEXCEPT)
+ aom_pop_var(CMAKE_REQUIRED_LIBRARIES)
+endif()
+
include("${AOM_ROOT}/build/cmake/cpu.cmake")
if (ENABLE_CCACHE)
- find_program(CCACHE "ccache")
- if (NOT "${CCACHE}" STREQUAL "")
- set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}")
- set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}")
- else ()
- message("--- Cannot find ccache, ENABLE_CCACHE ignored.")
- endif ()
+ set_compiler_launcher(ENABLE_CCACHE ccache)
endif ()
if (ENABLE_DISTCC)
- find_program(DISTCC "distcc")
- if (NOT "${DISTCC}" STREQUAL "")
- set(CMAKE_C_COMPILER_LAUNCHER "${DISTCC}")
- set(CMAKE_CXX_COMPILER_LAUNCHER "${DISTCC}")
- else ()
- message("--- Cannot find distcc, ENABLE_DISTCC ignored.")
- endif ()
+ set_compiler_launcher(ENABLE_DISTCC distcc)
+endif ()
+
+if (ENABLE_GOMA)
+ set_compiler_launcher(ENABLE_GOMA gomacc)
endif ()
if (NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER)
@@ -175,8 +252,10 @@ else ()
add_compiler_flag_if_supported("-Wextra")
add_compiler_flag_if_supported("-Wfloat-conversion")
add_compiler_flag_if_supported("-Wimplicit-function-declaration")
+ add_compiler_flag_if_supported("-Wlogical-op")
add_compiler_flag_if_supported("-Wpointer-arith")
add_compiler_flag_if_supported("-Wsign-compare")
+ add_compiler_flag_if_supported("-Wstack-usage=320000")
add_compiler_flag_if_supported("-Wstring-conversion")
add_compiler_flag_if_supported("-Wtype-limits")
add_compiler_flag_if_supported("-Wuninitialized")
@@ -199,10 +278,6 @@ else ()
# to the existing configure/make build system.
add_compiler_flag_if_supported("-Wno-unused-function")
- if (CMAKE_C_COMPILER_ID MATCHES "GNU\|Clang")
- set(CONFIG_GCC 1)
- endif ()
-
if ("${CMAKE_BUILD_TYPE}" MATCHES "Rel")
add_compiler_flag_if_supported("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0")
endif ()
@@ -210,86 +285,6 @@ else ()
add_compiler_flag_if_supported("-D_FILE_OFFSET_BITS=64")
endif ()
-if ("${AOM_TARGET_SYSTEM}" MATCHES "Darwin\|Linux\|Windows")
- set(CONFIG_OS_SUPPORT 1)
-endif ()
-
-# Test compiler support.
-aom_get_inline("INLINE")
-
-# TODO(tomfinegan): aom_ports_check is legacy; HAVE_AOM_PORTS is not used
-# anywhere in the aom sources. To be removed after parity with the legacy
-# build system stops being important.
-aom_check_source_compiles("aom_ports_check"
- "#include \"${AOM_ROOT}/aom/aom_integer.h\""
- HAVE_AOM_PORTS)
-aom_check_source_compiles("pthread_check" "#include <pthread.h>" HAVE_PTHREAD_H)
-aom_check_source_compiles("unistd_check" "#include <unistd.h>" HAVE_UNISTD_H)
-
-if (CONFIG_ANALYZER)
- find_package(wxWidgets REQUIRED adv base core)
- include(${wxWidgets_USE_FILE})
-
- if (NOT CONFIG_INSPECTION)
- set(CONFIG_INSPECTION 1)
- message(WARNING
- "--- Enabled CONFIG_INSPECTION, required for CONFIG_ANALYZER.")
- endif ()
-endif ()
-
-if (CONFIG_VAR_TX_NO_TX_MODE AND NOT CONFIG_VAR_TX)
- message(WARNING
- "--- CONFIG_VAR_TX_NO_TX_MODE requires CONFIG_VAR_TX, disabling.")
- set(CONFIG_VAR_TX_NO_TX_MODE 0)
-endif()
-
-if (CONFIG_DAALA_DCT4)
- if (NOT CONFIG_DCT_ONLY)
- message(WARNING
- "--- Enabled CONFIG_DCT_ONLY, needed for CONFIG_DAALA_DCT4.")
- set(CONFIG_DCT_ONLY 1)
- endif()
-endif()
-
-if (CONFIG_DAALA_DCT4 OR CONFIG_DAALA_DCT8)
- if (HAVE_MMX)
- message(WARNING
- "--- Disabled HAVE_MMX, incompatible with CONFIG_DAALA_DCTx.")
- set(HAVE_MMX 0)
- endif()
- if (CONFIG_RECT_TX)
- message(WARNING
- "--- Disabled CONFIG_RECT_TX, incompatible with CONFIG_DAALA_DCTx.")
- set(CONFIG_RECT_TX 0)
- endif()
- if (CONFIG_VAR_TX)
- message(WARNING
- "--- Disabled CONFIG_VAR_TX, incompatible with CONFIG_DAALA_DCTx.")
- set(CONFIG_VAR_TX 0)
- endif()
- if (CONFIG_LGT)
- message(WARNING
- "--- Disabled CONFIG_LGT, incompatible with CONFIG_DAALA_DCTx.")
- set(CONFIG_LGT 0)
- endif()
- if (NOT CONFIG_LOWBITDEPTH)
- message(WARNING
- "--- Enabled CONFIG_LOWBITDEPTH, needed for CONFIG_DAALA_DCTx.")
- set(CONFIG_LOWBITDEPTH 1)
- endif()
-endif()
-
-if (NOT MSVC)
- aom_push_var(CMAKE_REQUIRED_LIBRARIES "m")
- aom_check_c_compiles("fenv_check"
- "#define _GNU_SOURCE
- #include <fenv.h>
- void unused(void) {
- (void)feenableexcept(FE_DIVBYZERO | FE_INVALID);
- }" HAVE_FEXCEPT)
- aom_pop_var(CMAKE_REQUIRED_LIBRARIES)
-endif()
-
set(AOM_LIB_LINK_TYPE PUBLIC)
if (EMSCRIPTEN)
# Avoid CMake generation time errors resulting from collisions with the form
@@ -311,19 +306,8 @@ configure_file("${aom_config_h_template}" "${AOM_CONFIG_DIR}/aom_config.h")
# Read the current git hash.
find_package(Git)
-set(AOM_GIT_DESCRIPTION)
-set(AOM_GIT_HASH)
-if (GIT_FOUND)
- # TODO(tomfinegan): Add build rule so users don't have to re-run cmake to
- # create accurately versioned cmake builds.
- execute_process(COMMAND ${GIT_EXECUTABLE}
- --git-dir=${AOM_ROOT}/.git rev-parse HEAD
- OUTPUT_VARIABLE AOM_GIT_HASH)
- execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${AOM_ROOT}/.git describe
- OUTPUT_VARIABLE AOM_GIT_DESCRIPTION ERROR_QUIET)
- # Consume the newline at the end of the git output.
- string(STRIP "${AOM_GIT_HASH}" AOM_GIT_HASH)
- string(STRIP "${AOM_GIT_DESCRIPTION}" AOM_GIT_DESCRIPTION)
+if (NOT GIT_FOUND)
+ message("--- Git missing, version will be read from CHANGELOG.")
endif ()
configure_file("${AOM_ROOT}/build/cmake/aom_config.c.cmake"
@@ -367,64 +351,26 @@ foreach(NUM RANGE ${AOM_RTCD_CUSTOM_COMMAND_COUNT})
OUTPUT_FILE ${AOM_RTCD_HEADER_FILE})
endforeach()
-function (add_rtcd_build_step config output source symbol)
- add_custom_command(
- OUTPUT ${output}
- COMMAND ${PERL_EXECUTABLE}
- ARGS "${AOM_ROOT}/build/make/rtcd.pl"
- --arch=${AOM_TARGET_CPU}
- --sym=${symbol}
- ${AOM_RTCD_FLAGS}
- --config=${AOM_CONFIG_DIR}/${AOM_TARGET_CPU}_rtcd_config.rtcd
- ${config}
- > ${output}
- DEPENDS ${config}
- COMMENT "Generating ${output}"
- WORKING_DIRECTORY ${AOM_CONFIG_DIR}
- VERBATIM)
- set_property(SOURCE ${source} PROPERTY OBJECT_DEPENDS ${output})
- set_property(SOURCE ${output} PROPERTY GENERATED)
-endfunction ()
-
# Generate aom_version.h.
-if ("${AOM_GIT_DESCRIPTION}" STREQUAL "")
- set(AOM_GIT_DESCRIPTION "${AOM_ROOT}/CHANGELOG")
-endif ()
execute_process(
- COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/aom_version.pl"
- --version_data=${AOM_GIT_DESCRIPTION}
- --version_filename=${AOM_CONFIG_DIR}/aom_version.h)
+ COMMAND ${CMAKE_COMMAND}
+ -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
+ -DAOM_ROOT=${AOM_ROOT}
+ -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
+ -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
+ -P "${AOM_ROOT}/build/cmake/version.cmake")
-# Generate aom.pc (pkg-config file).
if (NOT MSVC)
- # Extract the version string from aom_version.h
- file(STRINGS "${AOM_CONFIG_DIR}/aom_version.h" aom_version
- REGEX "VERSION_STRING_NOSP")
- string(REPLACE "#define VERSION_STRING_NOSP \"v" "" aom_version
- "${aom_version}")
- string(REPLACE "\"" "" aom_version "${aom_version}")
-
- # Write pkg-config info.
- set(prefix "${CMAKE_INSTALL_PREFIX}")
- set(pkgconfig_file "${AOM_CONFIG_DIR}/aom.pc")
- string(TOLOWER ${CMAKE_PROJECT_NAME} pkg_name)
- file(WRITE "${pkgconfig_file}" "# libaom pkg-config.\n")
- file(APPEND "${pkgconfig_file}" "prefix=${prefix}\n")
- file(APPEND "${pkgconfig_file}" "exec_prefix=${prefix}/bin\n")
- file(APPEND "${pkgconfig_file}" "libdir=${prefix}/lib\n")
- file(APPEND "${pkgconfig_file}" "includedir=${prefix}/include\n\n")
- file(APPEND "${pkgconfig_file}" "Name: ${pkg_name}\n")
- file(APPEND "${pkgconfig_file}" "Description: AV1 codec library.\n")
- file(APPEND "${pkgconfig_file}" "Version: ${aom_version}\n")
- file(APPEND "${pkgconfig_file}" "Requires:\n")
- file(APPEND "${pkgconfig_file}" "Conflicts:\n")
- file(APPEND "${pkgconfig_file}" "Libs: -L${prefix}/lib -l${pkg_name} -lm\n")
- if (CONFIG_MULTITHREAD AND HAVE_PTHREAD_H)
- file(APPEND "${pkgconfig_file}" "Libs.private: -lm -lpthread\n")
- else ()
- file(APPEND "${pkgconfig_file}" "Libs.private: -lm\n")
- endif ()
- file(APPEND "${pkgconfig_file}" "Cflags: -I${prefix}/include\n")
+ # Generate aom.pc (pkg-config file).
+ execute_process(
+ COMMAND ${CMAKE_COMMAND}
+ -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
+ -DAOM_ROOT=${AOM_ROOT}
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ -DCMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}
+ -DCONFIG_MULTITHREAD=${CONFIG_MULTITHREAD}
+ -DHAVE_PTHREAD_H=${HAVE_PTHREAD_H}
+ -P "${AOM_ROOT}/build/cmake/pkg_config.cmake")
endif ()
endif () # AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_