Commit 6e9d0c15 authored by Tom Finegan's avatar Tom Finegan

cmake: Add RTCD generation.

Generic only.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: Ic4e3119be7febec5428a3b5f915a885745c2a36d
parent 1f49624c
......@@ -13,6 +13,9 @@ project(AOM C CXX)
set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(AOM_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
# TODO(tomfinegan): Host auto detect goes here when $AOM_TARGET is empty.
set(AOM_TARGET "generic")
include("${AOM_ROOT}/build/cmake/aom_configure.cmake")
set(AOM_SRCS
......@@ -38,6 +41,7 @@ set(AOM_DSP_SRCS
"${AOM_ROOT}/aom_dsp/aom_convolve.h"
"${AOM_ROOT}/aom_dsp/aom_dsp_common.h"
"${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c"
"${AOM_CONFIG_DIR}/aom_dsp_rtcd.h"
"${AOM_ROOT}/aom_dsp/aom_filter.h"
"${AOM_ROOT}/aom_dsp/aom_simd.c"
"${AOM_ROOT}/aom_dsp/aom_simd.h"
......@@ -101,6 +105,7 @@ set(AOM_MEM_SRCS
set(AOM_SCALE_SRCS
"${AOM_ROOT}/aom_scale/aom_scale.h"
"${AOM_ROOT}/aom_scale/aom_scale_rtcd.c"
"${AOM_CONFIG_DIR}/aom_scale_rtcd.h"
"${AOM_ROOT}/aom_scale/generic/aom_scale.c"
"${AOM_ROOT}/aom_scale/generic/gen_scalers.c"
"${AOM_ROOT}/aom_scale/generic/yv12config.c"
......@@ -108,6 +113,8 @@ set(AOM_SCALE_SRCS
"${AOM_ROOT}/aom_scale/yv12config.h")
# TODO(tomfinegan): Extract aom_ports from aom_util if possible.
# TODO(tomfinegan): aom_ports has some target specific source files.
# aom_configure will need to set a var that gets picked up here.
set(AOM_UTIL_SRCS
"${AOM_ROOT}/aom_ports/aom_once.h"
"${AOM_ROOT}/aom_ports/aom_timer.h"
......@@ -135,6 +142,7 @@ set(AOM_AV1_COMMON_SRCS
"${AOM_ROOT}/av1/common/av1_inv_txfm2d.c"
"${AOM_ROOT}/av1/common/av1_inv_txfm2d_cfg.h"
"${AOM_ROOT}/av1/common/av1_rtcd.c"
"${AOM_CONFIG_DIR}/av1_rtcd.h"
"${AOM_ROOT}/av1/common/av1_txfm.h"
"${AOM_ROOT}/av1/common/blockd.c"
"${AOM_ROOT}/av1/common/blockd.h"
......@@ -267,10 +275,29 @@ set(AOM_AV1_ENCODER_SRCS
# Targets
add_library(aom_dsp ${AOM_DSP_SRCS})
include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR})
AomAddRtcdGenerationCommand(${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl
${AOM_CONFIG_DIR}/aom_dsp_rtcd.h
${AOM_CONFIG_DIR}/aom_dsp/aom_dsp_rtcd.c
aom_dsp_rtcd)
add_library(aom_mem ${AOM_MEM_SRCS})
add_library(aom_scale ${AOM_SCALE_SRCS})
include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR})
AomAddRtcdGenerationCommand(${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl
${AOM_CONFIG_DIR}/aom_scale_rtcd.h
${AOM_CONFIG_DIR}/aom_scale/aom_scale_rtcd.c
aom_scale_rtcd)
add_library(aom_util ${AOM_UTIL_SRCS})
add_library(aom_av1_common ${AOM_AV1_COMMON_SRCS})
include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR})
AomAddRtcdGenerationCommand(${AOM_ROOT}/av1/common/av1_rtcd_defs.pl
${AOM_CONFIG_DIR}/av1_rtcd.h
${AOM_CONFIG_DIR}/av1/common/av1_rtcd.c
aom_av1_rtcd)
add_library(aom_av1_decoder ${AOM_AV1_DECODER_SRCS})
add_library(aom_av1_encoder ${AOM_AV1_ENCODER_SRCS})
add_library(aom ${AOM_SRCS})
......@@ -279,6 +306,7 @@ target_link_libraries(aom LINK_PUBLIC
aom_mem
aom_scale
aom_util
aom_av1_common
aom_av1_decoder
aom_av1_encoder)
add_executable(simple_decoder examples/simple_decoder.c)
......
......@@ -11,8 +11,14 @@
cmake_minimum_required(VERSION 3.2)
include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
include("${AOM_ROOT}/build/cmake/targets/${AOM_TARGET}.cmake")
# TODO(tomfinegan): For some ${AOM_TARGET} values a toolchain can be
# inferred, and we could include it here instead of forcing users to
# remember to explicitly specify ${AOM_TARGET} and the cmake toolchain.
include(FindGit)
include(FindPerl)
# Defaults for every libaom configuration variable.
set(RESTRICT)
......@@ -121,7 +127,7 @@ set(CONFIG_EC_ADAPT 0)
# target platform check produces empty INLINE and RESTRICT values (aka empty
# values require special casing).
configure_file("${AOM_ROOT}/build/cmake/aom_config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/aom_config.h")
"${AOM_CONFIG_DIR}/aom_config.h")
# Read the current git hash.
find_package(Git)
......@@ -153,11 +159,54 @@ set(AOM_CMAKE_CONFIG "cmake")
configure_file("${AOM_ROOT}/build/cmake/aom_config.c.cmake"
"${AOM_CONFIG_DIR}/aom_config.c")
# Find Perl.
# Find Perl and generate the RTCD sources.
find_package(Perl)
if (NOT PERL_FOUND)
message(FATAL_ERROR "Perl is required to build libaom.")
endif ()
configure_file(
"${AOM_ROOT}/build/cmake/targets/rtcd_templates/${AOM_ARCH}.rtcd.cmake"
"${AOM_CONFIG_DIR}/${AOM_ARCH}.rtcd")
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")
set(AOM_RTCD_SYMBOL_LIST aom_dsp_rtcd aom_scale_rtcd aom_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")
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)
execute_process(COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/make/rtcd.pl"
--arch=${AOM_ARCH} --sym=${AOM_RTCD_SYMBOL}
--config=${AOM_CONFIG_DIR}/${AOM_ARCH}.rtcd
${AOM_RTCD_CONFIG_FILE}
OUTPUT_FILE ${AOM_RTCD_HEADER_FILE})
endforeach()
macro(AomAddRtcdGenerationCommand config output source symbol)
add_custom_command(OUTPUT ${output}
COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/make/rtcd.pl"
--arch=${AOM_ARCH} --sym=${symbol}
--config=${AOM_CONFIG_DIR}/${AOM_ARCH}.rtcd
${config} > ${output}
DEPENDS ${config}
COMMENT "Generating ${output}"
WORKING_DIRECTORY ${AOM_CONFIG_DIR}
VERBATIM)
set_property(SOURCE ${source} APPEND PROPERTY OBJECT_DEPENDS ${output})
endmacro()
# Generate aom_version.h.
if ("${AOM_GIT_DESCRIPTION}" STREQUAL "")
......
##
## 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.
##
cmake_minimum_required(VERSION 3.2)
set(AOM_ARCH "generic")
# TODO(tomfinegan): These must not be hard coded. They must be set based on
# the values of the externally configurable vars that omit the RTCD_ prefix.
set(RTCD_CONFIG_AV1 "yes")
set(RTCD_CONFIG_AV1_DECODER "yes")
set(RTCD_CONFIG_AV1_ENCODER "yes")
set(RTCD_CONFIG_DEPENDENCY_TRACKING "yes")
set(RTCD_CONFIG_INSTALL_BINS "yes")
set(RTCD_CONFIG_INSTALL_LIBS "yes")
set(RTCD_CONFIG_GCC "yes")
set(RTCD_CONFIG_MULTITHREAD "yes")
set(RTCD_CONFIG_AV1_ENCODER "yes")
set(RTCD_CONFIG_AV1_DECODER "yes")
set(RTCD_CONFIG_AV1 "yes")
set(RTCD_CONFIG_ENCODERS "yes")
set(RTCD_CONFIG_DECODERS "yes")
set(RTCD_CONFIG_SPATIAL_RESAMPLING "yes")
set(RTCD_CONFIG_STATIC "yes")
set(RTCD_CONFIG_OS_SUPPORT "yes")
set(RTCD_CONFIG_TEMPORAL_DENOISING "yes")
##
## 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.
##
CONFIG_AV1=${RTCD_CONFIG_AV1}
CONFIG_AV1_DECODER=${RTCD_CONFIG_AV1_DECODER}
CONFIG_AV1_ENCODER=${RTCD_CONFIG_AV1_ENCODER}
CONFIG_DEPENDENCY_TRACKING=${RTCD_CONFIG_DEPENDENCY_TRACKING}
CONFIG_INSTALL_BINS=${RTCD_CONFIG_INSTALL_BINS}
CONFIG_INSTALL_LIBS=${RTCD_CONFIG_INSTALL_LIBS}
CONFIG_GCC=${RTCD_CONFIG_GCC}
CONFIG_MULTITHREAD=${RTCD_CONFIG_MULTITHREAD}
CONFIG_AV1_ENCODER=${RTCD_CONFIG_AV1_ENCODER}
CONFIG_AV1_DECODER=${RTCD_CONFIG_AV1_DECODER}
CONFIG_AV1=${RTCD_CONFIG_AV1}
CONFIG_ENCODERS=${RTCD_CONFIG_ENCODERS}
CONFIG_DECODERS=${RTCD_CONFIG_DECODERS}
CONFIG_SPATIAL_RESAMPLING=${RTCD_CONFIG_SPATIAL_RESAMPLING}
CONFIG_STATIC=${RTCD_CONFIG_STATIC}
CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT}
CONFIG_TEMPORAL_DENOISING=${RTCD_CONFIG_TEMPORAL_DENOISING}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment