aom_configure.cmake 15.3 KB
Newer Older
Tom Finegan's avatar
Tom Finegan committed
1 2 3 4 5 6 7 8 9 10
##
## Copyright (c) 2016, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you can
## obtain it at www.aomedia.org/license/software. If the Alliance for Open
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
11 12 13
if (NOT AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_)
set(AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_ 1)

14 15
include(FindGit)
include(FindPerl)
16
include(FindThreads)
17
include(FindwxWidgets)
18

19 20 21
set(AOM_SUPPORTED_CPU_TARGETS
    "arm64 armv7 armv7s generic mips32 mips64 x86 x86_64")

Tom Finegan's avatar
Tom Finegan committed
22 23 24 25 26 27 28 29 30 31 32
# Generate the user config settings. This must occur before include of
# aom_config_defaults.cmake (because it turns every config variable into a cache
# variable with its own help string).
get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
foreach(cache_var ${cmake_cache_vars})
  get_property(cache_var_helpstring CACHE ${cache_var} PROPERTY HELPSTRING)
  set(cmdline_helpstring  "No help, variable specified on the command line.")
  if("${cache_var_helpstring}" STREQUAL "${cmdline_helpstring}")
    set(AOM_CMAKE_CONFIG "${AOM_CMAKE_CONFIG} -D${cache_var}=${${cache_var}}")
  endif ()
endforeach()
33
string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)
Tom Finegan's avatar
Tom Finegan committed
34

35
include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
Tom Finegan's avatar
Tom Finegan committed
36
include("${AOM_ROOT}/build/cmake/aom_optimization.cmake")
Tom Finegan's avatar
Tom Finegan committed
37
include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
38
include("${AOM_ROOT}/build/cmake/compiler_tests.cmake")
39
include("${AOM_ROOT}/build/cmake/util.cmake")
Tom Finegan's avatar
Tom Finegan committed
40

41 42 43 44 45 46 47 48
# Build a list of all configurable variables.
get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
foreach (var ${cmake_cache_vars})
  if ("${var}" MATCHES "^CONFIG_")
    list(APPEND AOM_CONFIG_VARS ${var})
  endif ()
endforeach ()

49 50
# Detect target CPU.
if (NOT AOM_TARGET_CPU)
51 52 53 54 55 56 57 58 59 60 61 62 63
  if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR
      "${CMAKE_SYSTEM_PROCESSOR}" 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")
    endif ()
64 65 66
  elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
          "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
    set(AOM_TARGET_CPU "x86")
67 68
  elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm" OR
          "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^mips")
69
    set(AOM_TARGET_CPU "${CMAKE_SYSTEM_PROCESSOR}")
70
  endif ()
71 72
endif ()

73 74 75 76 77 78 79 80 81
if (CMAKE_TOOLCHAIN_FILE)
  # Add toolchain file to config string.
  set(toolchain_string "-DCMAKE_TOOLCHAIN_FILE=\\\"${CMAKE_TOOLCHAIN_FILE}\\\"")
  set(AOM_CMAKE_CONFIG "${toolchain_string} ${AOM_CMAKE_CONFIG}")
else ()
  # Add detected CPU to the config string.
  set(AOM_CMAKE_CONFIG "-DAOM_TARGET_CPU=${AOM_TARGET_CPU} ${AOM_CMAKE_CONFIG}")
endif ()
set(AOM_CMAKE_CONFIG "-G \\\"${CMAKE_GENERATOR}\\\" ${AOM_CMAKE_CONFIG}")
82 83
string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)

84
message("--- aom_configure: Detected CPU: ${AOM_TARGET_CPU}")
85
set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME})
86

87 88 89 90
if ("${CMAKE_BUILD_TYPE}" MATCHES "Deb")
  set(CONFIG_DEBUG 1)
endif ()

91 92 93 94
if (NOT MSVC)
  if (BUILD_SHARED_LIBS)
    set(CONFIG_PIC 1)
    set(CONFIG_SHARED 1)
95
    set(CONFIG_STATIC 0)
96
  endif ()
97

98 99 100 101 102 103 104 105
  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 ()
106
  endif ()
107 108
else ()
  set(CONFIG_MSVS 1)
109 110
endif ()

111 112
if (NOT "${AOM_SUPPORTED_CPU_TARGETS}" MATCHES "${AOM_TARGET_CPU}")
  message(FATAL_ERROR "No RTCD support for ${AOM_TARGET_CPU}. Create it, or "
113 114
          "add -DAOM_TARGET_CPU=generic to your cmake command line for a "
          "generic build of libaom and tools.")
115
endif ()
116

117
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
118 119
  if (ENABLE_NASM)
    find_program(AS_EXECUTABLE nasm $ENV{NASM_PATH})
120
    test_nasm()
121 122 123 124 125
    set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -Ox)
  else ()
    find_program(AS_EXECUTABLE yasm $ENV{YASM_PATH})
  endif ()

Tom Finegan's avatar
Tom Finegan committed
126
  if (NOT AS_EXECUTABLE)
127 128 129
    message(FATAL_ERROR "Unable to find assembler. To build without "
            "optimizations, add -DAOM_TARGET_CPU=generic to your cmake command "
            "line.")
130
  endif ()
Tom Finegan's avatar
Tom Finegan committed
131 132
  get_asm_obj_format("objformat")
  set(AOM_AS_FLAGS -f ${objformat} ${AOM_AS_FLAGS})
Tom Finegan's avatar
Tom Finegan committed
133 134 135 136 137
  string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
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})
138
  elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
139 140
    # arm linux assembler settings controlled by
    # build/cmake/toolchains/arm*-linux*.cmake
Tom Finegan's avatar
Tom Finegan committed
141 142 143 144 145 146
  endif ()
  if (NOT AS_EXECUTABLE)
    message(FATAL_ERROR
            "Unknown assembler for: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}")
  endif ()

Tom Finegan's avatar
Tom Finegan committed
147
  string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
148 149
endif ()

150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
################################################################################
# Fix CONFIG_* dependencies. This must be done before including cpu.cmake to
# ensure RTCD_CONFIG_* are properly set.

if (CONFIG_ANALYZER)
  find_package(wxWidgets REQUIRED adv base core)
  include(${wxWidgets_USE_FILE})

  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()

Nathan E. Egge's avatar
Nathan E. Egge committed
167 168 169 170 171 172 173 174
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()

175 176 177
if (CONFIG_DAALA_DCT64 AND NOT CONFIG_TX64X64)
   message(WARNING "--- CONFIG_DAALA_DCT64 requires CONFIG_TX64X64, disabling.")
   set(CONFIG_DAALA_DCT64 0)
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
endif()

if (CONFIG_DAALA_DCT4 OR CONFIG_DAALA_DCT8 OR CONFIG_DAALA_DCT16 OR
    CONFIG_DAALA_DCT32 OR CONFIG_DAALA_DCT64)
  if (CONFIG_RECT_TX)
    change_config_and_warn(CONFIG_RECT_TX 0 CONFIG_DAALA_DCTx)
  endif()
  if (CONFIG_VAR_TX)
     change_config_and_warn(CONFIG_VAR_TX 0 CONFIG_DAALA_DCTx)
  endif()
  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()

Tom Finegan's avatar
Tom Finegan committed
196 197 198 199 200 201
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.")
James Zern's avatar
James Zern committed
202
  require_linker_flag("-fprofile-arcs -ftest-coverage")
Tom Finegan's avatar
Tom Finegan committed
203 204 205 206 207 208 209 210
  require_compiler_flag("-fprofile-arcs -ftest-coverage" YES)
endif ()

if (CONFIG_GPROF)
  message("--- Testing for CONFIG_GPROF support.")
  require_compiler_flag("-pg" YES)
endif ()

211 212 213 214 215 216
if (CONFIG_TXK_SEL)
  if (NOT CONFIG_LV_MAP)
    change_config_and_warn(CONFIG_LV_MAP 1 CONFIG_TXK_SEL)
  endif ()
endif ()

217 218 219 220 221 222 223 224 225
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 ()

226 227 228 229 230 231
if (CONFIG_EXT_COMP_REFS)
  if (NOT CONFIG_EXT_REFS)
    change_config_and_warn(CONFIG_EXT_REFS 1 CONFIG_EXT_COMP_REFS)
  endif()
endif()

232 233 234 235 236 237
if (CONFIG_STRIPED_LOOP_RESTORATION)
  if (NOT CONFIG_LOOP_RESTORATION)
    change_config_and_warn(CONFIG_LOOP_RESTORATION 1 CONFIG_STRIPED_LOOP_RESTORATION)
  endif()
endif()

238 239 240 241 242 243 244 245 246
if (CONFIG_WARPED_MOTION)
  if (CONFIG_NCOBMC)
    change_config_and_warn(CONFIG_NCOBMC 0 CONFIG_WARPED_MOTION)
  endif ()
  if (CONFIG_NCOBMC_ADAPT_WEIGHT)
    change_config_and_warn(CONFIG_NCOBMC_ADAPT_WEIGHT 0 CONFIG_WARPED_MOTION)
  endif ()
endif ()

247 248 249 250 251 252 253 254 255 256 257 258
if (CONFIG_MFMV)
  if (NOT CONFIG_FRAME_MARKER)
    change_config_and_warn(CONFIG_FRAME_MARKER 1 CONFIG_MFMV)
  endif()
endif()

if (CONFIG_JNT_COMP)
  if (NOT CONFIG_FRAME_MARKER)
    change_config_and_warn(CONFIG_FRAME_MARKER 1 CONFIG_JNT_COMP)
  endif()
endif()

RogerZhou's avatar
RogerZhou committed
259 260 261 262
if (CONFIG_AMVR)
  change_config_and_warn(CONFIG_HASH_ME 1 CONFIG_AMVR)
endif ()

263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
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 ()

Tom Finegan's avatar
Tom Finegan committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
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 (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()

309
include("${AOM_ROOT}/build/cmake/cpu.cmake")
Tom Finegan's avatar
Tom Finegan committed
310

311
if (ENABLE_CCACHE)
312
  set_compiler_launcher(ENABLE_CCACHE ccache)
313 314 315
endif ()

if (ENABLE_DISTCC)
316
  set_compiler_launcher(ENABLE_DISTCC distcc)
317 318
endif ()

319
if (ENABLE_GOMA)
320
  set_compiler_launcher(ENABLE_GOMA gomacc)
321 322
endif ()

323 324 325 326
if (NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER)
  message(FATAL_ERROR "Decoder and encoder disabled, nothing to build.")
endif ()

327 328 329 330 331 332 333 334 335
# Test compiler flags.
if (MSVC)
  add_compiler_flag_if_supported("/W3")
  # Disable MSVC warnings that suggest making code non-portable.
  add_compiler_flag_if_supported("/wd4996")
  if (ENABLE_WERROR)
    add_compiler_flag_if_supported("/WX")
  endif ()
else ()
336
  require_c_flag("-std=c99" YES)
337 338 339 340 341
  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")
342
  add_compiler_flag_if_supported("-Wlogical-op")
343 344
  add_compiler_flag_if_supported("-Wpointer-arith")
  add_compiler_flag_if_supported("-Wsign-compare")
345
  add_compiler_flag_if_supported("-Wstack-usage=320000")
346
  add_compiler_flag_if_supported("-Wstring-conversion")
347 348 349 350
  add_compiler_flag_if_supported("-Wtype-limits")
  add_compiler_flag_if_supported("-Wuninitialized")
  add_compiler_flag_if_supported("-Wunused")
  add_compiler_flag_if_supported("-Wvla")
351 352 353
  # 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")
354 355 356 357

  # Add -Wshadow only for C files to avoid massive gtest warning spam.
  add_c_flag_if_supported("-Wshadow")

358 359 360
  # Add -Wundef only for C files to avoid massive gtest warning spam.
  add_c_flag_if_supported("-Wundef")

361 362 363 364 365 366
  if (ENABLE_WERROR)
    add_compiler_flag_if_supported("-Werror")
  endif ()
  # Flag(s) added here negate CMake defaults and produce build output similar
  # to the existing configure/make build system.
  add_compiler_flag_if_supported("-Wno-unused-function")
367

368 369 370 371 372
  if ("${CMAKE_BUILD_TYPE}" MATCHES "Rel")
    add_compiler_flag_if_supported("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0")
  endif ()
  add_compiler_flag_if_supported("-D_LARGEFILE_SOURCE")
  add_compiler_flag_if_supported("-D_FILE_OFFSET_BITS=64")
373
endif ()
Tom Finegan's avatar
Tom Finegan committed
374

375 376 377 378 379 380 381
set(AOM_LIB_LINK_TYPE PUBLIC)
if (EMSCRIPTEN)
  # Avoid CMake generation time errors resulting from collisions with the form
  # of target_link_libraries() used by Emscripten.cmake.
  unset(AOM_LIB_LINK_TYPE)
endif ()

382 383 384 385 386 387 388 389 390 391 392
# Generate aom_config templates.
set(aom_config_asm_template "${AOM_CONFIG_DIR}/aom_config.asm.cmake")
set(aom_config_h_template "${AOM_CONFIG_DIR}/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")

# Generate aom_config.{asm,h}.
configure_file("${aom_config_asm_template}" "${AOM_CONFIG_DIR}/aom_config.asm")
configure_file("${aom_config_h_template}" "${AOM_CONFIG_DIR}/aom_config.h")
Tom Finegan's avatar
Tom Finegan committed
393 394 395

# Read the current git hash.
find_package(Git)
396 397
if (NOT GIT_FOUND)
  message("--- Git missing, version will be read from CHANGELOG.")
398
endif ()
Tom Finegan's avatar
Tom Finegan committed
399 400

configure_file("${AOM_ROOT}/build/cmake/aom_config.c.cmake"
401 402
               "${AOM_CONFIG_DIR}/aom_config.c")

Tom Finegan's avatar
Tom Finegan committed
403
# Find Perl and generate the RTCD sources.
404 405 406 407
find_package(Perl)
if (NOT PERL_FOUND)
  message(FATAL_ERROR "Perl is required to build libaom.")
endif ()
408 409 410

configure_file("${AOM_CONFIG_DIR}/rtcd_config.cmake"
               "${AOM_CONFIG_DIR}/${AOM_TARGET_CPU}_rtcd_config.rtcd")
Tom Finegan's avatar
Tom Finegan committed
411 412 413 414 415 416 417 418 419 420 421 422 423

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")
set(AOM_RTCD_HEADER_FILE_LIST
    "${AOM_CONFIG_DIR}/aom_dsp_rtcd.h"
    "${AOM_CONFIG_DIR}/aom_scale_rtcd.h"
    "${AOM_CONFIG_DIR}/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")
424
set(AOM_RTCD_SYMBOL_LIST aom_dsp_rtcd aom_scale_rtcd av1_rtcd)
Tom Finegan's avatar
Tom Finegan committed
425 426
list(LENGTH AOM_RTCD_SYMBOL_LIST AOM_RTCD_CUSTOM_COMMAND_COUNT)
math(EXPR AOM_RTCD_CUSTOM_COMMAND_COUNT "${AOM_RTCD_CUSTOM_COMMAND_COUNT} - 1")
427

Tom Finegan's avatar
Tom Finegan committed
428 429 430 431 432
foreach(NUM RANGE ${AOM_RTCD_CUSTOM_COMMAND_COUNT})
  list(GET AOM_RTCD_CONFIG_FILE_LIST ${NUM} AOM_RTCD_CONFIG_FILE)
  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)
433 434
  execute_process(
    COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/make/rtcd.pl"
435 436 437
      --arch=${AOM_TARGET_CPU} --sym=${AOM_RTCD_SYMBOL} ${AOM_RTCD_FLAGS}
      --config=${AOM_CONFIG_DIR}/${AOM_TARGET_CPU}_rtcd_config.rtcd
      ${AOM_RTCD_CONFIG_FILE}
438
    OUTPUT_FILE ${AOM_RTCD_HEADER_FILE})
Tom Finegan's avatar
Tom Finegan committed
439 440
endforeach()

441 442
# Generate aom_version.h.
execute_process(
443 444 445 446 447 448
  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")
449 450

if (NOT MSVC)
451 452 453 454 455
  # Generate aom.pc (pkg-config file).
  execute_process(
    COMMAND ${CMAKE_COMMAND}
    -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
    -DAOM_ROOT=${AOM_ROOT}
Tom Finegan's avatar
Tom Finegan committed
456
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
457 458 459 460
    -DCMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}
    -DCONFIG_MULTITHREAD=${CONFIG_MULTITHREAD}
    -DHAVE_PTHREAD_H=${HAVE_PTHREAD_H}
    -P "${AOM_ROOT}/build/cmake/pkg_config.cmake")
461
endif ()
462 463

endif ()  # AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_