blob: 901e8c4a0ac1e4040d52b633d09905b34f44e9cd [file] [log] [blame]
Johann589bae82018-04-27 10:57:44 -07001#
James Zernf4ad7fc2024-06-12 16:37:08 -07002# Copyright (c) 2017, Alliance for Open Media. All rights reserved.
Johann589bae82018-04-27 10:57:44 -07003#
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_DOCS_CMAKE_)
Johann29a59732018-04-27 10:51:00 -070012 return()
Johann589bae82018-04-27 10:57:44 -070013endif() # AOM_DOCS_CMAKE_
Tom Finegan0d066ce2017-05-30 11:07:05 -070014set(AOM_DOCS_CMAKE_ 1)
15
16cmake_minimum_required(VERSION 3.5)
17
18set(AOM_DOXYFILE "${AOM_CONFIG_DIR}/doxyfile")
19set(AOM_DOXYGEN_CONFIG_TEMPLATE "libs.doxy_template")
20set(AOM_DOXYGEN_OUTPUT_DIR "${AOM_CONFIG_DIR}/dox")
21set(AOM_DOXYGEN_SECTIONS "av1")
22
Urvang Joshiabf31fa2020-06-01 17:34:51 -070023set(AOM_DOXYGEN_SOURCES
24 "${AOM_ROOT}/aom/aom.h"
25 "${AOM_ROOT}/aom/aom_codec.h"
26 "${AOM_ROOT}/aom/aom_decoder.h"
27 "${AOM_ROOT}/aom/aom_encoder.h"
Cheng Chenfd9ed832021-03-11 23:08:09 -080028 "${AOM_ROOT}/aom/aom_external_partition.h"
Urvang Joshiabf31fa2020-06-01 17:34:51 -070029 "${AOM_ROOT}/aom/aom_frame_buffer.h"
30 "${AOM_ROOT}/aom/aom_image.h"
31 "${AOM_ROOT}/aom/aom_integer.h"
32 "${AOM_ROOT}/av1/common/av1_common_int.h"
Debargha Mukherjee9a2e29b2020-06-18 08:11:15 -070033 "${AOM_ROOT}/av1/common/av1_loopfilter.h"
Urvang Joshi6589c3b2020-06-04 16:41:44 -070034 "${AOM_ROOT}/av1/common/blockd.h"
Debargha Mukherjee82b24382020-06-16 23:30:39 -070035 "${AOM_ROOT}/av1/common/cdef.h"
Debargha Mukherjee9a2e29b2020-06-18 08:11:15 -070036 "${AOM_ROOT}/av1/common/enums.h"
37 "${AOM_ROOT}/av1/common/restoration.h"
Urvang Joshiabf31fa2020-06-01 17:34:51 -070038 "${AOM_ROOT}/keywords.dox"
39 "${AOM_ROOT}/mainpage.dox"
40 "${AOM_ROOT}/usage.dox")
Tom Finegan0d066ce2017-05-30 11:07:05 -070041
Johann589bae82018-04-27 10:57:44 -070042if(CONFIG_AV1_DECODER)
43 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -070044 "${AOM_ROOT}/apps/aomdec.c"
45 "${AOM_ROOT}/examples/decode_to_md5.c"
46 "${AOM_ROOT}/examples/decode_with_drops.c"
47 "${AOM_ROOT}/examples/simple_decoder.c")
Tom Finegan0d066ce2017-05-30 11:07:05 -070048
Johann589bae82018-04-27 10:57:44 -070049 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -070050 "Full featured decoder."
51 "Frame by frame MD5 checksum."
52 "Drops frames while decoding."
53 "Simplified decoder loop.")
Tom Finegan0d066ce2017-05-30 11:07:05 -070054
55 set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_decoder decoder")
56
Johannb72d2e12018-09-11 12:41:38 -070057 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${AOM_ROOT}/aom/aomdx.h"
Urvang Joshic819a6c2020-06-10 10:50:55 -070058 "${AOM_ROOT}/usage_dx.dox"
59 "${AOM_ROOT}/av1/decoder/decoder.h")
Tom Finegan0d066ce2017-05-30 11:07:05 -070060
Johann589bae82018-04-27 10:57:44 -070061 if(CONFIG_ANALYZER)
62 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -070063 "${AOM_ROOT}/examples/analyzer.cc")
Tom Finegan0d066ce2017-05-30 11:07:05 -070064
Johann589bae82018-04-27 10:57:44 -070065 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -070066 "Bitstream analyzer.")
Johann589bae82018-04-27 10:57:44 -070067 endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -070068
Johann589bae82018-04-27 10:57:44 -070069 if(CONFIG_INSPECTION)
70 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -070071 "${AOM_ROOT}/examples/inspect.c")
Tom Finegan0d066ce2017-05-30 11:07:05 -070072
Johann589bae82018-04-27 10:57:44 -070073 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -070074 "Bitstream inspector.")
Johann589bae82018-04-27 10:57:44 -070075 endif()
Yunqing Wangc8f7a3b2020-05-04 15:23:48 -070076
Yunqing Wang41aa31a2020-05-11 15:29:31 -070077 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES}
78 "${AOM_ROOT}/doc/dev_guide/av1_decoder.dox")
Johann589bae82018-04-27 10:57:44 -070079endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -070080
Johann589bae82018-04-27 10:57:44 -070081if(CONFIG_AV1_ENCODER)
82 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -070083 "${AOM_ROOT}/apps/aomenc.c"
84 "${AOM_ROOT}/examples/lossless_encoder.c"
85 "${AOM_ROOT}/examples/set_maps.c"
86 "${AOM_ROOT}/examples/simple_encoder.c"
87 "${AOM_ROOT}/examples/twopass_encoder.c")
Tom Finegan0d066ce2017-05-30 11:07:05 -070088
Johann589bae82018-04-27 10:57:44 -070089 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -070090 "Full featured encoder."
91 "Simplified lossless encoder."
92 "Set active and ROI maps."
93 "Simplified encoder loop."
94 "Two-pass encoder loop.")
Tom Finegan0d066ce2017-05-30 11:07:05 -070095
Johann589bae82018-04-27 10:57:44 -070096 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -070097 "${AOM_ROOT}/examples/scalable_encoder.c")
Soo-Chul Hanf8589862018-01-24 03:13:14 +000098
Johann589bae82018-04-27 10:57:44 -070099 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700100 "Scalable encoder loop.")
Soo-Chul Hanf8589862018-01-24 03:13:14 +0000101
Marco Paniconi67142112019-07-24 15:00:31 -0700102 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Jerome Jiang61d6c012023-06-08 15:10:30 -0400103 "${AOM_ROOT}/examples/svc_encoder_rtc.cc")
Marco Paniconi67142112019-07-24 15:00:31 -0700104
105 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
106 "Layered encoder for RTC.")
107
Tom Finegan0d066ce2017-05-30 11:07:05 -0700108 set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_encoder encoder")
109
Johann589bae82018-04-27 10:57:44 -0700110 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${AOM_ROOT}/aom/aomcx.h"
Tom Finegan85aa64b2019-05-20 15:57:47 -0700111 "${AOM_ROOT}/usage_cx.dox")
Yunqing Wang41aa31a2020-05-11 15:29:31 -0700112 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES}
113 "${AOM_ROOT}/doc/dev_guide/av1_encoder.dox")
chiyotsaide1caf82020-06-09 14:59:22 -0700114 set(AOM_DOXYGEN_SOURCES
115 ${AOM_DOXYGEN_SOURCES}
Paul Wilkinsedf0f4a2020-07-21 16:47:52 +0100116 "${AOM_ROOT}/aom_scale/yv12config.h"
Yue Chen2d8405c2020-06-10 14:42:05 -0700117 "${AOM_ROOT}/av1/encoder/bitstream.h"
chiyotsaic2f38412020-06-10 16:07:21 -0700118 "${AOM_ROOT}/av1/encoder/block.h"
Marco Paniconi5b2faba2020-07-09 11:39:22 -0700119 "${AOM_ROOT}/av1/encoder/aq_cyclicrefresh.h"
chiyotsaide1caf82020-06-09 14:59:22 -0700120 "${AOM_ROOT}/av1/encoder/encode_strategy.c"
121 "${AOM_ROOT}/av1/encoder/encode_strategy.h"
122 "${AOM_ROOT}/av1/encoder/encodeframe.c"
123 "${AOM_ROOT}/av1/encoder/encoder.c"
124 "${AOM_ROOT}/av1/encoder/encoder.h"
angiebird96bdb2a2020-06-28 17:24:24 -0700125 "${AOM_ROOT}/av1/encoder/encodetxb.h"
chiyotsaide1caf82020-06-09 14:59:22 -0700126 "${AOM_ROOT}/av1/encoder/firstpass.h"
Paul Wilkinsbe20bc22020-07-16 14:46:57 +0100127 "${AOM_ROOT}/av1/encoder/gop_structure.h"
Debargha Mukherjee82b24382020-06-16 23:30:39 -0700128 "${AOM_ROOT}/av1/encoder/interp_search.c"
chiyotsaide1caf82020-06-09 14:59:22 -0700129 "${AOM_ROOT}/av1/encoder/intra_mode_search.h"
130 "${AOM_ROOT}/av1/encoder/intra_mode_search.c"
chiyotsaic9b9fa52020-06-12 15:19:50 -0700131 "${AOM_ROOT}/av1/encoder/intra_mode_search_utils.h"
chiyotsaide1caf82020-06-09 14:59:22 -0700132 "${AOM_ROOT}/av1/encoder/lookahead.h"
chiyotsaic9b9fa52020-06-12 15:19:50 -0700133 "${AOM_ROOT}/av1/encoder/palette.h"
134 "${AOM_ROOT}/av1/encoder/palette.c"
Jayasanker J4bca9612020-07-06 15:34:30 +0530135 "${AOM_ROOT}/av1/encoder/partition_search.h"
136 "${AOM_ROOT}/av1/encoder/partition_search.c"
Paul Wilkinsbe20bc22020-07-16 14:46:57 +0100137 "${AOM_ROOT}/av1/encoder/pass2_strategy.h"
bohanlid165b192020-06-10 21:46:29 -0700138 "${AOM_ROOT}/av1/encoder/pass2_strategy.c"
Debargha Mukherjee2d565f42020-06-17 18:07:12 -0700139 "${AOM_ROOT}/av1/encoder/pickcdef.h"
chiyotsaide1caf82020-06-09 14:59:22 -0700140 "${AOM_ROOT}/av1/encoder/picklpf.h"
Debargha Mukherjee82b24382020-06-16 23:30:39 -0700141 "${AOM_ROOT}/av1/encoder/pickrst.h"
Urvang Joshi7e91a692020-06-18 14:47:07 -0700142 "${AOM_ROOT}/av1/encoder/ratectrl.c"
Urvang Joshifee52c62020-06-17 13:45:55 -0700143 "${AOM_ROOT}/av1/encoder/ratectrl.h"
Paul Wilkinsc8d3f112020-07-08 17:58:14 +0100144 "${AOM_ROOT}/av1/encoder/rc_utils.h"
chiyotsaide1caf82020-06-09 14:59:22 -0700145 "${AOM_ROOT}/av1/encoder/rdopt.h"
Hui Su60dd5162020-06-10 16:56:14 -0700146 "${AOM_ROOT}/av1/encoder/rdopt.c"
Debargha Mukherjee2d565f42020-06-17 18:07:12 -0700147 "${AOM_ROOT}/av1/encoder/speed_features.h"
Jerome Jiang66e76242020-07-09 11:38:19 -0700148 "${AOM_ROOT}/av1/encoder/svc_layercontext.c"
149 "${AOM_ROOT}/av1/encoder/svc_layercontext.h"
Paul Wilkinsc84e8e22020-07-21 19:09:33 +0100150 "${AOM_ROOT}/av1/encoder/temporal_filter.h"
151 "${AOM_ROOT}/av1/encoder/temporal_filter.c"
Paul Wilkinsff98f3e2020-07-27 16:01:05 +0100152 "${AOM_ROOT}/av1/encoder/tpl_model.h"
Marco Paniconi08f71f22020-07-14 10:41:47 -0700153 "${AOM_ROOT}/av1/encoder/tx_search.h"
Vishesha45092c2021-01-25 00:28:11 +0530154 "${AOM_ROOT}/av1/encoder/txb_rdopt.h"
Fyodor Kyslov30824012020-07-14 13:48:08 -0700155 "${AOM_ROOT}/av1/encoder/var_based_part.h"
Yunqing Wang3135d772022-03-17 23:31:04 -0700156 "${AOM_ROOT}/av1/encoder/nonrd_opt.h"
Fyodor Kyslov30824012020-07-14 13:48:08 -0700157 "${AOM_ROOT}/av1/encoder/nonrd_pickmode.c")
Johann589bae82018-04-27 10:57:44 -0700158endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700159
Johann589bae82018-04-27 10:57:44 -0700160if(CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
161 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700162 "${AOM_ROOT}/examples/aom_cx_set_ref.c")
Tom Finegan0d066ce2017-05-30 11:07:05 -0700163
Johann589bae82018-04-27 10:57:44 -0700164 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700165 "Set encoder reference frame.")
Johann589bae82018-04-27 10:57:44 -0700166endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700167
Yunqing Wangb97cfae2018-05-11 14:19:05 -0700168if(CONFIG_AV1_ENCODER)
169 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700170 "${AOM_ROOT}/examples/lightfield_encoder.c")
Yunqing Wangb97cfae2018-05-11 14:19:05 -0700171
172 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700173 "Lightfield encoder example.")
Yunqing Wangb97cfae2018-05-11 14:19:05 -0700174endif()
175
176if(CONFIG_AV1_DECODER)
Tom Finegan85aa64b2019-05-20 15:57:47 -0700177 set(AOM_DOXYGEN_EXAMPLE_SOURCES
178 ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Yunqing Wangd417bb52018-06-03 14:13:38 -0700179 "${AOM_ROOT}/examples/lightfield_tile_list_decoder.c")
180
181 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700182 "Lightfield tile list decoder example.")
Yunqing Wangd417bb52018-06-03 14:13:38 -0700183endif()
184
185if(CONFIG_AV1_DECODER)
186 set(AOM_DOXYGEN_EXAMPLE_SOURCES ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700187 "${AOM_ROOT}/examples/lightfield_decoder.c")
Yunqing Wangb97cfae2018-05-11 14:19:05 -0700188
189 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700190 "Lightfield decoder example.")
Yunqing Wangb97cfae2018-05-11 14:19:05 -0700191endif()
192
Yunqing Wang40bde4d2018-06-01 16:48:03 -0700193if(CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
Tom Finegan85aa64b2019-05-20 15:57:47 -0700194 set(AOM_DOXYGEN_EXAMPLE_SOURCES
195 ${AOM_DOXYGEN_EXAMPLE_SOURCES}
Yunqing Wang40bde4d2018-06-01 16:48:03 -0700196 "${AOM_ROOT}/examples/lightfield_bitstream_parsing.c")
197
198 set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
Tom Finegan85aa64b2019-05-20 15:57:47 -0700199 "Lightfield bitstream parsing example.")
Yunqing Wang40bde4d2018-06-01 16:48:03 -0700200endif()
201
Tom Finegan0d066ce2017-05-30 11:07:05 -0700202# Iterates over list named by $list_name and appends each item to $AOM_DOXYFILE
203# as values assigned to $var_name with no line breaks between list items.
204# Appends a new line after the entire config variable is expanded.
Johann589bae82018-04-27 10:57:44 -0700205function(write_cmake_list_to_doxygen_config_var var_name list_name)
Tom Finegan0d066ce2017-05-30 11:07:05 -0700206 unset(output_string)
Johann589bae82018-04-27 10:57:44 -0700207 foreach(list_item ${${list_name}})
Tom Finegan0d066ce2017-05-30 11:07:05 -0700208 set(output_string "${output_string} ${list_item} ")
Johann589bae82018-04-27 10:57:44 -0700209 endforeach()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700210 string(STRIP "${output_string}" output_string)
211 file(APPEND "${AOM_DOXYFILE}" "${var_name} += ${output_string}\n")
Johann589bae82018-04-27 10:57:44 -0700212endfunction()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700213
Johann589bae82018-04-27 10:57:44 -0700214function(get_name file_path name_var)
215 get_filename_component(file_basename ${file_path} NAME)
216 get_filename_component(${name_var} ${file_basename} NAME_WE)
217 set(${name_var} ${${name_var}} PARENT_SCOPE)
218endfunction()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700219
Johann589bae82018-04-27 10:57:44 -0700220function(setup_documentation_targets)
221
Tom Finegan0d066ce2017-05-30 11:07:05 -0700222 # Sanity check: the lengths of these lists must match.
223 list(LENGTH AOM_DOXYGEN_EXAMPLE_SOURCES num_sources)
224 list(LENGTH AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS num_descs)
Johann589bae82018-04-27 10:57:44 -0700225 if(NOT ${num_sources} EQUAL ${num_descs})
Wan-Teh Changb1c83672023-09-27 11:41:14 -0700226 message(FATAL_ERROR "Unequal example and description totals.")
Johann589bae82018-04-27 10:57:44 -0700227 endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700228
229 # Take the list of examples and produce example_basename.dox for each file in
230 # the list.
231 file(MAKE_DIRECTORY "${AOM_DOXYGEN_OUTPUT_DIR}")
Johann589bae82018-04-27 10:57:44 -0700232 foreach(example_file ${AOM_DOXYGEN_EXAMPLE_SOURCES})
Tom Finegan0d066ce2017-05-30 11:07:05 -0700233 unset(example_basename)
234 get_name("${example_file}" "example_name")
235 set(example_dox "${AOM_DOXYGEN_OUTPUT_DIR}/${example_name}.dox")
236 set(dox_string "/*!\\page example_${example_name} ${example_name}\n")
237 set(dox_string "${dox_string} \\includelineno ${example_file}\n*/\n")
238 file(WRITE "${example_dox}" ${dox_string})
239 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${example_dox}")
Johann589bae82018-04-27 10:57:44 -0700240 endforeach()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700241
242 # Generate samples.dox, an index page that refers to the example_basename.dox
243 # files that were just created.
Tom Finegan85aa64b2019-05-20 15:57:47 -0700244 set(samples_header "
Tom Finegan0d066ce2017-05-30 11:07:05 -0700245/*!\\page samples Sample Code
246This SDK includes a number of sample applications. Each sample documents a
247feature of the SDK in both prose and the associated C code. The following
248samples are included:
Tom Finegan85aa64b2019-05-20 15:57:47 -0700249")
Johann589bae82018-04-27 10:57:44 -0700250
Tom Finegan85aa64b2019-05-20 15:57:47 -0700251 set(utils_desc "
Tom Finegan0d066ce2017-05-30 11:07:05 -0700252In addition, the SDK contains a number of utilities. Since these utilities are
253built upon the concepts described in the sample code listed above, they are not
254documented in pieces like the samples are. Their source is included here for
255reference. The following utilities are included:
Tom Finegan85aa64b2019-05-20 15:57:47 -0700256")
Tom Finegan0d066ce2017-05-30 11:07:05 -0700257
258 # Write the description for the samples section.
259 set(samples_dox "${AOM_CONFIG_DIR}/samples.dox")
260 file(WRITE "${samples_dox}" "${samples_header}\n")
261
262 # Iterate over $AOM_DOXYGEN_EXAMPLE_SOURCES and
263 # $AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS and massage example names as required by
264 # AV1's doxygen setup.
265 math(EXPR max_example_index "${num_sources} - 1")
Johann589bae82018-04-27 10:57:44 -0700266 foreach(NUM RANGE ${max_example_index})
Tom Finegan0d066ce2017-05-30 11:07:05 -0700267 list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${NUM} ex_name)
268 get_name("${ex_name}" "ex_name")
269
270 # AV1's doxygen lists aomdec and aomenc as utils apart from the examples.
271 # Save the indexes for another pass.
Johann589bae82018-04-27 10:57:44 -0700272 if("${ex_name}" MATCHES "aomdec\|aomenc")
Tom Finegan0d066ce2017-05-30 11:07:05 -0700273 set(util_indexes "${util_indexes}" "${NUM}")
274 continue()
Johann589bae82018-04-27 10:57:44 -0700275 endif()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700276 list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${NUM} ex_desc)
277 file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
Johann589bae82018-04-27 10:57:44 -0700278 endforeach()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700279
280 # Write the description and index for the utils.
281 file(APPEND "${samples_dox}" "${utils_desc}\n")
Johann589bae82018-04-27 10:57:44 -0700282 foreach(util_index ${util_indexes})
Tom Finegan0d066ce2017-05-30 11:07:05 -0700283 list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${util_index} ex_name)
284 get_name("${ex_name}" "ex_name")
285 list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${util_index} ex_desc)
286 file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
Johann589bae82018-04-27 10:57:44 -0700287 endforeach()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700288 file(APPEND "${samples_dox}" "*/")
289
290 # Add $samples_dox to the doxygen inputs.
291 get_filename_component(samples_dox ${samples_dox} NAME)
292 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} ${samples_dox})
293
Yunqing Wang04caf8b2020-05-11 20:52:17 -0700294 # There are issues to show Markdown file for old Doxygen version. Here, only
295 # enable Markdown support for 1.8.16 or newer.
296 if(${DOXYGEN_VERSION_VALUE} GREATER_EQUAL 1008016)
297 set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_md_support")
298 set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${AOM_ROOT}/README.md")
Yunqing Wang393387f2020-06-11 15:11:08 -0700299 # Uncomment and add AlgorithmDescription.md in result page when it is done.
300 # set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES}
301 # "${AOM_ROOT}/doc/AlgorithmDescription.md")
Yunqing Wang04caf8b2020-05-11 20:52:17 -0700302 endif()
303
Tom Finegan0d066ce2017-05-30 11:07:05 -0700304 # Generate libaom's doxyfile.
Tom Finegan746a7852017-06-02 11:29:48 -0700305 file(WRITE "${AOM_DOXYFILE}" "##\n## GENERATED FILE. DO NOT EDIT\n##\n")
306 file(READ "${AOM_ROOT}/${AOM_DOXYGEN_CONFIG_TEMPLATE}" doxygen_template_data)
307 file(APPEND "${AOM_DOXYFILE}" ${doxygen_template_data})
Tom Finegan0d066ce2017-05-30 11:07:05 -0700308 file(APPEND "${AOM_DOXYFILE}"
Tom Finegan85aa64b2019-05-20 15:57:47 -0700309 "EXAMPLE_PATH += ${AOM_ROOT} ${AOM_ROOT}/examples\n")
Tom Finegan0d066ce2017-05-30 11:07:05 -0700310 file(APPEND "${AOM_DOXYFILE}"
Tom Finegan85aa64b2019-05-20 15:57:47 -0700311 "INCLUDE_PATH += ${AOM_CONFIG_DIR} ${AOM_ROOT}\n")
Johann589bae82018-04-27 10:57:44 -0700312 file(APPEND "${AOM_DOXYFILE}"
Tom Finegan85aa64b2019-05-20 15:57:47 -0700313 "STRIP_FROM_PATH += ${AOM_ROOT} ${AOM_CONFIG_DIR}\n")
Tom Finegan0d066ce2017-05-30 11:07:05 -0700314 write_cmake_list_to_doxygen_config_var("INPUT" "AOM_DOXYGEN_SOURCES")
315 write_cmake_list_to_doxygen_config_var("ENABLED_SECTIONS"
316 "AOM_DOXYGEN_SECTIONS")
317
Yunqing Wang0fd27732020-05-04 14:48:28 -0700318 # Add AOMedia logo.
319 set(aom_logo "aomedia_logo_200.png")
320 configure_file(${AOM_ROOT}/${aom_logo} ${AOM_CONFIG_DIR}/${aom_logo} COPYONLY)
321 file(APPEND "${AOM_DOXYFILE}"
322 "PROJECT_LOGO = ${AOM_CONFIG_DIR}/${aom_logo}\n")
323
Yunqing Wanged7d20c2020-05-08 11:46:37 -0700324 # Only set HAVE_DOT to YES if dot tool is found.
Yunqing Wangc7c0f272020-05-08 14:15:09 -0700325 if(DOXYGEN_DOT_FOUND)
Yunqing Wanged7d20c2020-05-08 11:46:37 -0700326 file(APPEND "${AOM_DOXYFILE}" "HAVE_DOT = YES\n")
Yunqing Wang7747e102020-05-11 20:07:40 -0700327 file(APPEND "${AOM_DOXYFILE}" "DOT_GRAPH_MAX_NODES = 10000\n")
Yunqing Wanged7d20c2020-05-08 11:46:37 -0700328 endif()
329
Yunqing Wangc7c0f272020-05-08 14:15:09 -0700330 # Add image path.
Yunqing Wang41aa31a2020-05-11 15:29:31 -0700331 file(APPEND "${AOM_DOXYFILE}" "IMAGE_PATH += ${AOM_ROOT}/doc/dev_guide\n")
Yunqing Wangc7c0f272020-05-08 14:15:09 -0700332
chiyotsaic2f38412020-06-10 16:07:21 -0700333 # Allow banner style comments
334 file(APPEND "${AOM_DOXYFILE}" "JAVADOC_BANNER = YES")
335
Tom Finegan0d066ce2017-05-30 11:07:05 -0700336 # Add the doxygen generation rule.
337 add_custom_target(docs ALL
338 COMMAND "${DOXYGEN_EXECUTABLE}" "${AOM_DOXYFILE}"
339 DEPENDS "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
Johann589bae82018-04-27 10:57:44 -0700340 ${AOM_DOXYGEN_EXAMPLE_SOURCES}
341 "${AOM_DOXYGEN_CONFIG_TEMPLATE}"
Tom Finegan0d066ce2017-05-30 11:07:05 -0700342 SOURCES "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
Johann589bae82018-04-27 10:57:44 -0700343 ${AOM_DOXYGEN_EXAMPLE_SOURCES}
344 "${AOM_DOXYGEN_CONFIG_TEMPLATE}")
345endfunction()