diff options
Diffstat (limited to 'media/libaom/src/build/cmake')
33 files changed, 546 insertions, 357 deletions
diff --git a/media/libaom/src/build/cmake/aom_config_defaults.cmake b/media/libaom/src/build/cmake/aom_config_defaults.cmake index a07438cfe3..f9e70eb248 100644 --- a/media/libaom/src/build/cmake/aom_config_defaults.cmake +++ b/media/libaom/src/build/cmake/aom_config_defaults.cmake @@ -20,46 +20,45 @@ include("${AOM_ROOT}/build/cmake/util.cmake") # in this file. # -set_aom_detect_var(INLINE "" STRING "Sets INLINE value for current target.") +set_aom_detect_var(INLINE "" "Sets INLINE value for current target.") # CPUs. -set_aom_detect_var(ARCH_ARM 0 NUMBER "Enables ARM architecture.") -set_aom_detect_var(ARCH_MIPS 0 NUMBER "Enables MIPS architecture.") -set_aom_detect_var(ARCH_PPC 0 NUMBER "Enables PPC architecture.") -set_aom_detect_var(ARCH_X86 0 NUMBER "Enables X86 architecture.") -set_aom_detect_var(ARCH_X86_64 0 NUMBER "Enables X86_64 architecture.") +set_aom_detect_var(ARCH_ARM 0 "Enables ARM architecture.") +set_aom_detect_var(ARCH_MIPS 0 "Enables MIPS architecture.") +set_aom_detect_var(ARCH_PPC 0 "Enables PPC architecture.") +set_aom_detect_var(ARCH_X86 0 "Enables X86 architecture.") +set_aom_detect_var(ARCH_X86_64 0 "Enables X86_64 architecture.") # ARM feature flags. -set_aom_detect_var(HAVE_NEON 0 NUMBER "Enables NEON intrinsics optimizations.") +set_aom_detect_var(HAVE_NEON 0 "Enables NEON intrinsics optimizations.") # MIPS feature flags. -set_aom_detect_var(HAVE_DSPR2 0 NUMBER "Enables DSPR2 optimizations.") -set_aom_detect_var(HAVE_MIPS32 0 NUMBER "Enables MIPS32 optimizations.") -set_aom_detect_var(HAVE_MIPS64 0 NUMBER "Enables MIPS64 optimizations. ") -set_aom_detect_var(HAVE_MSA 0 NUMBER "Enables MSA optimizations.") +set_aom_detect_var(HAVE_DSPR2 0 "Enables DSPR2 optimizations.") +set_aom_detect_var(HAVE_MIPS32 0 "Enables MIPS32 optimizations.") +set_aom_detect_var(HAVE_MIPS64 0 "Enables MIPS64 optimizations. ") +set_aom_detect_var(HAVE_MSA 0 "Enables MSA optimizations.") # PPC feature flags. -set_aom_detect_var(HAVE_VSX 0 NUMBER "Enables VSX optimizations.") +set_aom_detect_var(HAVE_VSX 0 "Enables VSX optimizations.") # x86/x86_64 feature flags. -set_aom_detect_var(HAVE_AVX 0 NUMBER "Enables AVX optimizations.") -set_aom_detect_var(HAVE_AVX2 0 NUMBER "Enables AVX2 optimizations.") -set_aom_detect_var(HAVE_MMX 0 NUMBER "Enables MMX optimizations. ") -set_aom_detect_var(HAVE_SSE 0 NUMBER "Enables SSE optimizations.") -set_aom_detect_var(HAVE_SSE2 0 NUMBER "Enables SSE2 optimizations.") -set_aom_detect_var(HAVE_SSE3 0 NUMBER "Enables SSE3 optimizations.") -set_aom_detect_var(HAVE_SSE4_1 0 NUMBER "Enables SSE 4.1 optimizations.") -set_aom_detect_var(HAVE_SSE4_2 0 NUMBER "Enables SSE 4.2 optimizations.") -set_aom_detect_var(HAVE_SSSE3 0 NUMBER "Enables SSSE3 optimizations.") +set_aom_detect_var(HAVE_AVX 0 "Enables AVX optimizations.") +set_aom_detect_var(HAVE_AVX2 0 "Enables AVX2 optimizations.") +set_aom_detect_var(HAVE_MMX 0 "Enables MMX optimizations. ") +set_aom_detect_var(HAVE_SSE 0 "Enables SSE optimizations.") +set_aom_detect_var(HAVE_SSE2 0 "Enables SSE2 optimizations.") +set_aom_detect_var(HAVE_SSE3 0 "Enables SSE3 optimizations.") +set_aom_detect_var(HAVE_SSE4_1 0 "Enables SSE 4.1 optimizations.") +set_aom_detect_var(HAVE_SSE4_2 0 "Enables SSE 4.2 optimizations.") +set_aom_detect_var(HAVE_SSSE3 0 "Enables SSSE3 optimizations.") # Flags describing the build environment. -set_aom_detect_var(HAVE_FEXCEPT 0 NUMBER +set_aom_detect_var(HAVE_FEXCEPT 0 "Internal flag, GNU fenv.h present for target.") -set_aom_detect_var(HAVE_PTHREAD_H 0 NUMBER - "Internal flag, target pthread support.") -set_aom_detect_var(HAVE_UNISTD_H 0 NUMBER +set_aom_detect_var(HAVE_PTHREAD_H 0 "Internal flag, target pthread support.") +set_aom_detect_var(HAVE_UNISTD_H 0 "Internal flag, unistd.h present for target.") -set_aom_detect_var(HAVE_WXWIDGETS 0 NUMBER "WxWidgets present.") +set_aom_detect_var(HAVE_WXWIDGETS 0 "WxWidgets present.") # # Variables in this section can be set from the CMake command line or from @@ -67,77 +66,75 @@ set_aom_detect_var(HAVE_WXWIDGETS 0 NUMBER "WxWidgets present.") # # Build configuration flags. -set_aom_config_var(AOM_RTCD_FLAGS "" STRING +set_aom_config_var(AOM_RTCD_FLAGS "" "Arguments to pass to rtcd.pl. Separate with ';'") -set_aom_config_var(CONFIG_AV1_DECODER 1 NUMBER "Enable AV1 decoder.") -set_aom_config_var(CONFIG_AV1_ENCODER 1 NUMBER "Enable AV1 encoder.") -set_aom_config_var(CONFIG_BIG_ENDIAN 0 NUMBER "Internal flag.") -set_aom_config_var(CONFIG_GCC 0 NUMBER "Building with GCC (detect).") -set_aom_config_var(CONFIG_GCOV 0 NUMBER "Enable gcov support.") -set_aom_config_var(CONFIG_GPROF 0 NUMBER "Enable gprof support.") -set_aom_config_var(CONFIG_LIBYUV 1 NUMBER - "Enables libyuv scaling/conversion support.") - -set_aom_config_var(CONFIG_MULTITHREAD 1 NUMBER "Multithread support.") -set_aom_config_var(CONFIG_OS_SUPPORT 0 NUMBER "Internal flag.") -set_aom_config_var(CONFIG_PIC 0 NUMBER "Build with PIC enabled.") -set_aom_config_var(CONFIG_RUNTIME_CPU_DETECT 1 NUMBER - "Runtime CPU detection support.") -set_aom_config_var(CONFIG_SHARED 0 NUMBER "Build shared libs.") -set_aom_config_var(CONFIG_STATIC 1 NUMBER "Build static libs.") -set_aom_config_var(CONFIG_WEBM_IO 1 NUMBER "Enables WebM support.") +set_aom_config_var(CONFIG_AV1_DECODER 1 "Enable AV1 decoder.") +set_aom_config_var(CONFIG_AV1_ENCODER 1 "Enable AV1 encoder.") +set_aom_config_var(CONFIG_BIG_ENDIAN 0 "Internal flag.") +set_aom_config_var(CONFIG_GCC 0 "Building with GCC (detect).") +set_aom_config_var(CONFIG_GCOV 0 "Enable gcov support.") +set_aom_config_var(CONFIG_GPROF 0 "Enable gprof support.") +set_aom_config_var(CONFIG_LIBYUV 1 "Enables libyuv scaling/conversion support.") + +set_aom_config_var(CONFIG_MULTITHREAD 1 "Multithread support.") +set_aom_config_var(CONFIG_OS_SUPPORT 0 "Internal flag.") +set_aom_config_var(CONFIG_PIC 0 "Build with PIC enabled.") +set_aom_config_var(CONFIG_RUNTIME_CPU_DETECT 1 "Runtime CPU detection support.") +set_aom_config_var(CONFIG_SHARED 0 "Build shared libs.") +set_aom_config_var(CONFIG_WEBM_IO 1 "Enables WebM support.") # Debugging flags. -set_aom_config_var(CONFIG_BITSTREAM_DEBUG 0 NUMBER "Bitstream debugging flag.") -set_aom_config_var(CONFIG_DEBUG 0 NUMBER "Debug build flag.") -set_aom_config_var(CONFIG_MISMATCH_DEBUG 0 NUMBER "Mismatch debugging flag.") +set_aom_config_var(CONFIG_BITSTREAM_DEBUG 0 "Bitstream debugging flag.") +set_aom_config_var(CONFIG_DEBUG 0 "Debug build flag.") +set_aom_config_var(CONFIG_MISMATCH_DEBUG 0 "Mismatch debugging flag.") # AV1 feature flags. -set_aom_config_var(CONFIG_ACCOUNTING 0 NUMBER "Enables bit accounting.") -set_aom_config_var(CONFIG_ANALYZER 0 NUMBER "Enables bit stream analyzer.") -set_aom_config_var(CONFIG_COEFFICIENT_RANGE_CHECKING 0 NUMBER +set_aom_config_var(CONFIG_ACCOUNTING 0 "Enables bit accounting.") +set_aom_config_var(CONFIG_ANALYZER 0 "Enables bit stream analyzer.") +set_aom_config_var(CONFIG_COEFFICIENT_RANGE_CHECKING 0 "Coefficient range check.") -set_aom_config_var(CONFIG_DENOISE 1 NUMBER +set_aom_config_var(CONFIG_DENOISE 1 "Denoise/noise modeling support in encoder.") -set_aom_config_var(CONFIG_FILEOPTIONS 1 NUMBER - "Enables encoder config file support.") -set_aom_config_var(CONFIG_FIX_GF_LENGTH 1 NUMBER - "Fix the GF length if possible") -set_aom_config_var(CONFIG_INSPECTION 0 NUMBER "Enables bitstream inspection.") -set_aom_config_var(CONFIG_INTERNAL_STATS 0 NUMBER - "Enables internal encoder stats.") -set_aom_config_var(CONFIG_LOWBITDEPTH 0 NUMBER - "Enables 8-bit optimized pipeline.") -set_aom_config_var(CONFIG_MAX_DECODE_PROFILE 2 NUMBER +set_aom_config_var(CONFIG_INSPECTION 0 "Enables bitstream inspection.") +set_aom_config_var(CONFIG_INTERNAL_STATS 0 "Enables internal encoder stats.") +set_aom_config_var(FORCE_HIGHBITDEPTH_DECODING 0 + "Force high bitdepth decoding pipeline on 8-bit input.") +mark_as_advanced(FORCE_HIGHBITDEPTH_DECODING) +set_aom_config_var(CONFIG_MAX_DECODE_PROFILE 2 "Max profile to support decoding.") -set_aom_config_var(CONFIG_NORMAL_TILE_MODE 0 NUMBER - "Only enables normal tile mode.") -set_aom_config_var( - CONFIG_REDUCED_ENCODER_BORDER 0 NUMBER - "Enable reduced border extention for encoder. \ - Disables superres and resize support." - ) -set_aom_config_var(CONFIG_SIZE_LIMIT 0 NUMBER "Limit max decode width/height.") -set_aom_config_var(CONFIG_SPATIAL_RESAMPLING 1 NUMBER "Spatial resampling.") -set_aom_config_var(DECODE_HEIGHT_LIMIT 0 NUMBER "Set limit for decode height.") -set_aom_config_var(DECODE_WIDTH_LIMIT 0 NUMBER "Set limit for decode width.") -set_aom_config_var(CONFIG_GLOBAL_MOTION_SEARCH 1 NUMBER - "Global motion search flag.") +set_aom_config_var(CONFIG_NORMAL_TILE_MODE 0 "Only enables normal tile mode.") +set_aom_config_var(CONFIG_SIZE_LIMIT 0 "Limit max decode width/height.") +set_aom_config_var(CONFIG_SPATIAL_RESAMPLING 1 "Spatial resampling.") +set_aom_config_var(DECODE_HEIGHT_LIMIT 0 "Set limit for decode height.") +set_aom_config_var(DECODE_WIDTH_LIMIT 0 "Set limit for decode width.") +set_aom_config_var(CONFIG_TUNE_VMAF 0 "Enable encoding tuning for VMAF.") # AV1 experiment flags. -set_aom_config_var(CONFIG_COLLECT_INTER_MODE_RD_STATS 1 NUMBER - "AV1 experiment flag.") -set_aom_config_var(CONFIG_COLLECT_RD_STATS 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_DIST_8X8 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_ENTROPY_STATS 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_FP_MB_STATS 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_INTER_STATS_ONLY 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_RD_DEBUG 0 NUMBER "AV1 experiment flag.") -set_aom_config_var(CONFIG_2PASS_PARTITION_SEARCH_LVL 1 NUMBER - "AV1 experiment flag.") -set_aom_config_var(CONFIG_SHARP_SETTINGS 0 NUMBER - "Use sharper encoding settings") - +set_aom_config_var(CONFIG_SPEED_STATS 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_COLLECT_RD_STATS 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_DIST_8X8 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_ENTROPY_STATS 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_INTER_STATS_ONLY 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_RD_DEBUG 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_SHARP_SETTINGS 0 "AV1 experiment flag.") +set_aom_config_var(CONFIG_DISABLE_FULL_PIXEL_SPLIT_8X8 1 + "Disable full_pixel_motion_search_based_split on BLOCK_8X8.") +set_aom_config_var(CONFIG_COLLECT_PARTITION_STATS 0 + "Collect stats on partition decisions.") +set_aom_config_var(CONFIG_COLLECT_COMPONENT_TIMING 0 + "Collect encoding component timing information.") +set_aom_config_var(CONFIG_LPF_MASK 0 + "Enable the use loop filter bitmasks for optimizations.") +set_aom_config_var(CONFIG_HTB_TRELLIS 0 + "Enable the use of hash table for trellis optimizations.") +set_aom_config_var(CONFIG_REALTIME_ONLY 0 + "Build for RTC-only to reduce binary size.") +set_aom_config_var(CONFIG_AV1_HIGHBITDEPTH 1 + "Build with high bitdepth support.") +set_aom_config_var(CONFIG_NN_V2 0 "Fully-connected neural nets ver.2.") +set_aom_config_var(CONFIG_SUPERRES_IN_RECODE 1 + "Enable encoding both full-res and superres in recode loop" + "when SUPERRES_AUTO mode is used.") # # Variables in this section control optional features of the build system. # @@ -176,10 +173,10 @@ set_aom_option_var(ENABLE_VSX "Enables VSX optimizations on PowerPC targets." ON) # x86/x86_64 assembly/intrinsics flags. -set_aom_option_var(ENABLE_MMX - "Enables MMX optimizations on x86/x86_64 targets." ON) -set_aom_option_var(ENABLE_SSE - "Enables SSE optimizations on x86/x86_64 targets." ON) +set_aom_option_var(ENABLE_MMX "Enables MMX optimizations on x86/x86_64 targets." + ON) +set_aom_option_var(ENABLE_SSE "Enables SSE optimizations on x86/x86_64 targets." + ON) set_aom_option_var(ENABLE_SSE2 "Enables SSE2 optimizations on x86/x86_64 targets." ON) set_aom_option_var(ENABLE_SSE3 @@ -190,7 +187,7 @@ set_aom_option_var(ENABLE_SSE4_1 "Enables SSE4_1 optimizations on x86/x86_64 targets." ON) set_aom_option_var(ENABLE_SSE4_2 "Enables SSE4_2 optimizations on x86/x86_64 targets." ON) -set_aom_option_var(ENABLE_AVX - "Enables AVX optimizations on x86/x86_64 targets." ON) +set_aom_option_var(ENABLE_AVX "Enables AVX optimizations on x86/x86_64 targets." + ON) set_aom_option_var(ENABLE_AVX2 "Enables AVX2 optimizations on x86/x86_64 targets." ON) diff --git a/media/libaom/src/build/cmake/aom_configure.cmake b/media/libaom/src/build/cmake/aom_configure.cmake index c0c7381e87..224a46587c 100644 --- a/media/libaom/src/build/cmake/aom_configure.cmake +++ b/media/libaom/src/build/cmake/aom_configure.cmake @@ -17,9 +17,6 @@ include(FindGit) include(FindPerl) include(FindThreads) -set(AOM_SUPPORTED_CPU_TARGETS - "arm64 armv7 armv7s generic mips32 mips64 ppc x86 x86_64") - 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") @@ -27,6 +24,22 @@ include("${AOM_ROOT}/build/cmake/compiler_flags.cmake") include("${AOM_ROOT}/build/cmake/compiler_tests.cmake") include("${AOM_ROOT}/build/cmake/util.cmake") +if(DEFINED CONFIG_LOWBITDEPTH) + message(WARNING "CONFIG_LOWBITDEPTH has been removed. \ + Use -DFORCE_HIGHBITDEPTH_DECODING=1 instead of -DCONFIG_LOWBITDEPTH=0 \ + and -DFORCE_HIGHBITDEPTH_DECODING=0 instead of -DCONFIG_LOWBITDEPTH=1.") + if(NOT CONFIG_LOWBITDEPTH) + set(FORCE_HIGHBITDEPTH_DECODING + 1 + CACHE STRING "${cmake_cmdline_helpstring}" FORCE) + endif() +endif() + +if(FORCE_HIGHBITDEPTH_DECODING AND NOT CONFIG_AV1_HIGHBITDEPTH) + change_config_and_warn(CONFIG_AV1_HIGHBITDEPTH 1 + "FORCE_HIGHBITDEPTH_DECODING") +endif() + # Generate the user config settings. list(APPEND aom_build_vars ${AOM_CONFIG_VARS} ${AOM_OPTION_VARS}) foreach(cache_var ${aom_build_vars}) @@ -39,28 +52,29 @@ string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG) # Detect target CPU. if(NOT AOM_TARGET_CPU) - if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR - "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" cpu_lowercase) + if("${cpu_lowercase}" STREQUAL "amd64" + OR "${cpu_lowercase}" STREQUAL "x86_64") if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) set(AOM_TARGET_CPU "x86") elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set(AOM_TARGET_CPU "x86_64") else() - message(FATAL_ERROR - "--- Unexpected pointer size (${CMAKE_SIZEOF_VOID_P}) for\n" - " CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}\n" - " CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}\n" - " CMAKE_GENERATOR=${CMAKE_GENERATOR}\n") + message( + FATAL_ERROR "--- Unexpected pointer size (${CMAKE_SIZEOF_VOID_P}) for\n" + " CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}\n" + " CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}\n" + " CMAKE_GENERATOR=${CMAKE_GENERATOR}\n") endif() - elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR - "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86") + elseif("${cpu_lowercase}" STREQUAL "i386" + OR "${cpu_lowercase}" STREQUAL "x86") set(AOM_TARGET_CPU "x86") - elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm" OR - "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^mips") - set(AOM_TARGET_CPU "${CMAKE_SYSTEM_PROCESSOR}") - elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") + elseif("${cpu_lowercase}" MATCHES "^arm" + OR "${cpu_lowercase}" MATCHES "^mips") + set(AOM_TARGET_CPU "${cpu_lowercase}") + elseif("${cpu_lowercase}" MATCHES "aarch64") set(AOM_TARGET_CPU "arm64") - elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^ppc") + elseif("${cpu_lowercase}" MATCHES "^ppc") set(AOM_TARGET_CPU "ppc") else() message(WARNING "The architecture ${CMAKE_SYSTEM_PROCESSOR} is not " @@ -70,8 +84,12 @@ if(NOT AOM_TARGET_CPU) endif() if(CMAKE_TOOLCHAIN_FILE) # Add toolchain file to config string. - file(RELATIVE_PATH toolchain_path "${AOM_CONFIG_DIR}" - "${CMAKE_TOOLCHAIN_FILE}") + if(IS_ABSOLUTE "${CMAKE_TOOLCHAIN_FILE}") + file(RELATIVE_PATH toolchain_path "${AOM_CONFIG_DIR}" + "${CMAKE_TOOLCHAIN_FILE}") + else() + set(toolchain_path "${CMAKE_TOOLCHAIN_FILE}") + endif() set(toolchain_string "-DCMAKE_TOOLCHAIN_FILE=\\\"${toolchain_path}\\\"") set(AOM_CMAKE_CONFIG "${toolchain_string} ${AOM_CMAKE_CONFIG}") else() @@ -94,7 +112,6 @@ endif() if(BUILD_SHARED_LIBS) set(CONFIG_PIC 1) set(CONFIG_SHARED 1) - set(CONFIG_STATIC 0) endif() if(NOT MSVC) @@ -103,8 +120,8 @@ if(NOT MSVC) # TODO(tomfinegan): clang needs -pie in CMAKE_EXE_LINKER_FLAGS for this to # work. set(CMAKE_POSITION_INDEPENDENT_CODE ON) - if("${AOM_TARGET_SYSTEM}" STREQUAL "Linux" AND "${AOM_TARGET_CPU}" MATCHES - "^armv7") + if("${AOM_TARGET_SYSTEM}" STREQUAL "Linux" + AND "${AOM_TARGET_CPU}" MATCHES "^armv[78]") set(AOM_AS_FLAGS ${AOM_AS_FLAGS} --defsym PIC=1) else() set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -DPIC) @@ -112,13 +129,6 @@ if(NOT MSVC) endif() endif() -if(NOT "${AOM_SUPPORTED_CPU_TARGETS}" MATCHES "${AOM_TARGET_CPU}") - message(FATAL_ERROR - "No RTCD support for ${AOM_TARGET_CPU}. Create it, or " - "add -DAOM_TARGET_CPU=generic to your cmake command line for a " - "generic build of libaom and tools.") -endif() - if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64") find_program(AS_EXECUTABLE yasm $ENV{YASM_PATH}) if(NOT AS_EXECUTABLE OR ENABLE_NASM) @@ -130,10 +140,11 @@ if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64") endif() if(NOT AS_EXECUTABLE) - message(FATAL_ERROR - "Unable to find assembler. Install 'yasm' or 'nasm.' " - "To build without optimizations, add -DAOM_TARGET_CPU=generic to " - "your cmake command line.") + message( + FATAL_ERROR + "Unable to find assembler. Install 'yasm' or 'nasm.' " + "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}) @@ -142,20 +153,26 @@ elseif("${AOM_TARGET_CPU}" MATCHES "arm") if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") set(AS_EXECUTABLE as) set(AOM_AS_FLAGS -arch ${AOM_TARGET_CPU} -isysroot ${CMAKE_OSX_SYSROOT}) - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux") - if(NOT AS_EXECUTABLE) - set(AS_EXECUTABLE as) - endif() elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Windows") if(NOT AS_EXECUTABLE) set(AS_EXECUTABLE ${CMAKE_C_COMPILER} -c -mimplicit-it=always) endif() + else() + if(NOT AS_EXECUTABLE) + set(AS_EXECUTABLE as) + endif() endif() - if(NOT AS_EXECUTABLE) - message(FATAL_ERROR - "Unknown assembler for: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}") + find_program(as_executable_found ${AS_EXECUTABLE}) + if(NOT as_executable_found) + message( + FATAL_ERROR + "Unable to find assembler and optimizations are enabled." + "Searched for ${AS_EXECUTABLE}. Install it, add it to your path, or " + "set the assembler directly by adding -DAS_EXECUTABLE=<assembler path> " + "to your CMake command line." + "To build without optimizations, add -DAOM_TARGET_CPU=generic to your " + "cmake command line.") endif() - string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS) endif() @@ -180,10 +197,16 @@ if(CONFIG_GPROF) require_compiler_flag("-pg" YES) endif() -if("${AOM_TARGET_SYSTEM}" MATCHES "Darwin\|Linux\|Windows") +if("${AOM_TARGET_SYSTEM}" MATCHES "Darwin\|Linux\|Windows\|Android") set(CONFIG_OS_SUPPORT 1) endif() +# The default _WIN32_WINNT value in MinGW is 0x0502 (Windows XP with SP2). Set +# it to 0x0601 (Windows 7). +if("${AOM_TARGET_SYSTEM}" STREQUAL "Windows") + add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601") +endif() + # # Fix CONFIG_* dependencies. This must be done before including cpu.cmake to # ensure RTCD_CONFIG_* are properly set. @@ -199,15 +222,12 @@ 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 + 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) + }" HAVE_FEXCEPT) aom_pop_var(CMAKE_REQUIRED_LIBRARIES) endif() @@ -252,13 +272,15 @@ if(MSVC) endif() else() require_c_flag("-std=c99" YES) + require_cxx_flag_nomsvc("-std=c++11" YES) add_compiler_flag_if_supported("-Wall") add_compiler_flag_if_supported("-Wdisabled-optimization") add_compiler_flag_if_supported("-Wextra") add_compiler_flag_if_supported("-Wfloat-conversion") - add_compiler_flag_if_supported("-Wimplicit-function-declaration") + add_c_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("-Wshorten-64-to-32") add_compiler_flag_if_supported("-Wsign-compare") add_compiler_flag_if_supported("-Wstring-conversion") add_compiler_flag_if_supported("-Wtype-limits") @@ -266,12 +288,20 @@ else() add_compiler_flag_if_supported("-Wunused") add_compiler_flag_if_supported("-Wvla") - add_c_flag_if_supported("-Wstack-usage=100000") - add_cxx_flag_if_supported("-Wstack-usage=360000") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" + AND "${SANITIZE}" MATCHES "address|undefined") - # TODO(jzern): this could be added as a cxx flags for test/*.cc only, avoiding - # third_party. - add_c_flag_if_supported("-Wshorten-64-to-32") + # This combination has more stack overhead, so we account for it by + # providing higher stack limit than usual. + add_c_flag_if_supported("-Wstack-usage=170000") + add_cxx_flag_if_supported("-Wstack-usage=270000") + elseif(CONFIG_RD_DEBUG) # Another case where higher stack usage is expected. + add_c_flag_if_supported("-Wstack-usage=117000") + add_cxx_flag_if_supported("-Wstack-usage=240000") + else() + add_c_flag_if_supported("-Wstack-usage=100000") + add_cxx_flag_if_supported("-Wstack-usage=240000") + endif() # Add -Wshadow only for C files to avoid massive gtest warning spam. add_c_flag_if_supported("-Wshadow") @@ -307,10 +337,10 @@ endif() # Generate aom_config templates. set(aom_config_asm_template "${AOM_CONFIG_DIR}/config/aom_config.asm.cmake") set(aom_config_h_template "${AOM_CONFIG_DIR}/config/aom_config.h.cmake") -execute_process(COMMAND - ${CMAKE_COMMAND} -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} - -DAOM_ROOT=${AOM_ROOT} -P - "${AOM_ROOT}/build/cmake/generate_aom_config_templates.cmake") +execute_process( + COMMAND ${CMAKE_COMMAND} + -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} -DAOM_ROOT=${AOM_ROOT} -P + "${AOM_ROOT}/build/cmake/generate_aom_config_templates.cmake") # Generate aom_config.{asm,h}. configure_file("${aom_config_asm_template}" @@ -334,14 +364,14 @@ if(NOT PERL_FOUND) endif() set(AOM_RTCD_CONFIG_FILE_LIST "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl" - "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl" - "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl") + "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl" + "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl") set(AOM_RTCD_HEADER_FILE_LIST "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h" - "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h" - "${AOM_CONFIG_DIR}/config/av1_rtcd.h") + "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h" + "${AOM_CONFIG_DIR}/config/av1_rtcd.h") set(AOM_RTCD_SOURCE_FILE_LIST "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c" - "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" - "${AOM_ROOT}/av1/common/av1_rtcd.c") + "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" + "${AOM_ROOT}/av1/common/av1_rtcd.c") set(AOM_RTCD_SYMBOL_LIST aom_dsp_rtcd aom_scale_rtcd av1_rtcd) list(LENGTH AOM_RTCD_SYMBOL_LIST AOM_RTCD_CUSTOM_COMMAND_COUNT) math(EXPR AOM_RTCD_CUSTOM_COMMAND_COUNT "${AOM_RTCD_CUSTOM_COMMAND_COUNT} - 1") @@ -351,27 +381,19 @@ foreach(NUM RANGE ${AOM_RTCD_CUSTOM_COMMAND_COUNT}) list(GET AOM_RTCD_HEADER_FILE_LIST ${NUM} AOM_RTCD_HEADER_FILE) list(GET AOM_RTCD_SOURCE_FILE_LIST ${NUM} AOM_RTCD_SOURCE_FILE) list(GET AOM_RTCD_SYMBOL_LIST ${NUM} AOM_RTCD_SYMBOL) - execute_process(COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/rtcd.pl" - --arch=${AOM_TARGET_CPU} - --sym=${AOM_RTCD_SYMBOL} ${AOM_RTCD_FLAGS} - --config=${AOM_CONFIG_DIR}/config/aom_config.h - ${AOM_RTCD_CONFIG_FILE} - OUTPUT_FILE ${AOM_RTCD_HEADER_FILE}) + execute_process( + COMMAND + ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/rtcd.pl" + --arch=${AOM_TARGET_CPU} + --sym=${AOM_RTCD_SYMBOL} ${AOM_RTCD_FLAGS} + --config=${AOM_CONFIG_DIR}/config/aom_config.h ${AOM_RTCD_CONFIG_FILE} + OUTPUT_FILE ${AOM_RTCD_HEADER_FILE}) endforeach() # Generate aom_version.h. -execute_process(COMMAND ${CMAKE_COMMAND} -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} +execute_process(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") - -if(NOT MSVC) # 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() diff --git a/media/libaom/src/build/cmake/aom_experiment_deps.cmake b/media/libaom/src/build/cmake/aom_experiment_deps.cmake index 0688704e5f..2e3615791e 100644 --- a/media/libaom/src/build/cmake/aom_experiment_deps.cmake +++ b/media/libaom/src/build/cmake/aom_experiment_deps.cmake @@ -21,10 +21,6 @@ macro(fix_experiment_configs) change_config_and_warn(CONFIG_INSPECTION 1 CONFIG_ANALYZER) endif() - if(CONFIG_RD_DEBUG) - change_config_and_warn(CONFIG_RD_DEBUG 0 CONFIG_JNT_COMP) - endif() - if(CONFIG_DIST_8X8 AND CONFIG_MULTITHREAD) change_config_and_warn(CONFIG_DIST_8X8 0 CONFIG_MULTITHREAD) endif() diff --git a/media/libaom/src/build/cmake/aom_install.cmake b/media/libaom/src/build/cmake/aom_install.cmake new file mode 100644 index 0000000000..cd40fe4245 --- /dev/null +++ b/media/libaom/src/build/cmake/aom_install.cmake @@ -0,0 +1,96 @@ +# +# Copyright (c) 2018, 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. +# +list(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aom.h" + "${AOM_ROOT}/aom/aom_codec.h" "${AOM_ROOT}/aom/aom_frame_buffer.h" + "${AOM_ROOT}/aom/aom_image.h" "${AOM_ROOT}/aom/aom_integer.h" + "${AOM_ROOT}/aom/aom.h") + +if(CONFIG_AV1_DECODER) + list(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aom_decoder.h" + "${AOM_ROOT}/aom/aomdx.h") +endif() + +if(CONFIG_AV1_ENCODER) + list(APPEND AOM_INSTALL_INCS "${AOM_ROOT}/aom/aomcx.h" + "${AOM_ROOT}/aom/aom_encoder.h") +endif() + +# Generate aom.pc and setup dependencies to ensure it is created when necessary. +# Note: aom.pc generation uses GNUInstallDirs: +# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html +macro(setup_aom_install_targets) + if(NOT (MSVC OR XCODE)) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + + # Create a dummy library target for creating aom.pc. + create_dummy_source_file(aom_pc c AOM_PKG_CONFIG_SOURCES) + add_library(aom_pc ${AOM_PKG_CONFIG_SOURCES}) + + # Setup a rule to generate aom.pc. + add_custom_command( + OUTPUT "${AOM_PKG_CONFIG_FILE}" + COMMAND ${CMAKE_COMMAND} ARGS + -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} -DAOM_ROOT=${AOM_ROOT} + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME} + -DCONFIG_MULTITHREAD=${CONFIG_MULTITHREAD} + -DHAVE_PTHREAD_H=${HAVE_PTHREAD_H} -P + "${AOM_ROOT}/build/cmake/pkg_config.cmake" + COMMENT "Writing aom.pc" + VERBATIM) + + # Explicitly add a dependency on the pkg-config file to ensure it's built. + get_property(aom_pc_sources TARGET aom_pc PROPERTY SOURCES) + set_source_files_properties(${aom_pc_sources} OBJECT_DEPENDS + "${AOM_PKG_CONFIG_FILE}") + + # Our pkg-config file carries version information: add a dependency on the + # version rule. + add_dependencies(aom_pc aom_version) + + if(CONFIG_AV1_DECODER) + if(ENABLE_EXAMPLES) + list(APPEND AOM_INSTALL_BINS aomdec) + endif() + endif() + + if(CONFIG_AV1_ENCODER) + if(ENABLE_EXAMPLES) + list(APPEND AOM_INSTALL_BINS aomenc) + endif() + endif() + + if(BUILD_SHARED_LIBS) + set(AOM_INSTALL_LIBS aom aom_static) + else() + set(AOM_INSTALL_LIBS aom) + endif() + + # Setup the install rules. + install( + FILES ${AOM_INSTALL_INCS} + DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/aom") + install( + FILES "${AOM_PKG_CONFIG_FILE}" + DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + + if(ENABLE_EXAMPLES) + install(TARGETS ${AOM_INSTALL_BINS} DESTINATION + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + endif() + endif() +endmacro() diff --git a/media/libaom/src/build/cmake/aom_optimization.cmake b/media/libaom/src/build/cmake/aom_optimization.cmake index be32a32126..d8b258f1e6 100644 --- a/media/libaom/src/build/cmake/aom_optimization.cmake +++ b/media/libaom/src/build/cmake/aom_optimization.cmake @@ -35,11 +35,10 @@ endfunction() # $opt_name is used to name the target. $target_to_update is made dependent upon # the created target. # -# Note: the libaom target is always updated because OBJECT libraries have rules -# that disallow the direct addition of .o files to them as dependencies. Static -# libraries do not have this limitation. -function(add_intrinsics_object_library flag opt_name target_to_update sources - dependent_target) +# Note: this function always updates the aom, and aom_static targets because +# OBJECT libraries have rules that disallow the direct addition of .o files to +# them as dependencies. Static and shared libraries do not have this limitation. +function(add_intrinsics_object_library flag opt_name target_to_update sources) if("${${sources}}" STREQUAL "") return() endif() @@ -50,12 +49,29 @@ function(add_intrinsics_object_library flag opt_name target_to_update sources get_msvc_intrinsic_flag(${flag} "flag") endif() + if("${flag}" STREQUAL "-mavx2") + unset(FLAG_SUPPORTED) + check_c_compiler_flag("-mno-avx256-split-unaligned-load" FLAG_SUPPORTED) + if(${FLAG_SUPPORTED}) + set(flag "${flag} -mno-avx256-split-unaligned-load") + endif() + + unset(FLAG_SUPPORTED) + check_c_compiler_flag("-mno-avx256-split-unaligned-store" FLAG_SUPPORTED) + if(${FLAG_SUPPORTED}) + set(flag "${flag} -mno-avx256-split-unaligned-store") + endif() + endif() + if(flag) separate_arguments(flag) target_compile_options(${target_name} PUBLIC ${flag}) endif() - target_sources(${dependent_target} PRIVATE $<TARGET_OBJECTS:${target_name}>) + target_sources(aom PRIVATE $<TARGET_OBJECTS:${target_name}>) + if(BUILD_SHARED_LIBS) + target_sources(aom_static PRIVATE $<TARGET_OBJECTS:${target_name}>) + endif() # Add the new lib target to the global list of aom library targets. list(APPEND AOM_LIB_TARGETS ${target_name}) @@ -83,28 +99,24 @@ function(get_asm_obj_format out_format) if("${AOM_TARGET_CPU}" STREQUAL "x86_64") if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") set(objformat "macho64") - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux") - set(objformat "elf64") - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}" - STREQUAL "Windows") + elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" + OR "${AOM_TARGET_SYSTEM}" STREQUAL "Windows") set(objformat "win64") else() - message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}") + set(objformat "elf64") endif() elseif("${AOM_TARGET_CPU}" STREQUAL "x86") if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") set(objformat "macho32") - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux") - set(objformat "elf32") - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}" - STREQUAL "Windows") + elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" + OR "${AOM_TARGET_SYSTEM}" STREQUAL "Windows") set(objformat "win32") else() - message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}") + set(objformat "elf32") endif() else() - message(FATAL_ERROR - "Unknown obj format: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}") + message( + FATAL_ERROR "Unknown obj format: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}") endif() set(${out_format} ${objformat} PARENT_SCOPE) @@ -112,10 +124,10 @@ endfunction() # Adds library target named $lib_name for ASM files in variable named by # $asm_sources. Builds an output directory path from $lib_name. Links $lib_name -# into $dependent_target. Generates a dummy C file with a dummy function to -# ensure that all cmake generators can determine the linker language, and that -# build tools don't complain that an object exposes no symbols. -function(add_asm_library lib_name asm_sources dependent_target) +# into the aom library target(s). Generates a dummy C file with a dummy function +# to ensure that all cmake generators can determine the linker language, and +# that build tools don't complain that an object exposes no symbols. +function(add_asm_library lib_name asm_sources) if("${${asm_sources}}" STREQUAL "") return() endif() @@ -138,8 +150,12 @@ function(add_asm_library lib_name asm_sources dependent_target) "${asm_object}" "${asm_source}" DEPENDS "${asm_source}" COMMENT "Building ASM object ${asm_object}" - WORKING_DIRECTORY "${AOM_CONFIG_DIR}" VERBATIM) + WORKING_DIRECTORY "${AOM_CONFIG_DIR}" + VERBATIM) target_sources(aom PRIVATE "${asm_object}") + if(BUILD_SHARED_LIBS) + target_sources(aom_static PRIVATE "${asm_object}") + endif() endforeach() # The above created a target containing only ASM sources. Cmake needs help @@ -161,32 +177,44 @@ function(test_nasm) execute_process(COMMAND ${AS_EXECUTABLE} -hf OUTPUT_VARIABLE nasm_helptext) if(NOT "${nasm_helptext}" MATCHES "-Ox") - message(FATAL_ERROR - "Unsupported nasm: multipass optimization not supported.") + message( + FATAL_ERROR "Unsupported nasm: multipass optimization not supported.") endif() if("${AOM_TARGET_CPU}" STREQUAL "x86") if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") if(NOT "${nasm_helptext}" MATCHES "macho32") - message(FATAL_ERROR - "Unsupported nasm: macho32 object format not supported.") + message( + FATAL_ERROR "Unsupported nasm: macho32 object format not supported.") + endif() + elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" + OR "${AOM_TARGET_SYSTEM}" STREQUAL "Windows") + if(NOT "${nasm_helptext}" MATCHES "win32") + message( + FATAL_ERROR "Unsupported nasm: win32 object format not supported.") endif() - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux") + else() if(NOT "${nasm_helptext}" MATCHES "elf32") - message(FATAL_ERROR - "Unsupported nasm: elf32 object format not supported.") + message( + FATAL_ERROR "Unsupported nasm: elf32 object format not supported.") endif() endif() else() if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") if(NOT "${nasm_helptext}" MATCHES "macho64") - message(FATAL_ERROR - "Unsupported nasm: macho64 object format not supported.") + message( + FATAL_ERROR "Unsupported nasm: macho64 object format not supported.") + endif() + elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" + OR "${AOM_TARGET_SYSTEM}" STREQUAL "Windows") + if(NOT "${nasm_helptext}" MATCHES "win64") + message( + FATAL_ERROR "Unsupported nasm: win64 object format not supported.") endif() - elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux") + else() if(NOT "${nasm_helptext}" MATCHES "elf64") - message(FATAL_ERROR - "Unsupported nasm: elf64 object format not supported.") + message( + FATAL_ERROR "Unsupported nasm: elf64 object format not supported.") endif() endif() endif() @@ -197,16 +225,16 @@ endfunction() # 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/cmake/rtcd.pl" - --arch=${AOM_TARGET_CPU} - --sym=${symbol} ${AOM_RTCD_FLAGS} - --config=${AOM_CONFIG_DIR}/config/aom_config.h - ${config} > ${output} - DEPENDS ${config} - COMMENT "Generating ${output}" - WORKING_DIRECTORY ${AOM_CONFIG_DIR} VERBATIM) + add_custom_command( + OUTPUT ${output} + COMMAND ${PERL_EXECUTABLE} ARGS "${AOM_ROOT}/build/cmake/rtcd.pl" + --arch=${AOM_TARGET_CPU} + --sym=${symbol} ${AOM_RTCD_FLAGS} + --config=${AOM_CONFIG_DIR}/config/aom_config.h ${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() diff --git a/media/libaom/src/build/cmake/compiler_flags.cmake b/media/libaom/src/build/cmake/compiler_flags.cmake index 79192c1fa8..24484bcade 100644 --- a/media/libaom/src/build/cmake/compiler_flags.cmake +++ b/media/libaom/src/build/cmake/compiler_flags.cmake @@ -131,8 +131,8 @@ function(require_c_flag c_flag update_c_flags) 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}.") + message( + FATAL_ERROR "${PROJECT_NAME} requires support for C flag: ${c_flag}.") endif() if(NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "") @@ -167,8 +167,8 @@ function(require_cxx_flag cxx_flag update_cxx_flags) 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}.") + message( + FATAL_ERROR "${PROJECT_NAME} requires support for C flag: ${cxx_flag}.") endif() if(NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "") diff --git a/media/libaom/src/build/cmake/compiler_tests.cmake b/media/libaom/src/build/cmake/compiler_tests.cmake index f115610baf..0402832253 100644 --- a/media/libaom/src/build/cmake/compiler_tests.cmake +++ b/media/libaom/src/build/cmake/compiler_tests.cmake @@ -87,10 +87,12 @@ function(aom_check_c_compiles test_name test_source result_var) set(${result_var} ${C_TEST_COMPILED} PARENT_SCOPE) if(C_TEST_COMPILED) - set(AOM_C_PASSED_TESTS "${AOM_C_PASSED_TESTS} ${test_name}" + 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}" + set(AOM_C_FAILED_TESTS + "${AOM_C_FAILED_TESTS} ${test_name}" CACHE STRING "" FORCE) message("C Compiler test ${test_name} failed.") endif() @@ -123,10 +125,12 @@ function(aom_check_cxx_compiles test_name test_source result_var) set(${result_var} ${CXX_TEST_COMPILED} PARENT_SCOPE) if(CXX_TEST_COMPILED) - set(AOM_CXX_PASSED_TESTS "${AOM_CXX_PASSED_TESTS} ${test_name}" + 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}" + set(AOM_CXX_FAILED_TESTS + "${AOM_CXX_FAILED_TESTS} ${test_name}" CACHE STRING "" FORCE) message("CXX Compiler test ${test_name} failed.") endif() diff --git a/media/libaom/src/build/cmake/cpu.cmake b/media/libaom/src/build/cmake/cpu.cmake index 6e8089e635..ef2d7552bb 100644 --- a/media/libaom/src/build/cmake/cpu.cmake +++ b/media/libaom/src/build/cmake/cpu.cmake @@ -9,18 +9,7 @@ # can obtain it at www.aomedia.org/license/patent. # -if("${AOM_TARGET_CPU}" STREQUAL "arm64") - set(ARCH_ARM 1) - set(RTCD_ARCH_ARM "yes") - - if(ENABLE_NEON) - set(HAVE_NEON 1) - set(RTCD_HAVE_NEON "yes") - else() - set(HAVE_NEON 0) - set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-neon) - endif() -elseif("${AOM_TARGET_CPU}" MATCHES "^armv7") +if("${AOM_TARGET_CPU}" MATCHES "^arm") set(ARCH_ARM 1) set(RTCD_ARCH_ARM "yes") diff --git a/media/libaom/src/build/cmake/dist.cmake b/media/libaom/src/build/cmake/dist.cmake index 6f81736f00..5b9fc95d41 100644 --- a/media/libaom/src/build/cmake/dist.cmake +++ b/media/libaom/src/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_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 "") diff --git a/media/libaom/src/build/cmake/exports.cmake b/media/libaom/src/build/cmake/exports.cmake index e0813dc0f2..fa7842c9d9 100644 --- a/media/libaom/src/build/cmake/exports.cmake +++ b/media/libaom/src/build/cmake/exports.cmake @@ -28,14 +28,19 @@ function(setup_exports_target) set(aom_sym_file "${AOM_CONFIG_DIR}/libaom.${symbol_file_ext}") add_custom_target(generate_exports - COMMAND ${CMAKE_COMMAND} -DAOM_ROOT="${AOM_ROOT}" + COMMAND ${CMAKE_COMMAND} + -DAOM_ROOT="${AOM_ROOT}" -DAOM_CONFIG_DIR="${AOM_CONFIG_DIR}" -DAOM_TARGET_SYSTEM=${AOM_TARGET_SYSTEM} - -DAOM_SYM_FILE="${aom_sym_file}" -DAOM_MSVC=${MSVC} - -DAOM_XCODE=${XCODE} -DCONFIG_NAME=$<CONFIG> + -DAOM_SYM_FILE="${aom_sym_file}" + -DAOM_MSVC=${MSVC} + -DAOM_XCODE=${XCODE} + -DCONFIG_NAME=$<CONFIG> -DCONFIG_AV1_DECODER=${CONFIG_AV1_DECODER} -DCONFIG_AV1_ENCODER=${CONFIG_AV1_ENCODER} - -DENABLE_TESTS=${ENABLE_TESTS} -P + -DCONFIG_INSPECTION=${CONFIG_INSPECTION} + -DENABLE_TESTS=${ENABLE_TESTS} + -P "${AOM_ROOT}/build/cmake/generate_exports.cmake" SOURCES ${AOM_EXPORTS_SOURCES} DEPENDS ${AOM_EXPORTS_SOURCES}) @@ -45,21 +50,25 @@ function(setup_exports_target) add_dependencies(aom generate_exports) if(APPLE) - set_property(TARGET aom APPEND_STRING + set_property(TARGET aom + APPEND_STRING PROPERTY LINK_FLAGS "-exported_symbols_list ${aom_sym_file}") elseif(WIN32) if(NOT MSVC) - set_property(TARGET aom APPEND_STRING + set_property(TARGET aom + APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--version-script ${aom_sym_file}") else() - set_property(TARGET aom APPEND_STRING + set_property(TARGET aom + APPEND_STRING PROPERTY LINK_FLAGS "/DEF:${aom_sym_file}") endif() # TODO(tomfinegan): Sort out the import lib situation and flags for MSVC. else() - set_property(TARGET aom APPEND_STRING + set_property(TARGET aom + APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--version-script,${aom_sym_file}") endif() endfunction() diff --git a/media/libaom/src/build/cmake/exports_sources.cmake b/media/libaom/src/build/cmake/exports_sources.cmake index 576920e36c..46bf001d86 100644 --- a/media/libaom/src/build/cmake/exports_sources.cmake +++ b/media/libaom/src/build/cmake/exports_sources.cmake @@ -19,6 +19,9 @@ list(APPEND AOM_EXPORTS_SOURCES "${AOM_ROOT}/aom/exports_com" if(CONFIG_AV1_DECODER) list(APPEND AOM_EXPORTS_SOURCES "${AOM_ROOT}/aom/exports_dec" "${AOM_ROOT}/av1/exports_dec") + if(CONFIG_INSPECTION) + list(APPEND AOM_EXPORTS_SOURCES "${AOM_ROOT}/av1/exports_ident") + endif() endif() if(CONFIG_AV1_ENCODER) diff --git a/media/libaom/src/build/cmake/generate_aom_config_templates.cmake b/media/libaom/src/build/cmake/generate_aom_config_templates.cmake index b91c036de8..529daaf02a 100644 --- a/media/libaom/src/build/cmake/generate_aom_config_templates.cmake +++ b/media/libaom/src/build/cmake/generate_aom_config_templates.cmake @@ -11,9 +11,7 @@ cmake_minimum_required(VERSION 3.5) string(TIMESTAMP year "%Y") -set( - asm_file_header_block - "\; +set(asm_file_header_block "\; \; Copyright (c) ${year}, Alliance for Open Media. All rights reserved \; \; This source code is subject to the terms of the BSD 2 Clause License and @@ -23,11 +21,8 @@ set( \; 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. \; -" - ) -set( - h_file_header_block - "/* +") +set(h_file_header_block "/* * Copyright (c) ${year}, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and @@ -39,11 +34,8 @@ set( */ \#ifndef AOM_CONFIG_H_ \#define AOM_CONFIG_H_ -" - ) -set( - cmake_file_header_block - "## +") +set(cmake_file_header_block "## ## Copyright (c) ${year}, Alliance for Open Media. All rights reserved ## ## This source code is subject to the terms of the BSD 2 Clause License and @@ -53,8 +45,7 @@ set( ## 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. ## -" - ) +") # Terminates cmake execution when $var_name is an empty string, or the variable # name it contains does not expand to an existing directory. @@ -73,8 +64,8 @@ check_directory_var(AOM_ROOT) set(AOM_DEFAULTS "${AOM_ROOT}/build/cmake/aom_config_defaults.cmake") if(NOT EXISTS "${AOM_DEFAULTS}") - message(FATAL_ERROR - "Configuration default values file (${AOM_DEFAULTS}) missing.") + message( + FATAL_ERROR "Configuration default values file (${AOM_DEFAULTS}) missing.") endif() include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake") @@ -86,7 +77,7 @@ file(WRITE "${aom_config_h_template}" ${h_file_header_block}) foreach(aom_var ${aom_build_vars}) if(NOT "${aom_var}" STREQUAL "AOM_RTCD_FLAGS") file(APPEND "${aom_config_h_template}" - "\#define ${aom_var} \${${aom_var}}\n") + "\#define ${aom_var} \${${aom_var}}\n") endif() endforeach() file(APPEND "${aom_config_h_template}" "\#endif // AOM_CONFIG_H_") @@ -94,8 +85,8 @@ file(APPEND "${aom_config_h_template}" "\#endif // AOM_CONFIG_H_") set(aom_asm_config_template "${AOM_CONFIG_DIR}/config/aom_config.asm.cmake") file(WRITE "${aom_asm_config_template}" ${asm_file_header_block}) foreach(aom_var ${aom_build_vars}) - if(NOT "${aom_var}" STREQUAL "INLINE" AND NOT "${aom_var}" STREQUAL - "AOM_RTCD_FLAGS") + if(NOT "${aom_var}" STREQUAL "INLINE" + AND NOT "${aom_var}" STREQUAL "AOM_RTCD_FLAGS") file(APPEND "${aom_asm_config_template}" "${aom_var} equ \${${aom_var}}\n") endif() endforeach() diff --git a/media/libaom/src/build/cmake/generate_exports.cmake b/media/libaom/src/build/cmake/generate_exports.cmake index 7ab5aaef89..f1d15a0fa7 100644 --- a/media/libaom/src/build/cmake/generate_exports.cmake +++ b/media/libaom/src/build/cmake/generate_exports.cmake @@ -10,8 +10,8 @@ # cmake_minimum_required(VERSION 3.5) -set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_TARGET_SYSTEM" - "AOM_SYM_FILE" "CONFIG_AV1_DECODER" "CONFIG_AV1_ENCODER") +set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_TARGET_SYSTEM" "AOM_SYM_FILE" + "CONFIG_AV1_DECODER" "CONFIG_AV1_ENCODER") foreach(arg ${REQUIRED_ARGS}) if("${${arg}}" STREQUAL "") diff --git a/media/libaom/src/build/cmake/pkg_config.cmake b/media/libaom/src/build/cmake/pkg_config.cmake index 64e20214e9..c3914d79ea 100644 --- a/media/libaom/src/build/cmake/pkg_config.cmake +++ b/media/libaom/src/build/cmake/pkg_config.cmake @@ -11,7 +11,9 @@ 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") + "CMAKE_INSTALL_BINDIR" "CMAKE_INSTALL_INCLUDEDIR" + "CMAKE_INSTALL_LIBDIR" "CMAKE_PROJECT_NAME" + "CONFIG_MULTITHREAD" "HAVE_PTHREAD_H") foreach(arg ${REQUIRED_ARGS}) if("${${arg}}" STREQUAL "") @@ -34,25 +36,27 @@ endif() # Write pkg-config info. set(prefix "${CMAKE_INSTALL_PREFIX}") +set(bindir "${CMAKE_INSTALL_BINDIR}") +set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") +set(libdir "${CMAKE_INSTALL_LIBDIR}") 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}" "exec_prefix=\${prefix}\n") +file(APPEND "${pkgconfig_file}" "includedir=\${prefix}/${includedir}\n") +file(APPEND "${pkgconfig_file}" "libdir=\${exec_prefix}/${libdir}\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}" + "Description: Alliance for Open Media 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\${libdir} -l${pkg_name}\n") if(CONFIG_MULTITHREAD AND HAVE_PTHREAD_H) - file(APPEND "${pkgconfig_file}" - "Libs: -L\${prefix}/lib -l${pkg_name} -lm -lpthread\n") file(APPEND "${pkgconfig_file}" "Libs.private: -lm -lpthread\n") else() - file(APPEND "${pkgconfig_file}" "Libs: -L\${prefix}/lib -l${pkg_name} -lm\n") file(APPEND "${pkgconfig_file}" "Libs.private: -lm\n") endif() -file(APPEND "${pkgconfig_file}" "Cflags: -I\${prefix}/include\n") +file(APPEND "${pkgconfig_file}" "Cflags: -I\${includedir}\n") diff --git a/media/libaom/src/build/cmake/rtcd.pl b/media/libaom/src/build/cmake/rtcd.pl index 46e06907cc..dafccdca9c 100644 --- a/media/libaom/src/build/cmake/rtcd.pl +++ b/media/libaom/src/build/cmake/rtcd.pl @@ -426,10 +426,10 @@ if ($opts{arch} eq 'x86') { @ALL_ARCHS = filter("$opts{arch}", qw/msa/); } mips; -} elsif ($opts{arch} =~ /armv7\w?/) { +} elsif ($opts{arch} =~ /armv[78]\w?/) { @ALL_ARCHS = filter(qw/neon/); arm; -} elsif ($opts{arch} eq 'armv8' || $opts{arch} eq 'arm64' ) { +} elsif ($opts{arch} eq 'arm64' ) { @ALL_ARCHS = filter(qw/neon/); &require("neon"); arm; diff --git a/media/libaom/src/build/cmake/sanitizers.cmake b/media/libaom/src/build/cmake/sanitizers.cmake index 77708e101c..bcb600ce4c 100644 --- a/media/libaom/src/build/cmake/sanitizers.cmake +++ b/media/libaom/src/build/cmake/sanitizers.cmake @@ -21,9 +21,17 @@ 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) +# Require the sanitizer requested. cfi sanitizer requires all the flags in order +# for the compiler to accept it. +if("${SANITIZE}" MATCHES "cfi" AND CMAKE_C_COMPILER_ID MATCHES "Clang") + require_linker_flag("-fsanitize=${SANITIZE} -flto -fno-sanitize-trap=cfi \ + -fuse-ld=gold" YES) + require_compiler_flag("-fsanitize=${SANITIZE} -flto -fvisibility=hidden \ + -fno-sanitize-trap=cfi" YES) +else() + require_linker_flag("-fsanitize=${SANITIZE}") + require_compiler_flag("-fsanitize=${SANITIZE}" YES) +endif() # Make callstacks accurate. require_compiler_flag("-fno-omit-frame-pointer -fno-optimize-sibling-calls" YES) @@ -31,8 +39,8 @@ require_compiler_flag("-fno-omit-frame-pointer -fno-optimize-sibling-calls" YES) # Fix link errors due to missing rt compiler lib in 32-bit builds. # http://llvm.org/bugs/show_bug.cgi?id=17693 if(CMAKE_C_COMPILER_ID MATCHES "Clang") - if(${CMAKE_SIZEOF_VOID_P} EQUAL 4 AND "${SANITIZE}" MATCHES - "integer|undefined") + if(${CMAKE_SIZEOF_VOID_P} EQUAL 4 + AND "${SANITIZE}" MATCHES "integer|undefined") require_linker_flag("--rtlib=compiler-rt -lgcc_s") endif() endif() diff --git a/media/libaom/src/build/cmake/toolchains/arm-ios-common.cmake b/media/libaom/src/build/cmake/toolchains/arm-ios-common.cmake index 8f40951455..053e33a271 100644 --- a/media/libaom/src/build/cmake/toolchains/arm-ios-common.cmake +++ b/media/libaom/src/build/cmake/toolchains/arm-ios-common.cmake @@ -21,6 +21,6 @@ set(CMAKE_CXX_COMPILER clang++) set(CMAKE_CXX_COMPILER_ARG1 "-arch ${CMAKE_SYSTEM_PROCESSOR}") # No runtime cpu detect for arm*-ios targets. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") # TODO(tomfinegan): Handle bit code embedding. diff --git a/media/libaom/src/build/cmake/toolchains/arm64-android-clang.cmake b/media/libaom/src/build/cmake/toolchains/arm64-android-clang.cmake new file mode 100644 index 0000000000..c13b1d96c5 --- /dev/null +++ b/media/libaom/src/build/cmake/toolchains/arm64-android-clang.cmake @@ -0,0 +1,48 @@ +# +# Copyright (c) 2019, 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_TOOLCHAINS_ARM64_ANDROID_CLANG_CMAKE_) + return() +endif() # AOM_BUILD_CMAKE_TOOLCHAINS_ARM64_ANDROID_CLANG_CMAKE_ +set(AOM_BUILD_CMAKE_TOOLCHAINS_ARM64_ANDROID_CLANG_CMAKE_ 1) + +if(NOT ANDROID_PLATFORM) + set(ANDROID_PLATFORM android-21) +endif() + +if(NOT ANDROID_ABI) + set(ANDROID_ABI arm64-v8a) +endif() + +set(AS_EXECUTABLE as) + +# Toolchain files don't have access to cached variables: +# https://gitlab.kitware.com/cmake/cmake/issues/16170. Set an intermediate +# environment variable when loaded the first time. +if(AOM_ANDROID_NDK_PATH) + set(ENV{_AOM_ANDROID_NDK_PATH} "${AOM_ANDROID_NDK_PATH}") +else() + set(AOM_ANDROID_NDK_PATH "$ENV{_AOM_ANDROID_NDK_PATH}") +endif() + +if("${AOM_ANDROID_NDK_PATH}" STREQUAL "") + message(FATAL_ERROR "AOM_ANDROID_NDK_PATH not set.") + return() +endif() + +include("${AOM_ANDROID_NDK_PATH}/build/cmake/android.toolchain.cmake") + +# No intrinsics flag required for arm64-android-clang. +set(AOM_NEON_INTRIN_FLAG "") + +# No runtime cpu detect for arm64-android-clang. +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") + +set(CMAKE_SYSTEM_NAME "Android") diff --git a/media/libaom/src/build/cmake/toolchains/arm64-linux-gcc.cmake b/media/libaom/src/build/cmake/toolchains/arm64-linux-gcc.cmake index 590a97a8e5..a6c9543db3 100644 --- a/media/libaom/src/build/cmake/toolchains/arm64-linux-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/arm64-linux-gcc.cmake @@ -33,4 +33,4 @@ set(CMAKE_SYSTEM_PROCESSOR "arm64") set(AOM_NEON_INTRIN_FLAG "") # No runtime cpu detect for arm64-linux-gcc. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/arm64-mingw-gcc.cmake b/media/libaom/src/build/cmake/toolchains/arm64-mingw-gcc.cmake index b5b2ff1cd3..a8e15cb317 100644 --- a/media/libaom/src/build/cmake/toolchains/arm64-mingw-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/arm64-mingw-gcc.cmake @@ -26,7 +26,4 @@ set(CMAKE_AR ${CROSS}ar CACHE FILEPATH Archiver) set(CMAKE_RANLIB ${CROSS}ranlib CACHE FILEPATH Indexer) # No runtime cpu detect for arm64-mingw-gcc. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") - -# Disable the use of the gtest's CMake support. -set(AOM_DISABLE_GTEST_CMAKE 1) +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/armv7-ios.cmake b/media/libaom/src/build/cmake/toolchains/armv7-ios.cmake index 32a1b534ad..11f7e160df 100644 --- a/media/libaom/src/build/cmake/toolchains/armv7-ios.cmake +++ b/media/libaom/src/build/cmake/toolchains/armv7-ios.cmake @@ -28,4 +28,4 @@ include("${CMAKE_CURRENT_LIST_DIR}/arm-ios-common.cmake") set(AOM_NEON_INTRIN_FLAG "") # No runtime cpu detect for armv7s-ios. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/armv7-linux-gcc.cmake b/media/libaom/src/build/cmake/toolchains/armv7-linux-gcc.cmake index 7d3d63085e..b898b4b789 100644 --- a/media/libaom/src/build/cmake/toolchains/armv7-linux-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/armv7-linux-gcc.cmake @@ -28,16 +28,13 @@ endif() set(CMAKE_C_COMPILER ${CROSS}gcc) set(CMAKE_CXX_COMPILER ${CROSS}g++) set(AS_EXECUTABLE ${CROSS}as) -set(CMAKE_C_COMPILER_ARG1 - "-march=armv7-a -mfpu=neon ${AOM_EXTRA_TOOLCHAIN_FLAGS}") -set(CMAKE_CXX_COMPILER_ARG1 - "-march=armv7-a -mfpu=neon ${AOM_EXTRA_TOOLCHAIN_FLAGS}") +set(CMAKE_C_COMPILER_ARG1 "-march=armv7-a ${AOM_EXTRA_TOOLCHAIN_FLAGS}") +set(CMAKE_CXX_COMPILER_ARG1 "-march=armv7-a ${AOM_EXTRA_TOOLCHAIN_FLAGS}") set(AOM_AS_FLAGS --defsym ARCHITECTURE=7 -march=armv7-a -mfpu=neon - ${AOM_EXTRA_TOOLCHAIN_FLAGS}) + ${AOM_EXTRA_TOOLCHAIN_FLAGS}) set(CMAKE_SYSTEM_PROCESSOR "armv7") -# No intrinsics flag required for armv7-linux-gcc. -set(AOM_NEON_INTRIN_FLAG "") +set(AOM_NEON_INTRIN_FLAG "-mfpu=neon") # No runtime cpu detect for armv7-linux-gcc. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/armv7-mingw-gcc.cmake b/media/libaom/src/build/cmake/toolchains/armv7-mingw-gcc.cmake index cf06a11b38..2dc4b1882d 100644 --- a/media/libaom/src/build/cmake/toolchains/armv7-mingw-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/armv7-mingw-gcc.cmake @@ -26,7 +26,4 @@ set(CMAKE_AR ${CROSS}ar CACHE FILEPATH Archiver) set(CMAKE_RANLIB ${CROSS}ranlib CACHE FILEPATH Indexer) # No runtime cpu detect for armv7-mingw-gcc. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") - -# Disable the use of the gtest's CMake support. -set(AOM_DISABLE_GTEST_CMAKE 1) +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/armv7s-ios.cmake b/media/libaom/src/build/cmake/toolchains/armv7s-ios.cmake index 0940a6ee8a..faa2933cf0 100644 --- a/media/libaom/src/build/cmake/toolchains/armv7s-ios.cmake +++ b/media/libaom/src/build/cmake/toolchains/armv7s-ios.cmake @@ -28,4 +28,4 @@ include("${CMAKE_CURRENT_LIST_DIR}/arm-ios-common.cmake") set(AOM_NEON_INTRIN_FLAG "") # No runtime cpu detect for armv7s-ios. -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/mips32-linux-gcc.cmake b/media/libaom/src/build/cmake/toolchains/mips32-linux-gcc.cmake index 0f93490b11..c644eec8c0 100644 --- a/media/libaom/src/build/cmake/toolchains/mips32-linux-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/mips32-linux-gcc.cmake @@ -74,4 +74,4 @@ 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) +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "" FORCE) diff --git a/media/libaom/src/build/cmake/toolchains/mips64-linux-gcc.cmake b/media/libaom/src/build/cmake/toolchains/mips64-linux-gcc.cmake index ad9aab09d8..442d910995 100644 --- a/media/libaom/src/build/cmake/toolchains/mips64-linux-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/mips64-linux-gcc.cmake @@ -51,4 +51,4 @@ 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) +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "" FORCE) diff --git a/media/libaom/src/build/cmake/toolchains/ppc-linux-gcc.cmake b/media/libaom/src/build/cmake/toolchains/ppc-linux-gcc.cmake index c86cc27e3d..54db99bb48 100644 --- a/media/libaom/src/build/cmake/toolchains/ppc-linux-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/ppc-linux-gcc.cmake @@ -26,4 +26,4 @@ set(CMAKE_CXX_COMPILER ${CROSS}g++) set(AS_EXECUTABLE ${CROSS}as) set(CMAKE_SYSTEM_PROCESSOR "ppc") -set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "") +set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/x86-ios-simulator.cmake b/media/libaom/src/build/cmake/toolchains/x86-ios-simulator.cmake index 6b6f52cac2..caacb8c38b 100644 --- a/media/libaom/src/build/cmake/toolchains/x86-ios-simulator.cmake +++ b/media/libaom/src/build/cmake/toolchains/x86-ios-simulator.cmake @@ -23,6 +23,6 @@ set(CMAKE_SYSTEM_PROCESSOR "i386") set(CMAKE_OSX_ARCHITECTURES "i386") # Avoid noisy PIC/PIE warnings. -set(CONFIG_PIC 1 CACHE NUMBER "") +set(CONFIG_PIC 1 CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/ios-simulator-common.cmake") diff --git a/media/libaom/src/build/cmake/toolchains/x86-macos.cmake b/media/libaom/src/build/cmake/toolchains/x86-macos.cmake index 7a46e06a9a..095ef18e77 100644 --- a/media/libaom/src/build/cmake/toolchains/x86-macos.cmake +++ b/media/libaom/src/build/cmake/toolchains/x86-macos.cmake @@ -15,4 +15,4 @@ set(CMAKE_C_COMPILER_ARG1 "-arch i386") set(CMAKE_CXX_COMPILER_ARG1 "-arch i386") # Apple tools always complain in 32 bit mode without PIC. -set(CONFIG_PIC 1 CACHE NUMBER "") +set(CONFIG_PIC 1 CACHE STRING "") diff --git a/media/libaom/src/build/cmake/toolchains/x86-mingw-gcc.cmake b/media/libaom/src/build/cmake/toolchains/x86-mingw-gcc.cmake index c986c4ee36..4839c9d455 100644 --- a/media/libaom/src/build/cmake/toolchains/x86-mingw-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/x86-mingw-gcc.cmake @@ -26,6 +26,3 @@ set(CMAKE_C_COMPILER ${CROSS}gcc) set(CMAKE_CXX_COMPILER ${CROSS}g++) set(CMAKE_AR ${CROSS}ar CACHE FILEPATH Archiver) set(CMAKE_RANLIB ${CROSS}ranlib CACHE FILEPATH Indexer) - -# Disable the use of the gtest's CMake support. -set(AOM_DISABLE_GTEST_CMAKE 1) diff --git a/media/libaom/src/build/cmake/toolchains/x86_64-mingw-gcc.cmake b/media/libaom/src/build/cmake/toolchains/x86_64-mingw-gcc.cmake index 00d94d5f1f..4b2d28debc 100644 --- a/media/libaom/src/build/cmake/toolchains/x86_64-mingw-gcc.cmake +++ b/media/libaom/src/build/cmake/toolchains/x86_64-mingw-gcc.cmake @@ -24,6 +24,3 @@ set(CMAKE_C_COMPILER ${CROSS}gcc) set(CMAKE_CXX_COMPILER ${CROSS}g++) set(CMAKE_AR ${CROSS}ar CACHE FILEPATH Archiver) set(CMAKE_RANLIB ${CROSS}ranlib CACHE FILEPATH Indexer) - -# Disable the use of the gtest's CMake support. -set(AOM_DISABLE_GTEST_CMAKE 1) diff --git a/media/libaom/src/build/cmake/util.cmake b/media/libaom/src/build/cmake/util.cmake index b70ec40137..9b3da84dc3 100644 --- a/media/libaom/src/build/cmake/util.cmake +++ b/media/libaom/src/build/cmake/util.cmake @@ -16,24 +16,25 @@ set(AOM_BUILD_CMAKE_UTIL_CMAKE_ 1) # Directory where generated sources will be written. set(AOM_GEN_SRC_DIR "${AOM_CONFIG_DIR}/gen_src") -# 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. -macro(create_dummy_source_file basename extension out_file_path) +# Creates dummy source file in $AOM_GEN_SRC_DIR named $basename.$extension and +# returns the full path to the dummy source file via appending it to the list +# variable referred to by $out_file_list_var parameter. +macro(create_dummy_source_file basename extension out_file_list_var) set(dummy_source_file "${AOM_GEN_SRC_DIR}/${basename}_dummy.${extension}") - 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" - "void ${target_name}_dummy_function(void) {}\n") + 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" + "void aom_${target_name}_dummy_function(void) {}\n") + list(APPEND "${out_file_list_var}" "${dummy_source_file}") endmacro() # 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}) + create_dummy_source_file("${target_name}" "${extension}" + "dummy_source_file_list") + target_sources(${target_name} PRIVATE ${dummy_source_file_list}) endfunction() # Sets the value of the variable referenced by $feature to $value, and reports @@ -83,8 +84,8 @@ function(set_compiler_launcher launcher_flag launcher_name) 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.") + message( + WARNING "--- Cannot find ${launcher_name}, ${launcher_flag} ignored.") endif() endfunction() @@ -100,7 +101,7 @@ set(cmake_cmdline_helpstring "No help, variable specified on the command line.") # # The names of variables defaulted through this macro are added to # $AOM_CONFIG_VARS to facilitate build logging and diagnostics. -macro(set_aom_detect_var name value type helpstring) +macro(set_aom_detect_var name value helpstring) unset(list_index) list(FIND AOM_DETECT_VARS ${name} list_index) if(${list_index} EQUAL -1) @@ -112,7 +113,7 @@ macro(set_aom_detect_var name value type helpstring) unset(cache_helpstring) get_property(cache_helpstring CACHE ${name} PROPERTY HELPSTRING) if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") - set(${name} ${value} CACHE ${type} "${helpstring}") + set(${name} ${value} CACHE STRING "${helpstring}") mark_as_advanced(${name}) else() message( @@ -130,7 +131,7 @@ endmacro() # # The names of variables defaulted through this macro are added to # $AOM_CONFIG_VARS to facilitate build logging and diagnostics. -macro(set_aom_config_var name value type helpstring) +macro(set_aom_config_var name value helpstring) unset(list_index) list(FIND AOM_CONFIG_VARS ${name} list_index) if(${list_index} EQUAL -1) @@ -142,7 +143,7 @@ macro(set_aom_config_var name value type helpstring) unset(cache_helpstring) get_property(cache_helpstring CACHE ${name} PROPERTY HELPSTRING) if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") - set(${name} ${value} CACHE ${type} "${helpstring}") + set(${name} ${value} CACHE STRING "${helpstring}") endif() endmacro() diff --git a/media/libaom/src/build/cmake/version.cmake b/media/libaom/src/build/cmake/version.cmake index d169b12ac6..dd953a37a3 100644 --- a/media/libaom/src/build/cmake/version.cmake +++ b/media/libaom/src/build/cmake/version.cmake @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.5) set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "GIT_EXECUTABLE" - "PERL_EXECUTABLE") + "PERL_EXECUTABLE") foreach(arg ${REQUIRED_ARGS}) if("${${arg}}" STREQUAL "") @@ -25,13 +25,20 @@ include("${AOM_ROOT}/build/cmake/util.cmake") 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) + OUTPUT_VARIABLE aom_version + ERROR_QUIET + RESULT_VARIABLE version_check_result) - # 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) + if(${version_check_result} EQUAL 0) + 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() + else() + set(aom_version "") endif() endif() @@ -40,18 +47,19 @@ if("${aom_version}" STREQUAL "") endif() unset(last_aom_version) -if(EXISTS "${AOM_CONFIG_DIR}/config/aom_version.h") - extract_version_string("${AOM_CONFIG_DIR}/config/aom_version.h" - last_aom_version) +set(version_file "${AOM_CONFIG_DIR}/config/aom_version.h") +if(EXISTS "${version_file}") + extract_version_string("${version_file}" last_aom_version) + if("${aom_version}" MATCHES "CHANGELOG$") + set(aom_version "${last_aom_version}") + endif() 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}/config/aom_version.h - VERBATIM) + # that is done by version.pl on its own (if a bit more verbosely...). + execute_process(COMMAND ${PERL_EXECUTABLE} + "${AOM_ROOT}/build/cmake/version.pl" + --version_data=${aom_version} + --version_filename=${version_file} VERBATIM) endif() |