summaryrefslogtreecommitdiffstats
path: root/third_party/aom/build
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/build')
-rw-r--r--third_party/aom/build/cmake/aom_config.c.cmake2
-rw-r--r--third_party/aom/build/cmake/aom_config_defaults.cmake316
-rw-r--r--third_party/aom/build/cmake/aom_configure.cmake298
-rw-r--r--third_party/aom/build/cmake/aom_experiment_deps.cmake139
-rw-r--r--third_party/aom/build/cmake/aom_optimization.cmake23
-rw-r--r--third_party/aom/build/cmake/compiler_flags.cmake346
-rw-r--r--third_party/aom/build/cmake/compiler_tests.cmake46
-rw-r--r--third_party/aom/build/cmake/dist.cmake32
-rw-r--r--third_party/aom/build/cmake/pkg_config.cmake57
-rw-r--r--third_party/aom/build/cmake/sanitizers.cmake29
-rw-r--r--third_party/aom/build/cmake/toolchains/mips32-linux-gcc.cmake6
-rw-r--r--third_party/aom/build/cmake/toolchains/mips64-linux-gcc.cmake6
-rw-r--r--third_party/aom/build/cmake/toolchains/x86-linux.cmake5
-rw-r--r--third_party/aom/build/cmake/toolchains/x86-mingw-gcc.cmake29
-rw-r--r--third_party/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake27
-rw-r--r--third_party/aom/build/cmake/util.cmake56
-rw-r--r--third_party/aom/build/cmake/version.cmake55
-rwxr-xr-xthird_party/aom/build/cmake/version.pl (renamed from third_party/aom/build/cmake/aom_version.pl)18
18 files changed, 1045 insertions, 445 deletions
diff --git a/third_party/aom/build/cmake/aom_config.c.cmake b/third_party/aom/build/cmake/aom_config.c.cmake
index 70bf95037..62f0a10ab 100644
--- a/third_party/aom/build/cmake/aom_config.c.cmake
+++ b/third_party/aom/build/cmake/aom_config.c.cmake
@@ -10,6 +10,4 @@
*/
#include "aom/aom_codec.h"
static const char* const cfg = "${AOM_CMAKE_CONFIG}";
-static const char* const aom_git_hash = "${AOM_GIT_HASH}";
const char *aom_codec_build_config(void) {return cfg;}
-const char *aom_codec_git_hash(void) {return aom_git_hash;}
diff --git a/third_party/aom/build/cmake/aom_config_defaults.cmake b/third_party/aom/build/cmake/aom_config_defaults.cmake
index abdae1d66..488401be1 100644
--- a/third_party/aom/build/cmake/aom_config_defaults.cmake
+++ b/third_party/aom/build/cmake/aom_config_defaults.cmake
@@ -8,170 +8,208 @@
## 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.
# Values here are used only if not set by the user.
-set(RESTRICT "" CACHE STRING "Sets RESTRICT value for current target.")
set(INLINE "" CACHE STRING "Sets INLINE value for current target.")
+set(RESTRICT "" CACHE STRING "Sets RESTRICT value for current target.")
+
+# CPUs.
set(ARCH_ARM 0 CACHE NUMBER "Enables ARM architecture.")
set(ARCH_MIPS 0 CACHE NUMBER "Enables MIPS architecture.")
set(ARCH_X86 0 CACHE NUMBER "Enables X86 architecture.")
set(ARCH_X86_64 0 CACHE NUMBER "Enables X86_64 architecture.")
-set(HAVE_EDSP 0 CACHE NUMBER "Enables EDSP optimizations.")
+
+# ARM optimization flags.
set(HAVE_NEON 0 CACHE NUMBER "Enables NEON intrinsics optimizations.")
set(HAVE_NEON_ASM 0 CACHE NUMBER "Enables NEON assembly optimizations.")
-set(HAVE_MIPS32 0 CACHE NUMBER "Enables MIPS32 optimizations.")
+
+# MIPS optimization flags.
set(HAVE_DSPR2 0 CACHE NUMBER "Enables DSPR2 optimizations.")
-set(HAVE_MSA 0 CACHE NUMBER "Enables MSA optimizations.")
+set(HAVE_MIPS32 0 CACHE NUMBER "Enables MIPS32 optimizations.")
set(HAVE_MIPS64 0 CACHE NUMBER "Enables MIPS64 optimizations. ")
+set(HAVE_MSA 0 CACHE NUMBER "Enables MSA optimizations.")
+
+# x86/x86_64 optimization flags.
+set(HAVE_AVX 0 CACHE NUMBER "Enables AVX optimizations.")
+set(HAVE_AVX2 0 CACHE NUMBER "Enables AVX2 optimizations.")
set(HAVE_MMX 0 CACHE NUMBER "Enables MMX optimizations. ")
set(HAVE_SSE 0 CACHE NUMBER "Enables SSE optimizations.")
set(HAVE_SSE2 0 CACHE NUMBER "Enables SSE2 optimizations.")
set(HAVE_SSE3 0 CACHE NUMBER "Enables SSE3 optimizations.")
-set(HAVE_SSSE3 0 CACHE NUMBER "Enables SSSE3 optimizations.")
set(HAVE_SSE4_1 0 CACHE NUMBER "Enables SSE 4.1 optimizations.")
-set(HAVE_AVX 0 CACHE NUMBER "Enables AVX optimizations.")
-set(HAVE_AVX2 0 CACHE NUMBER "Enables AVX2 optimizations.")
+set(HAVE_SSSE3 0 CACHE NUMBER "Enables SSSE3 optimizations.")
+
+# Flags describing the build environment.
set(HAVE_AOM_PORTS 0 CACHE NUMBER "Internal flag, deprecated.")
set(HAVE_FEXCEPT 0 CACHE NUMBER "Internal flag, GNU fenv.h present for target.")
set(HAVE_PTHREAD_H 0 CACHE NUMBER "Internal flag, target pthread support.")
set(HAVE_UNISTD_H 0 CACHE NUMBER "Internal flag, unistd.h present for target.")
set(HAVE_WXWIDGETS 0 CACHE NUMBER "WxWidgets present.")
-set(CONFIG_DEPENDENCY_TRACKING 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXTERNAL_BUILD 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INSTALL_BINS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INSTALL_LIBS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INSTALL_SRCS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DEBUG 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_GPROF 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_GCOV 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_RVCT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_GCC 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_MSVS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_PIC 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_BIG_ENDIAN 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_CODEC_SRCS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DEBUG_LIBS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_RUNTIME_CPU_DETECT 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_POSTPROC 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_MULTITHREAD 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTERNAL_STATS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_AV1_ENCODER 1 CACHE NUMBER "Enable AV1 encoder.")
-set(CONFIG_AV1_DECODER 1 CACHE NUMBER "Enable AV1 decoder.")
+
+# Deprecated flags preserved for compatibility with configure build.
+set(CONFIG_CODEC_SRCS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_DEBUG_LIBS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_DEPENDENCY_TRACKING 1 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_EXPERIMENTAL 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_EXTERNAL_BUILD 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_INSTALL_BINS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_INSTALL_DOCS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_INSTALL_LIBS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_INSTALL_SRCS 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_POSTPROC 1 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_POSTPROC_VISUALIZER 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_RVCT 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_SMALL 0 CACHE NUMBER "Deprecated flag.")
+set(CONFIG_STATIC_MSVCRT 0 CACHE NUMBER "Deprecated flag.")
+
+# Build configuration flags.
set(CONFIG_AV1 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_STATIC_MSVCRT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SPATIAL_RESAMPLING 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_REALTIME_ONLY 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ONTHEFLY_BITPACKING 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ERROR_CONCEALMENT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SHARED 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_STATIC 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_SMALL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_POSTPROC_VISUALIZER 0 CACHE NUMBER "Internal flag.")
+set(CONFIG_AV1_DECODER 1 CACHE NUMBER "Enable AV1 decoder.")
+set(CONFIG_AV1_ENCODER 1 CACHE NUMBER "Enable AV1 encoder.")
+set(CONFIG_BIG_ENDIAN 0 CACHE NUMBER "Internal flag.")
+set(CONFIG_GCC 0 CACHE NUMBER "Building with GCC (detected).")
+set(CONFIG_GCOV 0 CACHE NUMBER "Enable gcov support.")
+set(CONFIG_GPROF 0 CACHE NUMBER "Enable gprof support.")
+set(CONFIG_LIBYUV 1 CACHE NUMBER "Enables libyuv scaling/conversion support.")
+set(CONFIG_MSVS 0 CACHE NUMBER "Building with MS Visual Studio (detected).")
+set(CONFIG_MULTITHREAD 1 CACHE NUMBER "Multithread support.")
set(CONFIG_OS_SUPPORT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_UNIT_TESTS 1 CACHE NUMBER "Internal flag.")
+set(CONFIG_PIC 0 CACHE NUMBER "Build with PIC enabled.")
+set(CONFIG_RUNTIME_CPU_DETECT 1 CACHE NUMBER "Runtime CPU detection support.")
+set(CONFIG_SHARED 0 CACHE NUMBER "Build shared libs.")
+set(CONFIG_STATIC 1 CACHE NUMBER "Build static libs.")
set(CONFIG_WEBM_IO 1 CACHE NUMBER "Enables WebM support.")
-set(CONFIG_LIBYUV 1 CACHE NUMBER "Enables libyuv scaling and conversion support.")
+
+# Debugging flags.
+set(CONFIG_BITSTREAM_DEBUG 0 CACHE NUMBER "Bitstream debugging flag.")
+set(CONFIG_DEBUG 0 CACHE NUMBER "Debug build flag.")
+
+# Testing flags.
+set(CONFIG_DECODE_PERF_TESTS 0 CACHE NUMBER "Enables decoder performance test.")
+set(CONFIG_ENCODE_PERF_TESTS 0 CACHE NUMBER "Enables encoder performance test.")
+set(CONFIG_UNIT_TESTS 1 CACHE NUMBER "Enables unit tests.")
+
+# AV1 feature flags.
set(CONFIG_ACCOUNTING 0 CACHE NUMBER "Enables bit accounting.")
+set(CONFIG_ANALYZER 0 CACHE NUMBER "Enables bit stream analyzer.")
+set(CONFIG_COEFFICIENT_RANGE_CHECKING 0 CACHE NUMBER "Coefficient range check.")
+set(CONFIG_HIGHBITDEPTH 1 CACHE NUMBER "Enables high bit depth support.")
set(CONFIG_INSPECTION 0 CACHE NUMBER "Enables bitstream inspection.")
-set(CONFIG_DECODE_PERF_TESTS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ENCODE_PERF_TESTS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_COEFFICIENT_RANGE_CHECKING 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_LOWBITDEPTH 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_HIGHBITDEPTH 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXPERIMENTAL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SIZE_LIMIT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_FP_MB_STATS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_CDEF 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_VAR_TX 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_RECT_TX 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_RECT_TX_EXT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_TPL_MV 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DUAL_FILTER 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_CONVOLVE_ROUND 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_COMPOUND_ROUND 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_TX 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_DPCM_INTRA 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_TX64X64 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_INTRA 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTRA_INTERP 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_FILTER_INTRA 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTRA_EDGE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTRABC 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_INTER 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTERINTRA 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_WEDGE 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_COMPOUND_SEGMENT 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_REFS 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_SPEED_REFS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_GLOBAL_MOTION 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_NEW_QUANT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SUPERTX 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ANS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_LOOP_RESTORATION 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_PARTITION 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_PARTITION_TYPES 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_UNPOISON_PARTITION_CTX 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_TILE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_MOTION_VAR 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_NCOBMC 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_WARPED_MOTION 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_Q_ADAPT_PROBS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_BITSTREAM_DEBUG 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ALT_INTRA 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_PALETTE 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_PALETTE_DELTA_ENCODING 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_RAWBITS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_EC_SMALLMUL 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_PVQ 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_CFL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_XIPHRC 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_CB4X4 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_CHROMA_2X2 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_CHROMA_SUB8X8 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_FRAME_SIZE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DELTA_Q 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_DELTA_Q 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_ADAPT_SCAN 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_FILTER_7BIT 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_PARALLEL_DEBLOCKING 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_LOOPFILTERING_ACROSS_TILES 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_TEMPMV_SIGNALING 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_RD_DEBUG 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_REFERENCE_BUFFER 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_COEF_INTERLEAVE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ENTROPY_STATS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_MASKED_TX 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DEPENDENT_HORZTILES 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DAALA_DIST 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_TRIPRED 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_PALETTE_THROUGHPUT 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_REF_ADAPT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_LV_MAP 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_TXK_SEL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_MV_COMPRESS 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_FRAME_SUPERRES 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_NEW_MULTISYMBOL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_COMPOUND_SINGLEREF 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_AOM_QM 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ONE_SIDED_COMPOUND 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_EXT_COMP_REFS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SMOOTH_HV 1 CACHE NUMBER "Internal flag.")
-set(CONFIG_VAR_REFS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_RECT_INTRA_PRED 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_LGT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_SBL_SYMBOL 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_NCOBMC_ADAPT_WEIGHT 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_BGSPRITE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_VAR_TX_NO_TX_MODE 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_ANALYZER 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DCT_ONLY 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DAALA_DCT4 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DAALA_DCT8 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_GF_GROUPS 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_MRC_TX 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_INTER_STATS_ONLY 0 CACHE NUMBER "Internal flag.")
-set(CONFIG_DIST_8X8 0 CACHE NUMBER "Internal flag.")
+set(CONFIG_INTERNAL_STATS 0 CACHE NUMBER "Codec stats.")
+set(CONFIG_LOWBITDEPTH 1 CACHE NUMBER "Enables low bit depth support.")
+set(CONFIG_REALTIME_ONLY 0 CACHE NUMBER "Support only realtime encodes.")
+set(CONFIG_SIZE_LIMIT 0 CACHE NUMBER "Limit max decode width/height.")
+set(CONFIG_SPATIAL_RESAMPLING 1 CACHE NUMBER "Spatial resampling.")
+set(CONFIG_SYMBOLRATE 0 CACHE NUMBER "Enables symbol rate accounting.")
+
+# AV1 experiment flags.
+set(CONFIG_ADAPT_SCAN 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_AMVR 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_ANS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_AOM_QM 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_BGSPRITE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CB4X4 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CDEF 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CDEF_SINGLEPASS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CFL 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CHROMA_2X2 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CHROMA_SUB8X8 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_COEF_INTERLEAVE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_COMPOUND_ROUND 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_COMPOUND_SEGMENT 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_COMPOUND_SINGLEREF 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CONVOLVE_ROUND 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_CTX1D 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_DCT16 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_DCT32 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_DCT4 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_DCT64 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_DCT8 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DAALA_TX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DCT_ONLY 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DEBLOCK_13TAP 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DEPENDENT_HORZTILES 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DIST_8X8 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_DUAL_FILTER 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_ENTROPY_STATS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_COMP_REFS 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_DELTA_Q 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_INTRA 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_PARTITION 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_PARTITION_TYPES 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_PARTITION_TYPES_AB 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_REFS 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_SKIP 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_TILE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_EXT_TX 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FILTER_INTRA 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FP_MB_STATS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FRAME_MARKER 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FRAME_SIGN_BIAS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FRAME_SIZE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_FRAME_SUPERRES 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_GLOBAL_MOTION 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_HASH_ME 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_HORZONLY_FRAME_SUPERRES 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_INTERINTRA 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_INTER_STATS_ONLY 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_INTRABC 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_INTRA_EDGE 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_INTRA_INTERP 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_JNT_COMP 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_KF_CTX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LGT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LGT_FROM_PRED 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LOOPFILTERING_ACROSS_TILES 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LOOPFILTER_LEVEL 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LOOP_RESTORATION 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LPF_DIRECT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LPF_SB 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_LV_MAP 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MASKED_TX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MAX_TILE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MFMV 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MOTION_VAR 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MRC_TX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_MV_COMPRESS 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_NCOBMC 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_NCOBMC_ADAPT_WEIGHT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_NEW_MULTISYMBOL 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_NEW_QUANT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_NO_FRAME_CONTEXT_SIGNALING 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_OBU 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_ONE_SIDED_COMPOUND 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_OPT_REF_MV 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_PALETTE_DELTA_ENCODING 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_PALETTE_THROUGHPUT 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_PARALLEL_DEBLOCKING 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_PVQ 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_Q_ADAPT_PROBS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_RAWBITS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_RD_DEBUG 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_RECT_TX 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_RECT_TX_EXT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_REFERENCE_BUFFER 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_REF_ADAPT 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_RESTRICT_COMPRESSED_HDR 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_SBL_SYMBOL 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_SEGMENT_ZEROMV 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_SMOOTH_HV 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_STRIPED_LOOP_RESTORATION 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_SUPERTX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TEMPMV_SIGNALING 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TMV 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TPL_MV 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TX64X64 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TXK_SEL 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_TXMG 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_UNPOISON_PARTITION_CTX 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_VAR_REFS 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_VAR_TX 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_VAR_TX_NO_TX_MODE 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_WARPED_MOTION 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_WEDGE 1 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_XIPHRC 0 CACHE NUMBER "AV1 experiment flag.")
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_
diff --git a/third_party/aom/build/cmake/aom_experiment_deps.cmake b/third_party/aom/build/cmake/aom_experiment_deps.cmake
new file mode 100644
index 000000000..938af2386
--- /dev/null
+++ b/third_party/aom/build/cmake/aom_experiment_deps.cmake
@@ -0,0 +1,139 @@
+##
+## 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 (NOT 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)
+ if (CONFIG_ANALYZER)
+ if (NOT CONFIG_INSPECTION)
+ change_config_and_warn(CONFIG_INSPECTION 1 CONFIG_ANALYZER)
+ endif ()
+ endif ()
+
+ if (CONFIG_VAR_TX_NO_TX_MODE AND NOT CONFIG_VAR_TX)
+ change_config_and_warn(CONFIG_VAR_TX 1 CONFIG_VAR_TX_NO_TX_MODE)
+ endif ()
+
+ if (CONFIG_CHROMA_2X2)
+ change_config_and_warn(CONFIG_CHROMA_SUB8X8 0 CONFIG_CHROMA_2X2)
+ endif ()
+
+ if (CONFIG_DAALA_TX)
+ set(CONFIG_DAALA_DCT4 1)
+ set(CONFIG_DAALA_DCT8 1)
+ set(CONFIG_DAALA_DCT16 1)
+ set(CONFIG_DAALA_DCT32 1)
+ set(CONFIG_DAALA_DCT64 1)
+ endif ()
+
+ if (CONFIG_DAALA_DCT64)
+ if (NOT CONFIG_TX64X64)
+ set(CONFIG_DAALA_DCT64 0)
+ message("--- DAALA_DCT64 requires TX64X64: disabled DAALA_DCT64")
+ endif ()
+ endif ()
+
+ if (CONFIG_DAALA_DCT4 OR CONFIG_DAALA_DCT8 OR CONFIG_DAALA_DCT16 OR
+ CONFIG_DAALA_DCT32 OR CONFIG_DAALA_DCT64)
+ if (CONFIG_LGT)
+ change_config_and_warn(CONFIG_LGT 0 CONFIG_DAALA_DCTx)
+ endif ()
+ if (NOT CONFIG_LOWBITDEPTH)
+ change_config_and_warn(CONFIG_LOWBITDEPTH 1 CONFIG_DAALA_DCTx)
+ endif ()
+ endif ()
+
+ if (CONFIG_TXK_SEL)
+ if (NOT CONFIG_LV_MAP)
+ change_config_and_warn(CONFIG_LV_MAP 1 CONFIG_TXK_SEL)
+ endif ()
+ endif ()
+
+ if (CONFIG_CTX1D)
+ if (NOT CONFIG_LV_MAP)
+ change_config_and_warn(CONFIG_LV_MAP 1 CONFIG_CTX1D)
+ endif ()
+ if (NOT CONFIG_EXT_TX)
+ change_config_and_warn(CONFIG_EXT_TX 1 CONFIG_CTX1D)
+ endif ()
+ endif ()
+
+ if (CONFIG_EXT_COMP_REFS)
+ if (NOT CONFIG_EXT_REFS)
+ change_config_and_warn(CONFIG_EXT_REFS 1 CONFIG_EXT_COMP_REFS)
+ endif ()
+ endif ()
+
+ if (CONFIG_STRIPED_LOOP_RESTORATION)
+ if (NOT CONFIG_LOOP_RESTORATION)
+ change_config_and_warn(CONFIG_LOOP_RESTORATION 1
+ CONFIG_STRIPED_LOOP_RESTORATION)
+ endif ()
+ endif ()
+
+ if (CONFIG_MFMV)
+ if (NOT CONFIG_FRAME_MARKER)
+ change_config_and_warn(CONFIG_FRAME_MARKER 1 CONFIG_MFMV)
+ endif ()
+ endif ()
+
+ if (CONFIG_NEW_MULTISYMBOL)
+ if (NOT CONFIG_RESTRICT_COMPRESSED_HDR)
+ change_config_and_warn(CONFIG_RESTRICT_COMPRESSED_HDR 1
+ CONFIG_NEW_MULTISYMBOL)
+ endif ()
+ endif ()
+
+ if (CONFIG_EXT_PARTITION_TYPES)
+ if (CONFIG_SUPERTX)
+ change_config_and_warn(CONFIG_SUPERTX 0
+ CONFIG_EXT_PARTITION_TYPES)
+ endif ()
+ endif ()
+
+ if (CONFIG_JNT_COMP)
+ if (NOT CONFIG_FRAME_MARKER)
+ change_config_and_warn(CONFIG_FRAME_MARKER 1 CONFIG_JNT_COMP)
+ endif ()
+ endif ()
+
+ if (CONFIG_AMVR)
+ change_config_and_warn(CONFIG_HASH_ME 1 CONFIG_AMVR)
+ endif ()
+
+ if (CONFIG_PVQ)
+ if (CONFIG_EXT_TX)
+ change_config_and_warn(CONFIG_EXT_TX 0 CONFIG_PVQ)
+ endif ()
+ if (CONFIG_HIGHBITDEPTH)
+ change_config_and_warn(CONFIG_HIGHBITDEPTH 0 CONFIG_PVQ)
+ endif ()
+ if (CONFIG_PALETTE_THROUGHPUT)
+ change_config_and_warn(CONFIG_PALETTE_THROUGHPUT 0 CONFIG_PVQ)
+ endif ()
+ if (CONFIG_RECT_TX)
+ change_config_and_warn(CONFIG_RECT_TX 0 CONFIG_PVQ)
+ endif ()
+ if (CONFIG_VAR_TX)
+ change_config_and_warn(CONFIG_VAR_TX 0 CONFIG_PVQ)
+ endif ()
+ endif ()
+
+ if (CONFIG_HORZONLY_FRAME_SUPERRES)
+ if (NOT CONFIG_FRAME_SUPERRES)
+ change_config_and_warn(CONFIG_FRAME_SUPERRES 1 CONFIG_HORZONLY_FRAME_SUPERRES)
+ endif ()
+ endif ()
+endmacro ()
+
+endif () # AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_
diff --git a/third_party/aom/build/cmake/aom_optimization.cmake b/third_party/aom/build/cmake/aom_optimization.cmake
index 456798ceb..c58c3993e 100644
--- a/third_party/aom/build/cmake/aom_optimization.cmake
+++ b/third_party/aom/build/cmake/aom_optimization.cmake
@@ -238,4 +238,27 @@ function (test_nasm)
endif ()
endfunction ()
+# Adds build command for generation of rtcd C source files using
+# build/make/rtcd.pl. $config is the input perl file, $output is the output C
+# include file, $source is the C source file, and $symbol is used for the symbol
+# argument passed to rtcd.pl.
+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 ()
+
endif () # AOM_BUILD_CMAKE_AOM_OPTIMIZATION_CMAKE_
diff --git a/third_party/aom/build/cmake/compiler_flags.cmake b/third_party/aom/build/cmake/compiler_flags.cmake
index ee6d12bd3..aa34b83ae 100644
--- a/third_party/aom/build/cmake/compiler_flags.cmake
+++ b/third_party/aom/build/cmake/compiler_flags.cmake
@@ -13,53 +13,93 @@ set(AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_ 1)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
+include("${AOM_ROOT}/build/cmake/compiler_tests.cmake")
-# Strings used to cache failed C/CXX flags.
+# Strings used to cache flags.
+set(AOM_C_FLAGS)
+set(AOM_CXX_FLAGS)
+set(AOM_EXE_LINKER_FLAGS)
set(AOM_FAILED_C_FLAGS)
set(AOM_FAILED_CXX_FLAGS)
-# Checks C compiler for support of $c_flag. Adds $c_flag to $CMAKE_C_FLAGS when
-# the compile test passes. Caches $c_flag in $AOM_FAILED_C_FLAGS when the test
-# fails.
+# Sets variable named by $out_is_present to YES in the caller's scope when $flag
+# is found in the string variable named by $flag_cache. Sets the var to NO
+# otherwise.
+function(is_flag_present flag_cache flag out_is_present)
+ string(FIND "${${flag_cache}}" "${flag}" flag_pos)
+ if (${flag_pos} EQUAL -1)
+ set(${out_is_present} NO PARENT_SCOPE)
+ else ()
+ set(${out_is_present} YES PARENT_SCOPE)
+ endif ()
+endfunction ()
+
+# Appends $flag to $flags. Ignores scope via use of FORCE with set() call.
+function (append_flag flags flag)
+ string(FIND "${${flags}}" "${flag}" found)
+ if (${found} EQUAL -1)
+ set(${flags} "${${flags}} ${flag}" CACHE STRING "" FORCE)
+ endif ()
+endfunction ()
+
+# Checks C compiler for support of $c_flag. Adds $c_flag to all
+# $CMAKE_C_FLAGS_<CONFIG>s stored in AOM_C_CONFIGS when the compile test passes.
+# Caches $c_flag in $AOM_C_FLAGS or $AOM_FAILED_C_FLAGS depending on test
+# outcome.
function (add_c_flag_if_supported c_flag)
- unset(C_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
- unset(C_FLAG_FAILED CACHE)
- string(FIND "${AOM_FAILED_C_FLAGS}" "${c_flag}" C_FLAG_FAILED)
-
- if (${C_FLAG_FOUND} EQUAL -1 AND ${C_FLAG_FAILED} EQUAL -1)
- unset(C_FLAG_SUPPORTED CACHE)
- message("Checking C compiler flag support for: " ${c_flag})
- check_c_compiler_flag("${c_flag}" C_FLAG_SUPPORTED)
- if (C_FLAG_SUPPORTED)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${c_flag}" CACHE STRING "" FORCE)
- else ()
- set(AOM_FAILED_C_FLAGS "${AOM_FAILED_C_FLAGS} ${c_flag}" CACHE STRING ""
- FORCE)
- endif ()
+ if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
+ return()
+ endif ()
+
+ is_flag_present(AOM_C_FLAGS "${c_flag}" flag_ok)
+ is_flag_present(AOM_FAILED_C_FLAGS "${c_flag}" flag_failed)
+ if (${flag_ok} OR ${flag_failed})
+ return ()
+ endif ()
+
+ unset(C_FLAG_SUPPORTED CACHE)
+ message("Checking C compiler flag support for: " ${c_flag})
+ check_c_compiler_flag("${c_flag}" C_FLAG_SUPPORTED)
+
+ if (${C_FLAG_SUPPORTED})
+ append_flag(AOM_C_FLAGS "${c_flag}")
+ foreach (config ${AOM_C_CONFIGS})
+ unset(C_FLAG_FOUND)
+ append_flag("${config}" "${c_flag}")
+ endforeach ()
+ else ()
+ append_flag(AOM_FAILED_C_FLAGS "${c_flag}")
endif ()
endfunction ()
-# Checks C++ compiler for support of $cxx_flag. Adds $cxx_flag to
-# $CMAKE_CXX_FLAGS when the compile test passes. Caches $c_flag in
-# $AOM_FAILED_CXX_FLAGS when the test fails.
+# Checks C++ compiler for support of $cxx_flag. Adds $cxx_flag to all
+# $CMAKE_CXX_FLAGS_<CONFIG>s stored in AOM_CXX_CONFIGS when the compile test
+# passes.
+# Caches $cxx_flag in $AOM_CXX_FLAGS or $AOM_FAILED_CXX_FLAGS depending on test
+# outcome.
function (add_cxx_flag_if_supported cxx_flag)
- unset(CXX_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
- unset(CXX_FLAG_FAILED CACHE)
- string(FIND "${AOM_FAILED_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FAILED)
-
- if (${CXX_FLAG_FOUND} EQUAL -1 AND ${CXX_FLAG_FAILED} EQUAL -1)
- unset(CXX_FLAG_SUPPORTED CACHE)
- message("Checking CXX compiler flag support for: " ${cxx_flag})
- check_cxx_compiler_flag("${cxx_flag}" CXX_FLAG_SUPPORTED)
- if (CXX_FLAG_SUPPORTED)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flag}" CACHE STRING ""
- FORCE)
- else()
- set(AOM_FAILED_CXX_FLAGS "${AOM_FAILED_CXX_FLAGS} ${cxx_flag}" CACHE
- STRING "" FORCE)
- endif ()
+ if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
+ return()
+ endif ()
+
+ is_flag_present(AOM_CXX_FLAGS "${cxx_flag}" flag_ok)
+ is_flag_present(AOM_FAILED_CXX_FLAGS "${cxx_flag}" flag_failed)
+ if (${flag_ok} OR ${flag_failed})
+ return ()
+ endif ()
+
+ unset(CXX_FLAG_SUPPORTED CACHE)
+ message("Checking C++ compiler flag support for: " ${cxx_flag})
+ check_cxx_compiler_flag("${cxx_flag}" CXX_FLAG_SUPPORTED)
+
+ if (${CXX_FLAG_SUPPORTED})
+ append_flag(AOM_CXX_FLAGS "${cxx_flag}")
+ foreach (config ${AOM_CXX_CONFIGS})
+ unset(CXX_FLAG_FOUND)
+ append_flag("${config}" "${cxx_flag}")
+ endforeach ()
+ else ()
+ append_flag(AOM_FAILED_CXX_FLAGS "${cxx_flag}")
endif ()
endfunction ()
@@ -73,47 +113,78 @@ endfunction ()
# Checks C compiler for support of $c_flag and terminates generation when
# support is not present.
function (require_c_flag c_flag update_c_flags)
- unset(C_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
-
- if (${C_FLAG_FOUND} EQUAL -1)
- unset(HAVE_C_FLAG CACHE)
- message("Checking C compiler flag support for: " ${c_flag})
- check_c_compiler_flag("${c_flag}" HAVE_C_FLAG)
- if (NOT HAVE_C_FLAG)
- message(FATAL_ERROR
- "${PROJECT_NAME} requires support for C flag: ${c_flag}.")
- endif ()
- if (update_c_flags)
- set(CMAKE_C_FLAGS "${c_flag} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
- endif ()
+ if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
+ return()
+ endif ()
+
+ is_flag_present(AOM_C_FLAGS "${c_flag}" flag_ok)
+ if (${flag_ok})
+ return ()
+ endif ()
+
+ if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
+ aom_push_var(CMAKE_EXE_LINKER_FLAGS "${AOM_EXE_LINKER_FLAGS}")
+ endif ()
+
+ unset(HAVE_C_FLAG CACHE)
+ message("Checking C compiler flag support for: " ${c_flag})
+ check_c_compiler_flag("${c_flag}" HAVE_C_FLAG)
+ if (NOT HAVE_C_FLAG)
+ message(FATAL_ERROR
+ "${PROJECT_NAME} requires support for C flag: ${c_flag}.")
+ endif ()
+
+ if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
+ aom_pop_var(CMAKE_EXE_LINKER_FLAGS)
+ endif ()
+
+ append_flag(AOM_C_FLAGS "${c_flag}")
+ if (update_c_flags)
+ foreach (config ${AOM_C_CONFIGS})
+ set(${config} "${${config}} ${c_flag}" CACHE STRING "" FORCE)
+ endforeach ()
endif ()
endfunction ()
# Checks CXX compiler for support of $cxx_flag and terminates generation when
# support is not present.
function (require_cxx_flag cxx_flag update_cxx_flags)
- unset(CXX_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
-
- if (${CXX_FLAG_FOUND} EQUAL -1)
- unset(HAVE_CXX_FLAG CACHE)
- message("Checking CXX compiler flag support for: " ${cxx_flag})
- check_cxx_compiler_flag("${cxx_flag}" HAVE_CXX_FLAG)
- if (NOT HAVE_CXX_FLAG)
- message(FATAL_ERROR
- "${PROJECT_NAME} requires support for CXX flag: ${cxx_flag}.")
- endif ()
- if (update_cxx_flags)
- set(CMAKE_CXX_FLAGS "${cxx_flag} ${CMAKE_CXX_FLAGS}" CACHE STRING ""
- FORCE)
- endif ()
+ if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
+ return()
+ endif ()
+
+ is_flag_present(AOM_CXX_FLAGS "${cxx_flag}" flag_ok)
+ if (${flag_ok})
+ return ()
+ endif ()
+
+ if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
+ aom_push_var(CMAKE_EXE_LINKER_FLAGS "${AOM_EXE_LINKER_FLAGS}")
+ endif ()
+
+ unset(HAVE_CXX_FLAG CACHE)
+ message("Checking C compiler flag support for: " ${cxx_flag})
+ check_cxx_compiler_flag("${cxx_flag}" HAVE_CXX_FLAG)
+ if (NOT HAVE_CXX_FLAG)
+ message(FATAL_ERROR
+ "${PROJECT_NAME} requires support for C flag: ${cxx_flag}.")
+ endif ()
+
+ if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
+ aom_pop_var(CMAKE_EXE_LINKER_FLAGS)
+ endif ()
+
+ append_flag(AOM_CXX_FLAGS "${cxx_flag}")
+ if (update_cxx_flags)
+ foreach (config ${AOM_CXX_CONFIGS})
+ set(${config} "${${config}} ${cxx_flag}" CACHE STRING "" FORCE)
+ endforeach ()
endif ()
endfunction ()
# Checks for support of $flag by both the C and CXX compilers. Terminates
# generation when support is not present in both compilers.
-function (require_flag flag update_cmake_flags)
+function (require_compiler_flag flag update_cmake_flags)
require_c_flag(${flag} ${update_cmake_flags})
require_cxx_flag(${flag} ${update_cmake_flags})
endfunction ()
@@ -137,7 +208,7 @@ endfunction ()
# Checks only non-MSVC targets for support of $flag by both the C and CXX
# compilers. Terminates generation when support is not present in both
# compilers.
-function (require_flag_nomsvc flag update_cmake_flags)
+function (require_compiler_flag_nomsvc flag update_cmake_flags)
require_c_flag_nomsvc(${flag} ${update_cmake_flags})
require_cxx_flag_nomsvc(${flag} ${update_cmake_flags})
endfunction ()
@@ -145,25 +216,29 @@ endfunction ()
# Adds $preproc_def to C compiler command line (as -D$preproc_def) if not
# already present.
function (add_c_preproc_definition preproc_def)
- unset(PREPROC_DEF_FOUND CACHE)
- string(FIND "${CMAKE_C_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND)
-
- if (${PREPROC_DEF_FOUND} EQUAL -1)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${preproc_def}" CACHE STRING ""
- FORCE)
+ set(preproc_def "-D${preproc_def}")
+ is_flag_present(AOM_C_FLAGS "${preproc_def}" flag_cached)
+ if (${flag_cached})
+ return ()
endif ()
+
+ foreach (config ${AOM_C_CONFIGS})
+ set(${config} "${${config}} ${preproc_def}" CACHE STRING "" FORCE)
+ endforeach ()
endfunction ()
# Adds $preproc_def to CXX compiler command line (as -D$preproc_def) if not
# already present.
function (add_cxx_preproc_definition preproc_def)
- unset(PREPROC_DEF_FOUND CACHE)
- string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND)
-
- if (${PREPROC_DEF_FOUND} EQUAL -1)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" CACHE STRING ""
- FORCE)
+ set(preproc_def "-D${preproc_def}")
+ is_flag_present(AOM_CXX_FLAGS "${preproc_def}" flag_cached)
+ if (${flag_cached})
+ return ()
endif ()
+
+ foreach (config ${AOM_CXX_CONFIGS})
+ set(${config} "${${config}} ${preproc_def}" CACHE STRING "" FORCE)
+ endforeach ()
endfunction ()
# Adds $preproc_def to C and CXX compiler command line (as -D$preproc_def) if
@@ -175,32 +250,35 @@ endfunction ()
# Adds $flag to assembler command line.
function (append_as_flag flag)
- unset(AS_FLAG_FOUND CACHE)
- string(FIND "${AOM_AS_FLAGS}" "${flag}" AS_FLAG_FOUND)
-
- if (${AS_FLAG_FOUND} EQUAL -1)
- set(AOM_AS_FLAGS "${AOM_AS_FLAGS} ${flag}" CACHE STRING "" FORCE)
+ is_flag_present(AOM_AS_FLAGS "${flag}" flag_cached)
+ if (${flag_cached})
+ return ()
endif ()
+ append_flag(AOM_AS_FLAGS "${flag}")
endfunction ()
# Adds $flag to the C compiler command line.
function (append_c_flag flag)
- unset(C_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_C_FLAGS}" "${flag}" C_FLAG_FOUND)
-
- if (${C_FLAG_FOUND} EQUAL -1)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" CACHE STRING "" FORCE)
+ is_flag_present(AOM_C_FLAGS "${flag}" flag_cached)
+ if (${flag_cached})
+ return ()
endif ()
+
+ foreach (config ${AOM_C_CONFIGS})
+ append_flag(${config} "${flag}")
+ endforeach ()
endfunction ()
# Adds $flag to the CXX compiler command line.
function (append_cxx_flag flag)
- unset(CXX_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" CXX_FLAG_FOUND)
-
- if (${CXX_FLAG_FOUND} EQUAL -1)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" CACHE STRING "" FORCE)
+ is_flag_present(AOM_CXX_FLAGS "${flag}" flag_cached)
+ if (${flag_cached})
+ return ()
endif ()
+
+ foreach (config ${AOM_CXX_CONFIGS})
+ append_flag(${config} "${flag}")
+ endforeach ()
endfunction ()
# Adds $flag to the C and CXX compiler command lines.
@@ -209,30 +287,29 @@ function (append_compiler_flag flag)
append_cxx_flag(${flag})
endfunction ()
-# Adds $flag to the executable linker command line.
+# Adds $flag to the executable linker command line when not present.
function (append_exe_linker_flag flag)
- unset(LINKER_FLAG_FOUND CACHE)
- string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${flag}" LINKER_FLAG_FOUND)
-
- if (${LINKER_FLAG_FOUND} EQUAL -1)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}" CACHE STRING
- "" FORCE)
+ is_flag_present(AOM_EXE_LINKER_FLAGS "${flag}" flag_cached)
+ if (${flag_cached})
+ return()
endif ()
+
+ append_flag(AOM_EXE_LINKER_FLAGS "${flag}")
+ foreach (config ${AOM_EXE_LINKER_CONFIGS})
+ append_flag(${config} "${flag}")
+ endforeach ()
endfunction ()
# Adds $flag to the link flags for $target.
-function (append_link_flag_to_target target flags)
+function (append_link_flag_to_target target flag)
unset(target_link_flags)
get_target_property(target_link_flags ${target} LINK_FLAGS)
if (target_link_flags)
- unset(link_flag_found)
- string(FIND "${target_link_flags}" "${flags}" link_flag_found)
-
- if (NOT ${link_flag_found} EQUAL -1)
+ is_flag_present(target_link_flags "${flag}" flag_found)
+ if (${flag_found})
return()
endif ()
-
set(target_link_flags "${target_link_flags} ${flags}")
else ()
set(target_link_flags "${flags}")
@@ -241,4 +318,55 @@ function (append_link_flag_to_target target flags)
set_target_properties(${target} PROPERTIES LINK_FLAGS ${target_link_flags})
endfunction ()
+# Adds $flag to executable linker flags, and makes sure C/CXX builds still work.
+function (require_linker_flag flag)
+ if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
+ return()
+ endif ()
+
+ append_exe_linker_flag(${flag})
+
+ unset(c_passed)
+ aom_check_c_compiles("LINKER_FLAG_C_TEST(${flag})" "" c_passed)
+ unset(cxx_passed)
+ aom_check_cxx_compiles("LINKER_FLAG_CXX_TEST(${flag})" "" cxx_passed)
+
+ if (NOT c_passed OR NOT cxx_passed)
+ message(FATAL_ERROR "Linker flag test for ${flag} failed.")
+ endif ()
+endfunction ()
+
+# Appends flags in $AOM_EXTRA_<TYPE>_FLAGS variables to the flags used at build
+# time.
+function (set_user_flags)
+ # Linker flags are handled first because some C/CXX flags require that a
+ # linker flag is present at link time.
+ if (AOM_EXTRA_EXE_LINKER_FLAGS)
+ is_flag_present(AOM_EXE_LINKER_FLAGS "${AOM_EXTRA_EXE_LINKER_FLAGS}"
+ extra_present)
+ if (NOT ${extra_present})
+ require_linker_flag("${AOM_EXTRA_EXE_LINKER_FLAGS}")
+ endif ()
+ endif ()
+ if (AOM_EXTRA_AS_FLAGS)
+ # TODO(tomfinegan): assembler flag testing would be a good thing to have.
+ is_flag_present(AOM_AS_FLAGS "${AOM_EXTRA_AS_FLAGS}" extra_present)
+ if (NOT ${extra_present})
+ append_flag(AOM_AS_FLAGS "${AOM_EXTRA_AS_FLAGS}")
+ endif ()
+ endif ()
+ if (AOM_EXTRA_C_FLAGS)
+ is_flag_present(AOM_C_FLAGS "${AOM_EXTRA_C_FLAGS}" extra_present)
+ if (NOT ${extra_present})
+ require_c_flag("${AOM_EXTRA_C_FLAGS}" YES)
+ endif ()
+ endif ()
+ if (AOM_EXTRA_CXX_FLAGS)
+ is_flag_present(AOM_CXX_FLAGS "${AOM_EXTRA_CXX_FLAGS}" extra_present)
+ if (NOT ${extra_present})
+ require_cxx_flag("${AOM_EXTRA_CXX_FLAGS}" YES)
+ endif ()
+ endif ()
+endfunction ()
+
endif () # AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_
diff --git a/third_party/aom/build/cmake/compiler_tests.cmake b/third_party/aom/build/cmake/compiler_tests.cmake
index 89f0bc12c..8a73ec8ff 100644
--- a/third_party/aom/build/cmake/compiler_tests.cmake
+++ b/third_party/aom/build/cmake/compiler_tests.cmake
@@ -14,6 +14,34 @@ 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 ...
+# 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
+# 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
+# configuration(s).
+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})
+ 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 ()
+ 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 ()
+
# The basic main() function used in all compile tests.
set(AOM_C_MAIN "\nint main(void) { return 0; }")
set(AOM_CXX_MAIN "\nint main() { return 0; }")
@@ -25,8 +53,8 @@ set(AOM_CXX_PASSED_TESTS)
set(AOM_CXX_FAILED_TESTS)
function(aom_push_var var new_value)
- set(SAVED_${var} ${var} PARENT_SCOPE)
- set(${var} ${new_value} PARENT_SCOPE)
+ set(SAVED_${var} ${${var}} PARENT_SCOPE)
+ set(${var} "${${var}} ${new_value}" PARENT_SCOPE)
endfunction ()
function(aom_pop_var var)
@@ -40,6 +68,10 @@ endfunction ()
# 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)
+ return()
+ endif ()
+
unset(C_TEST_PASSED CACHE)
unset(C_TEST_FAILED CACHE)
string(FIND "${AOM_C_PASSED_TESTS}" "${test_name}" C_TEST_PASSED)
@@ -71,6 +103,10 @@ endfunction ()
# 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)
+ return()
+ endif ()
+
unset(CXX_TEST_PASSED CACHE)
unset(CXX_TEST_FAILED CACHE)
string(FIND "${AOM_CXX_PASSED_TESTS}" "${test_name}" CXX_TEST_PASSED)
@@ -100,9 +136,9 @@ 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.
+# 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)
diff --git a/third_party/aom/build/cmake/dist.cmake b/third_party/aom/build/cmake/dist.cmake
index 0de68a44d..ad1e069fe 100644
--- a/third_party/aom/build/cmake/dist.cmake
+++ b/third_party/aom/build/cmake/dist.cmake
@@ -17,8 +17,8 @@ function (listify_string in_string out_string)
set(${out_string} "${${out_string}}" PARENT_SCOPE)
endfunction ()
-set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_DIST_DIR" "AOM_DIST_EXAMPLES"
- "AOM_DIST_APPS" "AOM_DIST_INCLUDES" "AOM_DIST_LIBS" "ENABLE_DOCS")
+set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_DIST_DIR" "AOM_DIST_INCLUDES"
+ "AOM_DIST_LIBS" "ENABLE_DOCS")
foreach (arg ${REQUIRED_ARGS})
if ("${${arg}}" STREQUAL "")
@@ -30,15 +30,27 @@ if (ENABLE_DOCS)
file(INSTALL "${AOM_CONFIG_DIR}/docs" DESTINATION "${AOM_DIST_DIR}")
endif ()
-listify_string("${AOM_DIST_EXAMPLES}" "AOM_DIST_EXAMPLES")
-foreach (example ${AOM_DIST_EXAMPLES})
- file(INSTALL "${example}" DESTINATION "${AOM_DIST_DIR}/bin/examples")
-endforeach ()
+if (AOM_DIST_EXAMPLES)
+ listify_string("${AOM_DIST_EXAMPLES}" "AOM_DIST_EXAMPLES")
+ foreach (example ${AOM_DIST_EXAMPLES})
+ if (NOT "${example}" MATCHES "aomdec\|aomenc")
+ file(INSTALL "${example}" DESTINATION "${AOM_DIST_DIR}/bin/examples")
+ endif ()
+ endforeach ()
+endif ()
-listify_string("${AOM_DIST_APPS}" "AOM_DIST_APPS")
-foreach (app ${AOM_DIST_APPS})
- file(INSTALL "${app}" DESTINATION "${AOM_DIST_DIR}/bin")
-endforeach ()
+if (AOM_DIST_TOOLS)
+ foreach (tool ${AOM_DIST_TOOLS})
+ file(INSTALL "${tool}" DESTINATION "${AOM_DIST_DIR}/bin/tools")
+ endforeach ()
+endif ()
+
+if (AOM_DIST_APPS)
+ listify_string("${AOM_DIST_APPS}" "AOM_DIST_APPS")
+ foreach (app ${AOM_DIST_APPS})
+ file(INSTALL "${app}" DESTINATION "${AOM_DIST_DIR}/bin")
+ endforeach ()
+endif ()
listify_string("${AOM_DIST_INCLUDES}" "AOM_DIST_INCLUDES")
foreach (inc ${AOM_DIST_INCLUDES})
diff --git a/third_party/aom/build/cmake/pkg_config.cmake b/third_party/aom/build/cmake/pkg_config.cmake
new file mode 100644
index 000000000..aee375f43
--- /dev/null
+++ b/third_party/aom/build/cmake/pkg_config.cmake
@@ -0,0 +1,57 @@
+##
+## 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.
+##
+cmake_minimum_required(VERSION 3.5)
+
+set(REQUIRED_ARGS
+ "AOM_ROOT" "AOM_CONFIG_DIR" "CMAKE_INSTALL_PREFIX" "CMAKE_PROJECT_NAME"
+ "CONFIG_MULTITHREAD" "HAVE_PTHREAD_H")
+
+foreach (arg ${REQUIRED_ARGS})
+ if ("${${arg}}" STREQUAL "")
+ message(FATAL_ERROR "${arg} must not be empty.")
+ endif ()
+endforeach ()
+
+include("${AOM_ROOT}/build/cmake/util.cmake")
+
+extract_version_string("${AOM_CONFIG_DIR}/aom_version.h" aom_version)
+
+# Create a version string suitable for comparison using the RPM version compare
+# algorithm: strip out everything after the number.
+string(FIND "${aom_version}" "-" dash_pos)
+if (${dash_pos} EQUAL -1)
+ set(package_version "${aom_version}")
+else ()
+ string(SUBSTRING "${aom_version}" 0 ${dash_pos} package_version)
+endif ()
+
+# 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 v${aom_version}.\n")
+file(APPEND "${pkgconfig_file}" "Version: ${package_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")
diff --git a/third_party/aom/build/cmake/sanitizers.cmake b/third_party/aom/build/cmake/sanitizers.cmake
new file mode 100644
index 000000000..2b9067868
--- /dev/null
+++ b/third_party/aom/build/cmake/sanitizers.cmake
@@ -0,0 +1,29 @@
+##
+## 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 (NOT AOM_BUILD_CMAKE_SANITIZERS_CMAKE_)
+set(AOM_BUILD_CMAKE_SANITIZERS_CMAKE_ 1)
+
+if (MSVC OR NOT SANITIZE)
+ return ()
+endif ()
+
+include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
+
+string(TOLOWER ${SANITIZE} SANITIZE)
+
+# Require the sanitizer requested.
+require_linker_flag("-fsanitize=${SANITIZE}")
+require_compiler_flag("-fsanitize=${SANITIZE}" YES)
+
+# Make callstacks accurate.
+require_compiler_flag("-fno-omit-frame-pointer -fno-optimize-sibling-calls" YES)
+
+endif() # AOM_BUILD_CMAKE_SANITIZERS_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/mips32-linux-gcc.cmake b/third_party/aom/build/cmake/toolchains/mips32-linux-gcc.cmake
index 11406bd08..b452e368f 100644
--- a/third_party/aom/build/cmake/toolchains/mips32-linux-gcc.cmake
+++ b/third_party/aom/build/cmake/toolchains/mips32-linux-gcc.cmake
@@ -66,6 +66,10 @@ set(CMAKE_CXX_COMPILER_ARG1 "-EL ${MIPS_CXXFLAGS}")
set(CMAKE_SYSTEM_PROCESSOR "mips32")
# No runtime cpu detect for mips32-linux-gcc.
-set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "")
+if (CONFIG_RUNTIME_CPU_DETECT)
+ message("--- CONFIG_RUNTIME_CPU_DETECT not supported for mips32 targets.")
+endif ()
+
+set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "" FORCE)
endif () # AOM_BUILD_CMAKE_TOOLCHAINS_MIPS32_LINUX_GCC_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/mips64-linux-gcc.cmake b/third_party/aom/build/cmake/toolchains/mips64-linux-gcc.cmake
index fffb495bf..0b63d778d 100644
--- a/third_party/aom/build/cmake/toolchains/mips64-linux-gcc.cmake
+++ b/third_party/aom/build/cmake/toolchains/mips64-linux-gcc.cmake
@@ -43,6 +43,10 @@ set(CMAKE_CXX_COMPILER_ARG1 "-EL ${MIPS_CXXFLAGS}")
set(CMAKE_SYSTEM_PROCESSOR "mips64")
# No runtime cpu detect for mips64-linux-gcc.
-set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "")
+if (CONFIG_RUNTIME_CPU_DETECT)
+ message("--- CONFIG_RUNTIME_CPU_DETECT not supported for mips64 targets.")
+endif ()
+
+set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "" FORCE)
endif () # AOM_BUILD_CMAKE_TOOLCHAINS_MIPS64_LINUX_GCC_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/x86-linux.cmake b/third_party/aom/build/cmake/toolchains/x86-linux.cmake
index 077c8f325..42cc61467 100644
--- a/third_party/aom/build/cmake/toolchains/x86-linux.cmake
+++ b/third_party/aom/build/cmake/toolchains/x86-linux.cmake
@@ -8,7 +8,12 @@
## 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 (NOT AOM_BUILD_CMAKE_TOOLCHAINS_X86_LINUX_CMAKE_)
+set(AOM_BUILD_CMAKE_TOOLCHAINS_X86_LINUX_CMAKE_ 1)
+
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_C_COMPILER_ARG1 "-m32")
set(CMAKE_CXX_COMPILER_ARG1 "-m32")
+
+endif () # AOM_BUILD_CMAKE_TOOLCHAINS_X86_LINUX_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/x86-mingw-gcc.cmake b/third_party/aom/build/cmake/toolchains/x86-mingw-gcc.cmake
new file mode 100644
index 000000000..bdd3fa539
--- /dev/null
+++ b/third_party/aom/build/cmake/toolchains/x86-mingw-gcc.cmake
@@ -0,0 +1,29 @@
+##
+## 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 (NOT AOM_BUILD_CMAKE_TOOLCHAINS_X86_MINGW_GCC_CMAKE_)
+set(AOM_BUILD_CMAKE_TOOLCHAINS_X86_MINGW_GCC_CMAKE_ 1)
+
+set(CMAKE_SYSTEM_PROCESSOR "x86")
+set(CMAKE_SYSTEM_NAME "Windows")
+set(CMAKE_C_COMPILER_ARG1 "-m32")
+set(CMAKE_CXX_COMPILER_ARG1 "-m32")
+
+if ("${CROSS}" STREQUAL "")
+ set(CROSS i686-w64-mingw32-)
+endif ()
+
+set(CMAKE_C_COMPILER ${CROSS}gcc)
+set(CMAKE_CXX_COMPILER ${CROSS}g++)
+
+# Disable the use of the gtest's CMake support.
+set(AOM_DISABLE_GTEST_CMAKE 1)
+
+endif () # AOM_BUILD_CMAKE_TOOLCHAINS_X86_MINGW_GCC_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake b/third_party/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake
new file mode 100644
index 000000000..be94332b4
--- /dev/null
+++ b/third_party/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake
@@ -0,0 +1,27 @@
+##
+## 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 (NOT AOM_BUILD_CMAKE_TOOLCHAINS_X86_64_MINGW_GCC_CMAKE_)
+set(AOM_BUILD_CMAKE_TOOLCHAINS_X86_64_MINGW_GCC_CMAKE_ 1)
+
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+set(CMAKE_SYSTEM_NAME "Windows")
+
+if ("${CROSS}" STREQUAL "")
+ set(CROSS x86_64-w64-mingw32-)
+endif ()
+
+set(CMAKE_C_COMPILER ${CROSS}gcc)
+set(CMAKE_CXX_COMPILER ${CROSS}g++)
+
+# Disable the use of the gtest's CMake support.
+set(AOM_DISABLE_GTEST_CMAKE 1)
+
+endif () # AOM_BUILD_CMAKE_TOOLCHAINS_X86_64_MINGW_GCC_CMAKE_
diff --git a/third_party/aom/build/cmake/util.cmake b/third_party/aom/build/cmake/util.cmake
index 62841a63b..d6c432229 100644
--- a/third_party/aom/build/cmake/util.cmake
+++ b/third_party/aom/build/cmake/util.cmake
@@ -11,9 +11,12 @@
if (NOT AOM_BUILD_CMAKE_UTIL_CMAKE_)
set(AOM_BUILD_CMAKE_UTIL_CMAKE_ 1)
+# Creates dummy source file in $AOM_CONFIG_DIR named $basename.$extension and
+# returns the full path to the dummy source file via the $out_file_path
+# parameter.
function (create_dummy_source_file basename extension out_file_path)
set(dummy_source_file "${AOM_CONFIG_DIR}/${basename}.${extension}")
- file(WRITE "${dummy_source_file}"
+ file(WRITE "${dummy_source_file}"
"// Generated file. DO NOT EDIT!\n"
"// ${target_name} needs a ${extension} file to force link language, \n"
"// or to silence a harmless CMake warning: Ignore me.\n"
@@ -21,10 +24,61 @@ function (create_dummy_source_file basename extension out_file_path)
set(${out_file_path} ${dummy_source_file} PARENT_SCOPE)
endfunction ()
+# Convenience function for adding a dummy source file to $target_name using
+# $extension as the file extension. Wraps create_dummy_source_file().
function (add_dummy_source_file_to_target target_name extension)
create_dummy_source_file("${target_name}" "${extension}" "dummy_source_file")
target_sources(${target_name} PRIVATE ${dummy_source_file})
endfunction ()
+# Sets the value of the variable referenced by $feature to $value, and reports
+# the change to the user via call to message(WARNING ...). $cause is expected to
+# be a configuration variable that conflicts with $feature in some way.
+function (change_config_and_warn feature value cause)
+ set(${feature} ${value} PARENT_SCOPE)
+ if (${value} EQUAL 1)
+ set(verb "Enabled")
+ set(reason "required for")
+ else ()
+ set(verb "Disabled")
+ set(reason "incompatible with")
+ endif ()
+ set(warning_message "${verb} ${feature}, ${reason} ${cause}.")
+ message(WARNING "--- ${warning_message}")
+endfunction ()
+
+# Extracts the version string from $version_file and returns it to the user via
+# $version_string_out_var. To achieve this VERSION_STRING_NOSP is located in
+# $version_file and then everything but the string literal assigned to the
+# variable is removed. Quotes and the leading 'v' are stripped from the
+# returned string.
+function (extract_version_string version_file version_string_out_var)
+ file(STRINGS "${version_file}" aom_version REGEX "VERSION_STRING_NOSP")
+ string(REPLACE "#define VERSION_STRING_NOSP " "" aom_version
+ "${aom_version}")
+ string(REPLACE "\"" "" aom_version "${aom_version}")
+ string(REPLACE " " "" aom_version "${aom_version}")
+ string(FIND "${aom_version}" "v" v_pos)
+ if (${v_pos} EQUAL 0)
+ string(SUBSTRING "${aom_version}" 1 -1 aom_version)
+ endif ()
+ set("${version_string_out_var}" "${aom_version}" PARENT_SCOPE)
+endfunction ()
+
+# Sets CMake compiler launcher to $launcher_name when $launcher_name is found in
+# $PATH. Warns user about ignoring build flag $launcher_flag when $launcher_name
+# is not found in $PATH.
+function (set_compiler_launcher launcher_flag launcher_name)
+ find_program(launcher_path "${launcher_name}")
+ if (launcher_path)
+ set(CMAKE_C_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
+ set(CMAKE_CXX_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
+ message("--- Using ${launcher_name} as compiler launcher.")
+ else ()
+ message(WARNING
+ "--- Cannot find ${launcher_name}, ${launcher_flag} ignored.")
+ endif ()
+endfunction ()
+
endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_
diff --git a/third_party/aom/build/cmake/version.cmake b/third_party/aom/build/cmake/version.cmake
new file mode 100644
index 000000000..c2b3bdb61
--- /dev/null
+++ b/third_party/aom/build/cmake/version.cmake
@@ -0,0 +1,55 @@
+##
+## 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.
+##
+cmake_minimum_required(VERSION 3.5)
+
+set(REQUIRED_ARGS
+ "AOM_ROOT" "AOM_CONFIG_DIR" "GIT_EXECUTABLE" "PERL_EXECUTABLE")
+
+foreach (arg ${REQUIRED_ARGS})
+ if ("${${arg}}" STREQUAL "")
+ message(FATAL_ERROR "${arg} must not be empty.")
+ endif ()
+endforeach ()
+
+include("${AOM_ROOT}/build/cmake/util.cmake")
+
+# Generate the version string for this run.
+unset(aom_version)
+if (EXISTS "${GIT_EXECUTABLE}")
+ execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${AOM_ROOT}/.git describe
+ OUTPUT_VARIABLE aom_version ERROR_QUIET)
+ string(STRIP "${aom_version}" aom_version)
+
+ # Remove the leading 'v' from the version string.
+ string(FIND "${aom_version}" "v" v_pos)
+ if (${v_pos} EQUAL 0)
+ string(SUBSTRING "${aom_version}" 1 -1 aom_version)
+ endif ()
+endif ()
+
+if ("${aom_version}" STREQUAL "")
+ set(aom_version "${AOM_ROOT}/CHANGELOG")
+endif ()
+
+unset(last_aom_version)
+if (EXISTS "${AOM_CONFIG_DIR}/aom_version.h")
+ extract_version_string("${AOM_CONFIG_DIR}/aom_version.h" last_aom_version)
+endif ()
+
+if (NOT "${aom_version}" STREQUAL "${last_aom_version}")
+ # TODO(tomfinegan): Perl dependency is unnecessary. CMake can do everything
+ # that is done by version.pl on its own (if a bit more verbose...).
+ execute_process(
+ COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/version.pl"
+ --version_data=${aom_version}
+ --version_filename=${AOM_CONFIG_DIR}/aom_version.h
+ VERBATIM)
+endif ()
diff --git a/third_party/aom/build/cmake/aom_version.pl b/third_party/aom/build/cmake/version.pl
index 3412feebd..323e178f8 100755
--- a/third_party/aom/build/cmake/aom_version.pl
+++ b/third_party/aom/build/cmake/version.pl
@@ -14,6 +14,7 @@ use warnings;
use 5.010;
use Getopt::Long;
+my $git_desc;
my $version_data;
my $version_filename;
GetOptions('version_data=s' => \$version_data,
@@ -27,6 +28,7 @@ if (!defined $version_data || length($version_data) == 0 ||
# Determine if $version_data is a filename or a git tag/description.
my $version_string;
+chomp($version_data);
if (-r $version_data) {
# $version_data is the path to the CHANGELOG. Parse the most recent version.
my $changelog_filename = $version_data;
@@ -45,6 +47,7 @@ if (-r $version_data) {
# tagName OR tagName-commitsSinceTag-shortCommitHash
# In either case we want the first element of the array returned by split.
$version_string = (split("-", $version_data))[0];
+ $git_desc = $version_data;
}
if (substr($version_string, 0, 1) eq "v") {
@@ -80,7 +83,19 @@ my $lic_block = << "EOF";
EOF
select $version_file;
-print << "EOF";
+if (length($git_desc)) {
+ print << "EOF";
+$lic_block
+#define VERSION_MAJOR $version_major
+#define VERSION_MINOR $version_minor
+#define VERSION_PATCH $version_patch
+#define VERSION_EXTRA \"$version_extra\"
+#define VERSION_PACKED $version_packed
+#define VERSION_STRING_NOSP \"$git_desc\"
+#define VERSION_STRING \" $git_desc\"
+EOF
+} else {
+ print << "EOF";
$lic_block
#define VERSION_MAJOR $version_major
#define VERSION_MINOR $version_minor
@@ -90,4 +105,5 @@ $lic_block
#define VERSION_STRING_NOSP \"v$version_string\"
#define VERSION_STRING \" v$version_string\"
EOF
+}
close($version_file);