1# 2# Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3# 4# This source code is subject to the terms of the BSD 2 Clause License and the 5# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was 6# not distributed with this source code in the LICENSE file, you can obtain it 7# at www.aomedia.org/license/software. If the Alliance for Open Media Patent 8# License 1.0 was not distributed with this source code in the PATENTS file, you 9# can obtain it at www.aomedia.org/license/patent. 10# 11if(AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_) 12 return() 13endif() # AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_ 14set(AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_ 1) 15 16include(FindThreads) 17 18include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake") 19include("${AOM_ROOT}/build/cmake/aom_experiment_deps.cmake") 20include("${AOM_ROOT}/build/cmake/aom_optimization.cmake") 21include("${AOM_ROOT}/build/cmake/compiler_flags.cmake") 22include("${AOM_ROOT}/build/cmake/compiler_tests.cmake") 23include("${AOM_ROOT}/build/cmake/util.cmake") 24 25if(DEFINED CONFIG_LOWBITDEPTH) 26 message(WARNING "CONFIG_LOWBITDEPTH has been removed. \ 27 Use -DFORCE_HIGHBITDEPTH_DECODING=1 instead of -DCONFIG_LOWBITDEPTH=0 \ 28 and -DFORCE_HIGHBITDEPTH_DECODING=0 instead of -DCONFIG_LOWBITDEPTH=1.") 29 if(NOT CONFIG_LOWBITDEPTH) 30 set(FORCE_HIGHBITDEPTH_DECODING 31 1 32 CACHE STRING "${cmake_cmdline_helpstring}" FORCE) 33 endif() 34endif() 35 36if(FORCE_HIGHBITDEPTH_DECODING AND NOT CONFIG_AV1_HIGHBITDEPTH) 37 change_config_and_warn(CONFIG_AV1_HIGHBITDEPTH 1 38 "FORCE_HIGHBITDEPTH_DECODING") 39endif() 40 41if(CONFIG_THREE_PASS AND NOT CONFIG_AV1_DECODER) 42 change_config_and_warn(CONFIG_THREE_PASS 0 "CONFIG_AV1_DECODER=0") 43endif() 44 45# Generate the user config settings. 46list(APPEND aom_build_vars ${AOM_CONFIG_VARS} ${AOM_OPTION_VARS}) 47foreach(cache_var ${aom_build_vars}) 48 get_property(cache_var_helpstring CACHE ${cache_var} PROPERTY HELPSTRING) 49 if(cache_var_helpstring STREQUAL cmake_cmdline_helpstring) 50 set(AOM_CMAKE_CONFIG "${AOM_CMAKE_CONFIG} -D${cache_var}=${${cache_var}}") 51 endif() 52endforeach() 53string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG) 54 55# Detect target CPU. 56if(NOT AOM_TARGET_CPU) 57 string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" cpu_lowercase) 58 if(cpu_lowercase STREQUAL "amd64" OR cpu_lowercase STREQUAL "x86_64") 59 if(CMAKE_SIZEOF_VOID_P EQUAL 4) 60 set(AOM_TARGET_CPU "x86") 61 elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 62 set(AOM_TARGET_CPU "x86_64") 63 else() 64 message( 65 FATAL_ERROR "--- Unexpected pointer size (${CMAKE_SIZEOF_VOID_P}) for\n" 66 " CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}\n" 67 " CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}\n" 68 " CMAKE_GENERATOR=${CMAKE_GENERATOR}\n") 69 endif() 70 elseif(cpu_lowercase STREQUAL "i386" OR cpu_lowercase STREQUAL "x86") 71 set(AOM_TARGET_CPU "x86") 72 elseif(cpu_lowercase MATCHES "^arm") 73 set(AOM_TARGET_CPU "${cpu_lowercase}") 74 elseif(cpu_lowercase MATCHES "aarch64") 75 set(AOM_TARGET_CPU "arm64") 76 elseif(cpu_lowercase MATCHES "^ppc") 77 set(AOM_TARGET_CPU "ppc") 78 elseif(cpu_lowercase MATCHES "^riscv") 79 set(AOM_TARGET_CPU "riscv") 80 else() 81 message(WARNING "The architecture ${CMAKE_SYSTEM_PROCESSOR} is not " 82 "supported, falling back to the generic target") 83 set(AOM_TARGET_CPU "generic") 84 endif() 85endif() 86 87if(CMAKE_TOOLCHAIN_FILE) # Add toolchain file to config string. 88 if(IS_ABSOLUTE "${CMAKE_TOOLCHAIN_FILE}") 89 file(RELATIVE_PATH toolchain_path "${AOM_CONFIG_DIR}" 90 "${CMAKE_TOOLCHAIN_FILE}") 91 else() 92 set(toolchain_path "${CMAKE_TOOLCHAIN_FILE}") 93 endif() 94 set(toolchain_string "-DCMAKE_TOOLCHAIN_FILE=\\\"${toolchain_path}\\\"") 95 set(AOM_CMAKE_CONFIG "${toolchain_string} ${AOM_CMAKE_CONFIG}") 96else() 97 98 # Add detected CPU to the config string. 99 set(AOM_CMAKE_CONFIG "-DAOM_TARGET_CPU=${AOM_TARGET_CPU} ${AOM_CMAKE_CONFIG}") 100endif() 101set(AOM_CMAKE_CONFIG "-G \\\"${CMAKE_GENERATOR}\\\" ${AOM_CMAKE_CONFIG}") 102file(RELATIVE_PATH source_path "${AOM_CONFIG_DIR}" "${AOM_ROOT}") 103set(AOM_CMAKE_CONFIG "cmake ${source_path} ${AOM_CMAKE_CONFIG}") 104string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG) 105 106message("--- aom_configure: Detected CPU: ${AOM_TARGET_CPU}") 107set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME}) 108 109string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lowercase) 110if(build_type_lowercase STREQUAL "debug") 111 set(CONFIG_DEBUG 1) 112endif() 113 114if(BUILD_SHARED_LIBS) 115 set(CONFIG_PIC 1) 116 set(CONFIG_SHARED 1) 117elseif(NOT CONFIG_PIC) 118 # Update the variable only when it does not carry the CMake assigned help 119 # string for variables specified via the command line. This allows the user to 120 # force CONFIG_PIC=0. 121 unset(cache_helpstring) 122 get_property(cache_helpstring CACHE CONFIG_PIC PROPERTY HELPSTRING) 123 if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") 124 aom_check_c_compiles("pie_check" " 125 #if !(__pie__ || __PIE__) 126 #error Neither __pie__ or __PIE__ are set 127 #endif 128 extern void unused(void); 129 void unused(void) {}" HAVE_PIE) 130 131 if(HAVE_PIE) 132 # If -fpie or -fPIE are used ensure the assembly code has PIC enabled to 133 # avoid DT_TEXTRELs: /usr/bin/ld: warning: creating DT_TEXTREL in a PIE 134 set(CONFIG_PIC 1) 135 message( 136 "CONFIG_PIC enabled for position independent executable (PIE) build") 137 endif() 138 endif() 139 unset(cache_helpstring) 140endif() 141 142if(NOT MSVC) 143 if(CONFIG_PIC) 144 145 # TODO(tomfinegan): clang needs -pie in CMAKE_EXE_LINKER_FLAGS for this to 146 # work. 147 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 148 if(AOM_TARGET_SYSTEM STREQUAL "Linux" 149 AND AOM_TARGET_CPU MATCHES "^armv[78]") 150 set(AOM_AS_FLAGS ${AOM_AS_FLAGS} --defsym PIC=1) 151 else() 152 set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -DPIC) 153 endif() 154 endif() 155endif() 156 157if(AOM_TARGET_CPU STREQUAL "x86" OR AOM_TARGET_CPU STREQUAL "x86_64") 158 find_program(CMAKE_ASM_NASM_COMPILER yasm $ENV{YASM_PATH}) 159 if(NOT CMAKE_ASM_NASM_COMPILER OR ENABLE_NASM) 160 unset(CMAKE_ASM_NASM_COMPILER CACHE) 161 find_program(CMAKE_ASM_NASM_COMPILER nasm $ENV{NASM_PATH}) 162 endif() 163 164 include(CheckLanguage) 165 check_language(ASM_NASM) 166 if(CMAKE_ASM_NASM_COMPILER) 167 get_asm_obj_format("objformat") 168 unset(CMAKE_ASM_NASM_OBJECT_FORMAT) 169 set(CMAKE_ASM_NASM_OBJECT_FORMAT ${objformat}) 170 enable_language(ASM_NASM) 171 if(CMAKE_ASM_NASM_COMPILER_ID STREQUAL "NASM") 172 test_nasm() 173 endif() 174 # Xcode requires building the objects manually, so pass the object format 175 # flag. 176 if(XCODE) 177 set(AOM_AS_FLAGS -f ${objformat} ${AOM_AS_FLAGS}) 178 endif() 179 else() 180 message( 181 FATAL_ERROR 182 "Unable to find assembler. Install 'yasm' or 'nasm.' " 183 "To build without optimizations, add -DAOM_TARGET_CPU=generic to " 184 "your cmake command line.") 185 endif() 186 string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS) 187elseif(AOM_TARGET_CPU MATCHES "arm") 188 if(AOM_TARGET_SYSTEM STREQUAL "Darwin") 189 if(NOT CMAKE_ASM_COMPILER) 190 set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) 191 endif() 192 set(AOM_AS_FLAGS -arch ${AOM_TARGET_CPU} -isysroot ${CMAKE_OSX_SYSROOT}) 193 elseif(AOM_TARGET_SYSTEM STREQUAL "Windows") 194 if(NOT CMAKE_ASM_COMPILER) 195 set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER} "-c -mimplicit-it=always") 196 endif() 197 else() 198 if(NOT CMAKE_ASM_COMPILER) 199 set(CMAKE_ASM_COMPILER as) 200 endif() 201 endif() 202 include(CheckLanguage) 203 check_language(ASM) 204 if(NOT CMAKE_ASM_COMPILER) 205 message( 206 FATAL_ERROR 207 "Unable to find assembler and optimizations are enabled." 208 "Searched for ${CMAKE_ASM_COMPILER}. Install it, add it to your path," 209 "or set the assembler directly by adding " 210 "-DCMAKE_ASM_COMPILER=<assembler path> to your CMake command line." 211 "To build without optimizations, add -DAOM_TARGET_CPU=generic to your " 212 "cmake command line.") 213 endif() 214 enable_language(ASM) 215 string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS) 216endif() 217 218if(CONFIG_ANALYZER) 219 find_package(wxWidgets REQUIRED adv base core) 220 include(${wxWidgets_USE_FILE}) 221endif() 222 223if(NOT MSVC AND CMAKE_C_COMPILER_ID MATCHES "GNU\|Clang") 224 set(CONFIG_GCC 1) 225endif() 226 227if(CONFIG_GCOV) 228 message("--- Testing for CONFIG_GCOV support.") 229 require_linker_flag("-fprofile-arcs -ftest-coverage") 230 require_compiler_flag("-fprofile-arcs -ftest-coverage" YES) 231endif() 232 233if(CONFIG_GPROF) 234 message("--- Testing for CONFIG_GPROF support.") 235 require_compiler_flag("-pg" YES) 236endif() 237 238if(AOM_TARGET_SYSTEM MATCHES "Darwin\|Linux\|Windows\|Android") 239 set(CONFIG_OS_SUPPORT 1) 240endif() 241 242if(AOM_TARGET_SYSTEM STREQUAL "Windows") 243 # The default _WIN32_WINNT value in MinGW is 0x0502 (Windows XP with SP2). Set 244 # it to 0x0601 (Windows 7). 245 add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601") 246 # Quiet warnings related to fopen, printf, etc. 247 add_compiler_flag_if_supported("-D_CRT_SECURE_NO_WARNINGS") 248endif() 249 250# 251# Fix CONFIG_* dependencies. This must be done before including cpu.cmake to 252# ensure RTCD_CONFIG_* are properly set. 253fix_experiment_configs() 254 255# Don't just check for pthread.h, but use the result of the full pthreads 256# including a linking check in FindThreads above. 257set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) 258aom_check_source_compiles("unistd_check" "#include <unistd.h>" HAVE_UNISTD_H) 259 260if(NOT WIN32) 261 aom_push_var(CMAKE_REQUIRED_LIBRARIES "m") 262 aom_check_c_compiles("fenv_check" "#define _GNU_SOURCE 263 #include <fenv.h> 264 void unused(void) { 265 (void)unused; 266 (void)feenableexcept(FE_DIVBYZERO | FE_INVALID); 267 }" HAVE_FEXCEPT) 268 aom_pop_var(CMAKE_REQUIRED_LIBRARIES) 269endif() 270 271include("${AOM_ROOT}/build/cmake/cpu.cmake") 272 273if(ENABLE_CCACHE) 274 set_compiler_launcher(ENABLE_CCACHE ccache) 275endif() 276 277if(ENABLE_DISTCC) 278 set_compiler_launcher(ENABLE_DISTCC distcc) 279endif() 280 281if(ENABLE_GOMA) 282 set_compiler_launcher(ENABLE_GOMA gomacc) 283endif() 284 285if(NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER) 286 message(FATAL_ERROR "Decoder and encoder disabled, nothing to build.") 287endif() 288 289if(DECODE_HEIGHT_LIMIT OR DECODE_WIDTH_LIMIT) 290 change_config_and_warn(CONFIG_SIZE_LIMIT 1 291 "DECODE_HEIGHT_LIMIT and DECODE_WIDTH_LIMIT") 292endif() 293 294if(CONFIG_SIZE_LIMIT) 295 if(NOT DECODE_HEIGHT_LIMIT OR NOT DECODE_WIDTH_LIMIT) 296 message(FATAL_ERROR "When setting CONFIG_SIZE_LIMIT, DECODE_HEIGHT_LIMIT " 297 "and DECODE_WIDTH_LIMIT must be set.") 298 endif() 299endif() 300 301# Test compiler flags. 302if(MSVC) 303 # It isn't possible to specify C99 conformance for MSVC. MSVC doesn't support 304 # C++ standards modes earlier than C++14. 305 add_cxx_flag_if_supported("/std:c++14") 306 add_compiler_flag_if_supported("/W3") 307 308 # Disable MSVC warnings that suggest making code non-portable. 309 add_compiler_flag_if_supported("/wd4996") 310 if(ENABLE_WERROR) 311 add_compiler_flag_if_supported("/WX") 312 endif() 313 314 # Compile source files in parallel 315 add_compiler_flag_if_supported("/MP") 316else() 317 require_c_flag("-std=c99" YES) 318 if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" 319 AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" 320 AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") 321 # Microsoft's C++ Standard Library requires C++14 as it's MSVC's default and 322 # minimum supported C++ version. If Clang is using this Standard Library 323 # implementation, it cannot target C++11. 324 require_cxx_flag_nomsvc("-std=c++14" YES) 325 elseif(CYGWIN AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 326 # The GNU C++ compiler in Cygwin needs the -std=gnu++11 flag to make the 327 # POSIX function declarations visible in the Standard C Library headers. 328 require_cxx_flag_nomsvc("-std=gnu++11" YES) 329 else() 330 require_cxx_flag_nomsvc("-std=c++11" YES) 331 endif() 332 add_compiler_flag_if_supported("-Wall") 333 add_compiler_flag_if_supported("-Wdisabled-optimization") 334 add_compiler_flag_if_supported("-Wextra") 335 # Prior to version 3.19.0 cmake would fail to parse the warning emitted by gcc 336 # with this flag. Note the order of this check and -Wextra-semi-stmt is 337 # important due to is_flag_present() matching substrings with string(FIND 338 # ...). 339 if(CMAKE_VERSION VERSION_LESS "3.19" 340 AND CMAKE_C_COMPILER_ID STREQUAL "GNU" 341 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) 342 add_cxx_flag_if_supported("-Wextra-semi") 343 else() 344 add_compiler_flag_if_supported("-Wextra-semi") 345 endif() 346 add_compiler_flag_if_supported("-Wextra-semi-stmt") 347 add_compiler_flag_if_supported("-Wfloat-conversion") 348 add_compiler_flag_if_supported("-Wformat=2") 349 add_c_flag_if_supported("-Wimplicit-function-declaration") 350 add_compiler_flag_if_supported("-Wlogical-op") 351 add_compiler_flag_if_supported("-Wmissing-declarations") 352 if(CMAKE_C_COMPILER_ID MATCHES "Clang") 353 add_compiler_flag_if_supported("-Wmissing-prototypes") 354 else() 355 add_c_flag_if_supported("-Wmissing-prototypes") 356 endif() 357 add_compiler_flag_if_supported("-Wpointer-arith") 358 add_compiler_flag_if_supported("-Wshadow") 359 add_compiler_flag_if_supported("-Wshorten-64-to-32") 360 add_compiler_flag_if_supported("-Wsign-compare") 361 add_compiler_flag_if_supported("-Wstring-conversion") 362 add_compiler_flag_if_supported("-Wtype-limits") 363 add_compiler_flag_if_supported("-Wundef") 364 add_compiler_flag_if_supported("-Wuninitialized") 365 add_compiler_flag_if_supported("-Wunreachable-code-aggressive") 366 add_compiler_flag_if_supported("-Wunused") 367 add_compiler_flag_if_supported("-Wvla") 368 add_cxx_flag_if_supported("-Wc++14-extensions") 369 add_cxx_flag_if_supported("-Wc++17-extensions") 370 add_cxx_flag_if_supported("-Wc++20-extensions") 371 372 if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND SANITIZE MATCHES "address|undefined") 373 374 # This combination has more stack overhead, so we account for it by 375 # providing higher stack limit than usual. 376 add_c_flag_if_supported("-Wstack-usage=285000") 377 add_cxx_flag_if_supported("-Wstack-usage=270000") 378 elseif(CONFIG_RD_DEBUG) # Another case where higher stack usage is expected. 379 add_c_flag_if_supported("-Wstack-usage=135000") 380 add_cxx_flag_if_supported("-Wstack-usage=240000") 381 else() 382 add_c_flag_if_supported("-Wstack-usage=100000") 383 add_cxx_flag_if_supported("-Wstack-usage=240000") 384 endif() 385 386 if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND SANITIZE MATCHES "address") 387 # Disable no optimization warning when compiling with sanitizers 388 add_compiler_flag_if_supported("-Wno-disabled-optimization") 389 endif() 390 391 # Quiet gcc 6 vs 7 abi warnings: 392 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728 393 if(AOM_TARGET_CPU MATCHES "arm") 394 add_cxx_flag_if_supported("-Wno-psabi") 395 endif() 396 397 if(ENABLE_WERROR) 398 add_compiler_flag_if_supported("-Werror") 399 endif() 400 401 if(build_type_lowercase MATCHES "rel") 402 add_compiler_flag_if_supported("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0") 403 endif() 404 add_compiler_flag_if_supported("-D_LARGEFILE_SOURCE") 405 add_compiler_flag_if_supported("-D_FILE_OFFSET_BITS=64") 406 407 # Do not allow implicit vector type conversions on Clang builds (this is 408 # already the default on GCC builds). 409 if(CMAKE_C_COMPILER_ID MATCHES "Clang") 410 # Clang 8.0.1 (in Cygwin) doesn't support -flax-vector-conversions=none. 411 add_compiler_flag_if_supported("-flax-vector-conversions=none") 412 endif() 413endif() 414 415# Prior to r23, or with ANDROID_USE_LEGACY_TOOLCHAIN_FILE set, 416# android.toolchain.cmake would set normal (non-cache) versions of variables 417# like CMAKE_C_FLAGS_RELEASE which would mask the ones added to the cache 418# variable in add_compiler_flag_if_supported(), etc. As a workaround we add 419# everything accumulated in AOM_C/CXX_FLAGS to the normal versions. This could 420# also be addressed by reworking the flag tests and adding the results directly 421# to target_compile_options() as in e.g., libgav1, but that's a larger task. 422# https://github.com/android/ndk/wiki/Changelog-r23#changes 423if(ANDROID 424 AND ("${ANDROID_NDK_MAJOR}" LESS 23 OR ANDROID_USE_LEGACY_TOOLCHAIN_FILE)) 425 foreach(lang C;CXX) 426 string(STRIP "${AOM_${lang}_FLAGS}" AOM_${lang}_FLAGS) 427 if(AOM_${lang}_FLAGS) 428 foreach(config ${AOM_${lang}_CONFIGS}) 429 set(${config} "${${config}} ${AOM_${lang}_FLAGS}") 430 endforeach() 431 endif() 432 endforeach() 433endif() 434 435set(AOM_LIB_LINK_TYPE PUBLIC) 436if(EMSCRIPTEN) 437 438 # Avoid CMake generation time errors resulting from collisions with the form 439 # of target_link_libraries() used by Emscripten.cmake. 440 unset(AOM_LIB_LINK_TYPE) 441endif() 442 443# Generate aom_config templates. 444set(aom_config_asm_template "${AOM_CONFIG_DIR}/config/aom_config.asm.cmake") 445set(aom_config_h_template "${AOM_CONFIG_DIR}/config/aom_config.h.cmake") 446execute_process( 447 COMMAND ${CMAKE_COMMAND} 448 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} -DAOM_ROOT=${AOM_ROOT} -P 449 "${AOM_ROOT}/build/cmake/generate_aom_config_templates.cmake") 450 451# Generate aom_config.{asm,h}. 452configure_file("${aom_config_asm_template}" 453 "${AOM_CONFIG_DIR}/config/aom_config.asm") 454configure_file("${aom_config_h_template}" 455 "${AOM_CONFIG_DIR}/config/aom_config.h") 456 457# Read the current git hash. 458find_package(Git) 459if(NOT GIT_FOUND) 460 message("--- Git missing, version will be read from CHANGELOG.") 461endif() 462 463string(TIMESTAMP year "%Y") 464configure_file("${AOM_ROOT}/build/cmake/aom_config.c.template" 465 "${AOM_CONFIG_DIR}/config/aom_config.c") 466 467# Find Perl and generate the RTCD sources. 468find_package(Perl) 469if(NOT PERL_FOUND) 470 message(FATAL_ERROR "Perl is required to build libaom.") 471endif() 472 473set(AOM_RTCD_CONFIG_FILE_LIST "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl" 474 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl" 475 "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl") 476set(AOM_RTCD_HEADER_FILE_LIST "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h" 477 "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h" 478 "${AOM_CONFIG_DIR}/config/av1_rtcd.h") 479set(AOM_RTCD_SOURCE_FILE_LIST "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c" 480 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" 481 "${AOM_ROOT}/av1/common/av1_rtcd.c") 482set(AOM_RTCD_SYMBOL_LIST aom_dsp_rtcd aom_scale_rtcd av1_rtcd) 483list(LENGTH AOM_RTCD_SYMBOL_LIST AOM_RTCD_CUSTOM_COMMAND_COUNT) 484math(EXPR AOM_RTCD_CUSTOM_COMMAND_COUNT "${AOM_RTCD_CUSTOM_COMMAND_COUNT} - 1") 485 486foreach(NUM RANGE ${AOM_RTCD_CUSTOM_COMMAND_COUNT}) 487 list(GET AOM_RTCD_CONFIG_FILE_LIST ${NUM} AOM_RTCD_CONFIG_FILE) 488 list(GET AOM_RTCD_HEADER_FILE_LIST ${NUM} AOM_RTCD_HEADER_FILE) 489 list(GET AOM_RTCD_SOURCE_FILE_LIST ${NUM} AOM_RTCD_SOURCE_FILE) 490 list(GET AOM_RTCD_SYMBOL_LIST ${NUM} AOM_RTCD_SYMBOL) 491 execute_process( 492 COMMAND 493 ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/rtcd.pl" 494 --arch=${AOM_TARGET_CPU} 495 --sym=${AOM_RTCD_SYMBOL} ${AOM_RTCD_FLAGS} 496 --config=${AOM_CONFIG_DIR}/config/aom_config.h ${AOM_RTCD_CONFIG_FILE} 497 OUTPUT_FILE ${AOM_RTCD_HEADER_FILE}) 498endforeach() 499 500# Generate aom_version.h. 501execute_process(COMMAND ${CMAKE_COMMAND} 502 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR} 503 -DAOM_ROOT=${AOM_ROOT} 504 -DGIT_EXECUTABLE=${GIT_EXECUTABLE} 505 -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P 506 "${AOM_ROOT}/build/cmake/version.cmake") 507