2018-06-21 20:47:50 +03:00
|
|
|
#
|
|
|
|
# Copyright (c) 2017, Alliance for Open Media. All rights reserved
|
|
|
|
#
|
|
|
|
# This source code is subject to the terms of the BSD 2 Clause License and the
|
|
|
|
# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was
|
|
|
|
# not distributed with this source code in the LICENSE file, you can obtain it
|
|
|
|
# at www.aomedia.org/license/software. If the Alliance for Open Media Patent
|
|
|
|
# License 1.0 was not distributed with this source code in the PATENTS file, you
|
|
|
|
# can obtain it at www.aomedia.org/license/patent.
|
|
|
|
#
|
|
|
|
if(AOM_DOCS_CMAKE_)
|
|
|
|
return()
|
|
|
|
endif() # AOM_DOCS_CMAKE_
|
2017-05-11 00:16:55 +03:00
|
|
|
set(AOM_DOCS_CMAKE_ 1)
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
|
|
|
set(AOM_DOXYFILE "${AOM_CONFIG_DIR}/doxyfile")
|
|
|
|
set(AOM_DOXYGEN_CONFIG_TEMPLATE "libs.doxy_template")
|
|
|
|
set(AOM_DOXYGEN_OUTPUT_DIR "${AOM_CONFIG_DIR}/dox")
|
|
|
|
set(AOM_DOXYGEN_SECTIONS "av1")
|
|
|
|
|
2018-09-20 00:27:06 +03:00
|
|
|
set(AOM_DOXYGEN_SOURCES
|
|
|
|
"${AOM_ROOT}/aom/aom.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_codec.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_decoder.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_encoder.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_frame_buffer.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_image.h"
|
|
|
|
"${AOM_ROOT}/aom/aom_integer.h"
|
|
|
|
"${AOM_ROOT}/keywords.dox"
|
|
|
|
"${AOM_ROOT}/mainpage.dox"
|
|
|
|
"${AOM_ROOT}/usage.dox")
|
2018-06-21 20:47:50 +03:00
|
|
|
|
|
|
|
if(CONFIG_AV1_DECODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/apps/aomdec.c" "${AOM_ROOT}/examples/decode_to_md5.c"
|
2017-05-11 00:16:55 +03:00
|
|
|
"${AOM_ROOT}/examples/decode_with_drops.c"
|
|
|
|
"${AOM_ROOT}/examples/simple_decoder.c")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Full featured decoder." "Frame by frame MD5 checksum."
|
|
|
|
"Drops frames while decoding." "Simplified decoder loop.")
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_decoder decoder")
|
|
|
|
|
2018-09-20 00:27:06 +03:00
|
|
|
set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${AOM_ROOT}/aom/aomdx.h"
|
2017-05-11 00:16:55 +03:00
|
|
|
"${AOM_ROOT}/usage_dx.dox")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
if(CONFIG_ANALYZER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
2017-07-11 01:33:39 +03:00
|
|
|
"${AOM_ROOT}/examples/analyzer.cc")
|
2017-05-11 00:16:55 +03:00
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
2017-05-11 00:16:55 +03:00
|
|
|
"Bitstream analyzer.")
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
if(CONFIG_INSPECTION)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/inspect.c")
|
2017-05-11 00:16:55 +03:00
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
2017-05-11 00:16:55 +03:00
|
|
|
"Bitstream inspector.")
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_AV1_ENCODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/apps/aomenc.c" "${AOM_ROOT}/examples/lossless_encoder.c"
|
|
|
|
"${AOM_ROOT}/examples/set_maps.c" "${AOM_ROOT}/examples/simple_encoder.c"
|
2017-05-11 00:16:55 +03:00
|
|
|
"${AOM_ROOT}/examples/twopass_encoder.c")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Full featured encoder." "Simplified lossless encoder."
|
|
|
|
"Set active and ROI maps." "Simplified encoder loop."
|
2017-05-11 00:16:55 +03:00
|
|
|
"Two-pass encoder loop.")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/scalable_encoder.c")
|
|
|
|
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Scalable encoder loop.")
|
|
|
|
|
2017-05-11 00:16:55 +03:00
|
|
|
set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_encoder encoder")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${AOM_ROOT}/aom/aomcx.h"
|
2018-09-20 00:27:06 +03:00
|
|
|
"${AOM_ROOT}/usage_cx.dox")
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
if(CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
2017-05-11 00:16:55 +03:00
|
|
|
"${AOM_ROOT}/examples/aom_cx_set_ref.c")
|
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
2017-05-11 00:16:55 +03:00
|
|
|
"Set encoder reference frame.")
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_AV1_ENCODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/lightfield_encoder.c")
|
|
|
|
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Lightfield encoder example.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_AV1_DECODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/lightfield_tile_list_decoder.c")
|
|
|
|
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Lightfield tile list decoder example.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_AV1_DECODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/lightfield_decoder.c")
|
|
|
|
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Lightfield decoder example.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_ROOT}/examples/lightfield_bitstream_parsing.c")
|
|
|
|
|
|
|
|
set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
|
|
|
|
"Lightfield bitstream parsing example.")
|
|
|
|
endif()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Iterates over list named by $list_name and appends each item to $AOM_DOXYFILE
|
|
|
|
# as values assigned to $var_name with no line breaks between list items.
|
|
|
|
# Appends a new line after the entire config variable is expanded.
|
2018-06-21 20:47:50 +03:00
|
|
|
function(write_cmake_list_to_doxygen_config_var var_name list_name)
|
2017-05-11 00:16:55 +03:00
|
|
|
unset(output_string)
|
2018-06-21 20:47:50 +03:00
|
|
|
foreach(list_item ${${list_name}})
|
2017-05-11 00:16:55 +03:00
|
|
|
set(output_string "${output_string} ${list_item} ")
|
2018-06-21 20:47:50 +03:00
|
|
|
endforeach()
|
2017-05-11 00:16:55 +03:00
|
|
|
string(STRIP "${output_string}" output_string)
|
|
|
|
file(APPEND "${AOM_DOXYFILE}" "${var_name} += ${output_string}\n")
|
2018-06-21 20:47:50 +03:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(get_name file_path name_var)
|
|
|
|
get_filename_component(file_basename ${file_path} NAME)
|
|
|
|
get_filename_component(${name_var} ${file_basename} NAME_WE)
|
|
|
|
set(${name_var} ${${name_var}} PARENT_SCOPE)
|
|
|
|
endfunction()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
2018-06-21 20:47:50 +03:00
|
|
|
function(setup_documentation_targets)
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Sanity check: the lengths of these lists must match.
|
|
|
|
list(LENGTH AOM_DOXYGEN_EXAMPLE_SOURCES num_sources)
|
|
|
|
list(LENGTH AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS num_descs)
|
2018-06-21 20:47:50 +03:00
|
|
|
if(NOT ${num_sources} EQUAL ${num_descs})
|
2017-05-11 00:16:55 +03:00
|
|
|
message(FATAL_ERROR "Unqeual example and description totals.")
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Take the list of examples and produce example_basename.dox for each file in
|
|
|
|
# the list.
|
|
|
|
file(MAKE_DIRECTORY "${AOM_DOXYGEN_OUTPUT_DIR}")
|
2018-06-21 20:47:50 +03:00
|
|
|
foreach(example_file ${AOM_DOXYGEN_EXAMPLE_SOURCES})
|
2017-05-11 00:16:55 +03:00
|
|
|
unset(example_basename)
|
|
|
|
get_name("${example_file}" "example_name")
|
|
|
|
set(example_dox "${AOM_DOXYGEN_OUTPUT_DIR}/${example_name}.dox")
|
|
|
|
set(dox_string "/*!\\page example_${example_name} ${example_name}\n")
|
|
|
|
set(dox_string "${dox_string} \\includelineno ${example_file}\n*/\n")
|
|
|
|
file(WRITE "${example_dox}" ${dox_string})
|
|
|
|
set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${example_dox}")
|
2018-06-21 20:47:50 +03:00
|
|
|
endforeach()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Generate samples.dox, an index page that refers to the example_basename.dox
|
|
|
|
# files that were just created.
|
2018-06-21 20:47:50 +03:00
|
|
|
set(
|
|
|
|
samples_header
|
|
|
|
"
|
2017-05-11 00:16:55 +03:00
|
|
|
/*!\\page samples Sample Code
|
|
|
|
This SDK includes a number of sample applications. Each sample documents a
|
|
|
|
feature of the SDK in both prose and the associated C code. The following
|
|
|
|
samples are included:
|
|
|
|
"
|
2018-06-21 20:47:50 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
utils_desc
|
|
|
|
"
|
2017-05-11 00:16:55 +03:00
|
|
|
In addition, the SDK contains a number of utilities. Since these utilities are
|
|
|
|
built upon the concepts described in the sample code listed above, they are not
|
|
|
|
documented in pieces like the samples are. Their source is included here for
|
|
|
|
reference. The following utilities are included:
|
2018-06-21 20:47:50 +03:00
|
|
|
"
|
|
|
|
)
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Write the description for the samples section.
|
|
|
|
set(samples_dox "${AOM_CONFIG_DIR}/samples.dox")
|
|
|
|
file(WRITE "${samples_dox}" "${samples_header}\n")
|
|
|
|
|
|
|
|
# Iterate over $AOM_DOXYGEN_EXAMPLE_SOURCES and
|
|
|
|
# $AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS and massage example names as required by
|
|
|
|
# AV1's doxygen setup.
|
|
|
|
math(EXPR max_example_index "${num_sources} - 1")
|
2018-06-21 20:47:50 +03:00
|
|
|
foreach(NUM RANGE ${max_example_index})
|
2017-05-11 00:16:55 +03:00
|
|
|
list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${NUM} ex_name)
|
|
|
|
get_name("${ex_name}" "ex_name")
|
|
|
|
|
|
|
|
# AV1's doxygen lists aomdec and aomenc as utils apart from the examples.
|
|
|
|
# Save the indexes for another pass.
|
2018-06-21 20:47:50 +03:00
|
|
|
if("${ex_name}" MATCHES "aomdec\|aomenc")
|
2017-05-11 00:16:55 +03:00
|
|
|
set(util_indexes "${util_indexes}" "${NUM}")
|
|
|
|
continue()
|
2018-06-21 20:47:50 +03:00
|
|
|
endif()
|
2017-05-11 00:16:55 +03:00
|
|
|
list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${NUM} ex_desc)
|
|
|
|
file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
|
2018-06-21 20:47:50 +03:00
|
|
|
endforeach()
|
2017-05-11 00:16:55 +03:00
|
|
|
|
|
|
|
# Write the description and index for the utils.
|
|
|
|
file(APPEND "${samples_dox}" "${utils_desc}\n")
|
2018-06-21 20:47:50 +03:00
|
|
|
foreach(util_index ${util_indexes})
|
2017-05-11 00:16:55 +03:00
|
|
|
list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${util_index} ex_name)
|
|
|
|
get_name("${ex_name}" "ex_name")
|
|
|
|
list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${util_index} ex_desc)
|
|
|
|
file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
|
2018-06-21 20:47:50 +03:00
|
|
|
endforeach()
|
2017-05-11 00:16:55 +03:00
|
|
|
file(APPEND "${samples_dox}" "*/")
|
|
|
|
|
|
|
|
# Add $samples_dox to the doxygen inputs.
|
|
|
|
get_filename_component(samples_dox ${samples_dox} NAME)
|
|
|
|
set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} ${samples_dox})
|
|
|
|
|
|
|
|
# Generate libaom's doxyfile.
|
2017-07-11 01:33:39 +03:00
|
|
|
file(WRITE "${AOM_DOXYFILE}" "##\n## GENERATED FILE. DO NOT EDIT\n##\n")
|
|
|
|
file(READ "${AOM_ROOT}/${AOM_DOXYGEN_CONFIG_TEMPLATE}" doxygen_template_data)
|
|
|
|
file(APPEND "${AOM_DOXYFILE}" ${doxygen_template_data})
|
2017-05-11 00:16:55 +03:00
|
|
|
file(APPEND "${AOM_DOXYFILE}"
|
2018-06-21 20:47:50 +03:00
|
|
|
"EXAMPLE_PATH += ${AOM_ROOT} ${AOM_ROOT}/examples\n")
|
2017-05-11 00:16:55 +03:00
|
|
|
file(APPEND "${AOM_DOXYFILE}"
|
2018-06-21 20:47:50 +03:00
|
|
|
"INCLUDE_PATH += ${AOM_CONFIG_DIR} ${AOM_ROOT}\n")
|
|
|
|
file(APPEND "${AOM_DOXYFILE}"
|
|
|
|
"STRIP_FROM_PATH += ${AOM_ROOT} ${AOM_CONFIG_DIR}\n")
|
2017-05-11 00:16:55 +03:00
|
|
|
write_cmake_list_to_doxygen_config_var("INPUT" "AOM_DOXYGEN_SOURCES")
|
|
|
|
write_cmake_list_to_doxygen_config_var("ENABLED_SECTIONS"
|
|
|
|
"AOM_DOXYGEN_SECTIONS")
|
|
|
|
|
|
|
|
# Add the doxygen generation rule.
|
|
|
|
add_custom_target(docs ALL
|
|
|
|
COMMAND "${DOXYGEN_EXECUTABLE}" "${AOM_DOXYFILE}"
|
|
|
|
DEPENDS "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
|
2018-06-21 20:47:50 +03:00
|
|
|
${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_DOXYGEN_CONFIG_TEMPLATE}"
|
2017-05-11 00:16:55 +03:00
|
|
|
SOURCES "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
|
2018-06-21 20:47:50 +03:00
|
|
|
${AOM_DOXYGEN_EXAMPLE_SOURCES}
|
|
|
|
"${AOM_DOXYGEN_CONFIG_TEMPLATE}")
|
|
|
|
endfunction()
|