2 # Copyright (c) 2016, Alliance for Open Media. All rights reserved
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.
12 cmake_minimum_required(VERSION 3.11)
14 cmake_minimum_required(VERSION 3.9)
17 set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
18 set(AOM_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
19 if("${AOM_ROOT}" STREQUAL "${AOM_CONFIG_DIR}")
21 FATAL_ERROR "Building from within the aom source tree is not supported.\n"
22 "Hint: Run these commands\n"
23 "$ rm -rf CMakeCache.txt CMakeFiles\n"
24 "$ mkdir -p ../aom_build\n" "$ cd ../aom_build\n"
25 "And re-run CMake from the aom_build directory.")
30 # GENERATED source property global visibility.
32 cmake_policy(SET CMP0118 NEW)
36 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
39 CACHE STRING "Build type: Debug, Release, RelWithDebInfo or MinSizeRel"
44 if(MSVC AND MSVC_VERSION LESS 1920)
47 "MSVC versions prior to 2019 (v16) are not supported and may generate"
51 # Library version info. Update LT_CURRENT, LT_REVISION and LT_AGE when making a
52 # public release by following the guidelines in the libtool document:
53 # https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
55 # c=<current>, r=<revision>, a=<age>
57 # libtool generates a .so file as .so.[c-a].a.r, while -version-info c:r:a is
60 # We set SO_FILE_VERSION = [c-a].a.r
64 math(EXPR SO_VERSION "${LT_CURRENT} - ${LT_AGE}")
65 set(SO_FILE_VERSION "${SO_VERSION}.${LT_AGE}.${LT_REVISION}")
70 # Enable generators like Xcode and Visual Studio to place projects in folders.
71 set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
73 include("${AOM_ROOT}/build/cmake/aom_configure.cmake")
75 include("${AOM_ROOT}/common/ivf_dec.cmake")
77 include("${AOM_ROOT}/aom_dsp/aom_dsp.cmake")
78 include("${AOM_ROOT}/aom_mem/aom_mem.cmake")
79 include("${AOM_ROOT}/aom_ports/aom_ports.cmake")
80 include("${AOM_ROOT}/aom_scale/aom_scale.cmake")
81 include("${AOM_ROOT}/aom_util/aom_util.cmake")
82 include("${AOM_ROOT}/av1/av1.cmake")
83 include("${AOM_ROOT}/build/cmake/aom_install.cmake")
84 include("${AOM_ROOT}/build/cmake/sanitizers.cmake")
85 include("${AOM_ROOT}/build/cmake/util.cmake")
86 include("${AOM_ROOT}/test/test.cmake")
88 list(APPEND AOM_RTCD_SOURCES
89 "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h"
90 "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h"
91 "${AOM_CONFIG_DIR}/config/av1_rtcd.h"
92 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl"
93 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c"
94 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl"
95 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c"
96 "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl"
97 "${AOM_ROOT}/av1/common/av1_rtcd.c"
98 "${AOM_ROOT}/build/cmake/rtcd.pl")
100 list(APPEND AOM_LIBWEBM_SOURCES
101 "${AOM_ROOT}/third_party/libwebm/common/hdr_util.cc"
102 "${AOM_ROOT}/third_party/libwebm/common/hdr_util.h"
103 "${AOM_ROOT}/third_party/libwebm/common/webmids.h"
104 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.cc"
105 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.h"
106 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxertypes.h"
107 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.cc"
108 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.h"
109 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.cc"
110 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.h"
111 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.cc"
112 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.h"
113 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.cc"
114 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.h")
116 list(APPEND AOM_LIBYUV_SOURCES
117 "${AOM_ROOT}/third_party/libyuv/include/libyuv/basic_types.h"
118 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert.h"
119 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_argb.h"
120 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_from.h"
121 "${AOM_ROOT}/third_party/libyuv/include/libyuv/cpu_id.h"
122 "${AOM_ROOT}/third_party/libyuv/include/libyuv/planar_functions.h"
123 "${AOM_ROOT}/third_party/libyuv/include/libyuv/rotate.h"
124 "${AOM_ROOT}/third_party/libyuv/include/libyuv/row.h"
125 "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale.h"
126 "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale_row.h"
127 "${AOM_ROOT}/third_party/libyuv/source/convert_argb.cc"
128 "${AOM_ROOT}/third_party/libyuv/source/cpu_id.cc"
129 "${AOM_ROOT}/third_party/libyuv/source/planar_functions.cc"
130 "${AOM_ROOT}/third_party/libyuv/source/row_any.cc"
131 "${AOM_ROOT}/third_party/libyuv/source/row_common.cc"
132 "${AOM_ROOT}/third_party/libyuv/source/row_gcc.cc"
133 "${AOM_ROOT}/third_party/libyuv/source/row_mips.cc"
134 "${AOM_ROOT}/third_party/libyuv/source/row_neon.cc"
135 "${AOM_ROOT}/third_party/libyuv/source/row_neon64.cc"
136 "${AOM_ROOT}/third_party/libyuv/source/row_win.cc"
137 "${AOM_ROOT}/third_party/libyuv/source/scale.cc"
138 "${AOM_ROOT}/third_party/libyuv/source/scale_any.cc"
139 "${AOM_ROOT}/third_party/libyuv/source/scale_common.cc"
140 "${AOM_ROOT}/third_party/libyuv/source/scale_gcc.cc"
141 "${AOM_ROOT}/third_party/libyuv/source/scale_mips.cc"
142 "${AOM_ROOT}/third_party/libyuv/source/scale_neon.cc"
143 "${AOM_ROOT}/third_party/libyuv/source/scale_neon64.cc"
144 "${AOM_ROOT}/third_party/libyuv/source/scale_win.cc"
145 "${AOM_ROOT}/third_party/libyuv/source/scale_uv.cc")
147 list(APPEND AOM_SOURCES
148 "${AOM_CONFIG_DIR}/config/aom_config.c"
149 "${AOM_CONFIG_DIR}/config/aom_config.h"
150 "${AOM_ROOT}/aom/aom.h"
151 "${AOM_ROOT}/aom/aom_codec.h"
152 "${AOM_ROOT}/aom/aom_decoder.h"
153 "${AOM_ROOT}/aom/aom_encoder.h"
154 "${AOM_ROOT}/aom/aom_external_partition.h"
155 "${AOM_ROOT}/aom/aom_frame_buffer.h"
156 "${AOM_ROOT}/aom/aom_image.h"
157 "${AOM_ROOT}/aom/aom_integer.h"
158 "${AOM_ROOT}/aom/aomcx.h"
159 "${AOM_ROOT}/aom/aomdx.h"
160 "${AOM_ROOT}/aom/internal/aom_codec_internal.h"
161 "${AOM_ROOT}/aom/internal/aom_image_internal.h"
162 "${AOM_ROOT}/aom/src/aom_codec.c"
163 "${AOM_ROOT}/aom/src/aom_decoder.c"
164 "${AOM_ROOT}/aom/src/aom_encoder.c"
165 "${AOM_ROOT}/aom/src/aom_image.c"
166 "${AOM_ROOT}/aom/src/aom_integer.c")
168 list(APPEND AOM_COMMON_APP_UTIL_SOURCES
169 "${AOM_ROOT}/av1/arg_defs.c"
170 "${AOM_ROOT}/av1/arg_defs.h"
171 "${AOM_ROOT}/common/args_helper.c"
172 "${AOM_ROOT}/common/args_helper.h"
173 "${AOM_ROOT}/common/args.c"
174 "${AOM_ROOT}/common/args.h"
175 "${AOM_ROOT}/common/av1_config.c"
176 "${AOM_ROOT}/common/av1_config.h"
177 "${AOM_ROOT}/common/md5_utils.c"
178 "${AOM_ROOT}/common/md5_utils.h"
179 "${AOM_ROOT}/common/tools_common.c"
180 "${AOM_ROOT}/common/tools_common.h"
181 "${AOM_ROOT}/common/video_common.h"
182 "${AOM_ROOT}/common/rawenc.c"
183 "${AOM_ROOT}/common/rawenc.h"
184 "${AOM_ROOT}/common/y4menc.c"
185 "${AOM_ROOT}/common/y4menc.h"
186 "${AOM_ROOT}/common/ivfdec.c"
187 "${AOM_ROOT}/common/ivfdec.h")
189 list(APPEND AOM_DECODER_APP_UTIL_SOURCES "${AOM_ROOT}/common/obudec.c"
190 "${AOM_ROOT}/common/obudec.h" "${AOM_ROOT}/common/video_reader.c"
191 "${AOM_ROOT}/common/video_reader.h")
193 list(APPEND AOM_ENCODER_APP_UTIL_SOURCES
194 "${AOM_ROOT}/common/ivfenc.c"
195 "${AOM_ROOT}/common/ivfenc.h"
196 "${AOM_ROOT}/common/video_writer.c"
197 "${AOM_ROOT}/common/video_writer.h"
198 "${AOM_ROOT}/common/warnings.c"
199 "${AOM_ROOT}/common/warnings.h"
200 "${AOM_ROOT}/common/y4minput.c"
201 "${AOM_ROOT}/common/y4minput.h"
202 "${AOM_ROOT}/examples/encoder_util.h"
203 "${AOM_ROOT}/examples/encoder_util.c")
205 list(APPEND AOM_ENCODER_STATS_SOURCES "${AOM_ROOT}/stats/aomstats.c"
206 "${AOM_ROOT}/stats/aomstats.h" "${AOM_ROOT}/stats/rate_hist.c"
207 "${AOM_ROOT}/stats/rate_hist.h")
209 list(APPEND AOM_VERSION_SOURCES "${AOM_CONFIG_DIR}/config/aom_version.h")
211 list(APPEND AOM_WEBM_DECODER_SOURCES "${AOM_ROOT}/common/webmdec.cc"
212 "${AOM_ROOT}/common/webmdec.h")
214 list(APPEND AOM_WEBM_ENCODER_SOURCES "${AOM_ROOT}/common/webmenc.cc"
215 "${AOM_ROOT}/common/webmenc.h")
217 include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR} ${AOM_ROOT}/apps
218 ${AOM_ROOT}/common ${AOM_ROOT}/examples ${AOM_ROOT}/stats)
221 add_library(aom_version ${AOM_VERSION_SOURCES})
222 add_no_op_source_file_to_target(aom_version c)
223 add_custom_command(OUTPUT "${AOM_CONFIG_DIR}/config/aom_version.h"
224 COMMAND ${CMAKE_COMMAND} ARGS
225 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
226 -DAOM_ROOT=${AOM_ROOT}
227 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
228 -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P
229 "${AOM_ROOT}/build/cmake/version.cmake"
230 COMMENT "Writing aom_version.h"
233 add_custom_target(aom_version_check
234 COMMAND ${CMAKE_COMMAND}
235 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
236 -DAOM_ROOT=${AOM_ROOT}
237 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
238 -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P
239 "${AOM_ROOT}/build/cmake/version.cmake"
240 COMMENT "Updating version info if necessary."
243 if(BUILD_SHARED_LIBS AND NOT MSVC)
244 # Generate version file immediately for non-MSVC shared builds: The version
245 # string is needed for the aom target.
246 execute_process(COMMAND ${CMAKE_COMMAND}
247 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
248 -DAOM_ROOT=${AOM_ROOT}
249 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
250 -DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P
251 "${AOM_ROOT}/build/cmake/version.cmake")
254 add_dependencies(aom_version aom_version_check)
256 # TODO(tomfinegan): Move rtcd target setup where it belongs for each rtcd
258 add_rtcd_build_step("${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl"
259 "${AOM_CONFIG_DIR}/config/aom_dsp_rtcd.h"
260 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c" "aom_dsp_rtcd")
261 add_rtcd_build_step("${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl"
262 "${AOM_CONFIG_DIR}/config/aom_scale_rtcd.h"
263 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c" "aom_scale_rtcd")
264 add_rtcd_build_step("${AOM_ROOT}/av1/common/av1_rtcd_defs.pl"
265 "${AOM_CONFIG_DIR}/config/av1_rtcd.h"
266 "${AOM_ROOT}/av1/common/av1_rtcd.c" "av1_rtcd")
268 add_library(aom_rtcd OBJECT ${AOM_RTCD_SOURCES})
269 add_dependencies(aom_rtcd aom_version)
272 add_library(aom_encoder_stats OBJECT ${AOM_ENCODER_STATS_SOURCES})
273 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_encoder_stats)
276 # Xcode generator cannot take a library composed solely of objects. See
277 # https://gitlab.kitware.com/cmake/cmake/-/issues/17500
279 set(target_objs_aom ${AOM_SOURCES})
281 add_library(aom_obj OBJECT ${AOM_SOURCES})
282 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_obj)
283 set(target_objs_aom $<TARGET_OBJECTS:aom_obj>)
285 add_library(aom ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>)
287 if(BUILD_SHARED_LIBS)
288 add_library(aom_static STATIC ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>)
289 set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom)
290 if(MSVC OR (WIN32 AND NOT MINGW))
291 # Fix race condition between the import library and the static library.
292 # Affects MSVC in all three flavors (stock, clang-cl, LLVM -- the latter
293 # sets MSVC and MINGW both to FALSE).
294 set_target_properties(aom PROPERTIES ARCHIVE_OUTPUT_NAME "aom_dll")
298 # Extract version string and set VERSION/SOVERSION for the aom target.
299 extract_version_string("${AOM_CONFIG_DIR}/config/aom_version.h"
302 # Strip any trailing version information, if present.
303 string(FIND "${aom_version_triple}" "-" dash_pos)
304 if(NOT dash_pos EQUAL -1)
305 string(SUBSTRING "${aom_version_triple}" 0 ${dash_pos} aom_version_triple)
309 # VERSION is embedded in the .so file name.
310 # libaom.so -> libaom.so.SOVERSION
311 # libaom.so.SOVERSION -> libaom.so.VERSION
314 set_target_properties(aom PROPERTIES SOVERSION ${SO_VERSION})
315 set_target_properties(aom PROPERTIES VERSION ${SO_FILE_VERSION})
319 if(NOT WIN32 AND NOT APPLE)
320 target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m)
321 if(BUILD_SHARED_LIBS)
322 target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} m)
326 if(CONFIG_AV1_ENCODER AND NOT BUILD_SHARED_LIBS)
327 list(APPEND AOM_AV1_RC_SOURCES "${AOM_ROOT}/av1/ratectrl_rtc.h"
328 "${AOM_ROOT}/av1/ratectrl_rtc.cc")
329 add_library(aom_av1_rc ${AOM_AV1_RC_SOURCES})
330 target_link_libraries(aom_av1_rc ${AOM_LIB_LINK_TYPE} aom)
331 if(NOT WIN32 AND NOT APPLE)
332 target_link_libraries(aom_av1_rc ${AOM_LIB_LINK_TYPE} m)
334 set_target_properties(aom_av1_rc PROPERTIES LINKER_LANGUAGE CXX)
337 # List of object and static library targets.
338 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_rtcd aom_mem aom_scale aom)
339 if(CONFIG_AV1_ENCODER AND NOT BUILD_SHARED_LIBS)
340 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_av1_rc)
342 if(BUILD_SHARED_LIBS)
343 set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static)
346 # Setup dependencies.
347 if(CONFIG_THREE_PASS)
348 setup_ivf_dec_targets()
350 setup_aom_dsp_targets()
351 setup_aom_mem_targets()
352 setup_aom_ports_targets()
353 setup_aom_util_targets()
354 setup_aom_scale_targets()
357 # Make all library targets depend on aom_rtcd to make sure it builds first.
358 foreach(aom_lib ${AOM_LIB_TARGETS})
359 if(NOT "${aom_lib}" STREQUAL "aom_rtcd")
360 add_dependencies(${aom_lib} aom_rtcd)
364 # Generate a C file containing the function usage_exit(). Users of the
365 # aom_common_app_util library must define this function. This is a convenience
366 # to allow omission of the function from applications that might want to use
367 # other pieces of the util support without defining usage_exit().
368 file(WRITE "${AOM_GEN_SRC_DIR}/usage_exit.c"
369 "#include <stdlib.h>\n\n#include \"common/tools_common.h\"\n\n"
370 "void usage_exit(void) { exit(EXIT_FAILURE); }\n")
373 # Application and application support targets.
375 if(ENABLE_EXAMPLES OR ENABLE_TESTS OR ENABLE_TOOLS)
376 add_library(aom_common_app_util OBJECT ${AOM_COMMON_APP_UTIL_SOURCES})
377 set_property(TARGET ${example} PROPERTY FOLDER examples)
378 if(CONFIG_AV1_DECODER)
379 add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
380 set_property(TARGET ${example} PROPERTY FOLDER examples)
381 # obudec depends on internal headers that require *rtcd.h
382 add_dependencies(aom_decoder_app_util aom_rtcd)
384 if(CONFIG_AV1_ENCODER)
385 add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
386 set_property(TARGET ${example} PROPERTY FOLDER examples)
390 if(CONFIG_AV1_DECODER AND ENABLE_EXAMPLES)
391 add_executable(aomdec "${AOM_ROOT}/apps/aomdec.c"
392 $<TARGET_OBJECTS:aom_common_app_util>
393 $<TARGET_OBJECTS:aom_decoder_app_util>)
394 add_executable(decode_to_md5 "${AOM_ROOT}/examples/decode_to_md5.c"
395 $<TARGET_OBJECTS:aom_common_app_util>
396 $<TARGET_OBJECTS:aom_decoder_app_util>)
397 add_executable(decode_with_drops "${AOM_ROOT}/examples/decode_with_drops.c"
398 $<TARGET_OBJECTS:aom_common_app_util>
399 $<TARGET_OBJECTS:aom_decoder_app_util>)
400 add_executable(simple_decoder "${AOM_ROOT}/examples/simple_decoder.c"
401 $<TARGET_OBJECTS:aom_common_app_util>
402 $<TARGET_OBJECTS:aom_decoder_app_util>)
403 add_executable(scalable_decoder "${AOM_ROOT}/examples/scalable_decoder.c"
404 $<TARGET_OBJECTS:aom_common_app_util>
405 $<TARGET_OBJECTS:aom_decoder_app_util>)
408 add_executable(analyzer "${AOM_ROOT}/examples/analyzer.cc"
409 $<TARGET_OBJECTS:aom_common_app_util>
410 $<TARGET_OBJECTS:aom_decoder_app_util>)
411 target_link_libraries(analyzer ${AOM_LIB_LINK_TYPE} ${wxWidgets_LIBRARIES})
412 list(APPEND AOM_APP_TARGETS analyzer)
413 list(APPEND AOM_DECODER_EXAMPLE_TARGETS analyzer)
416 if(CONFIG_INSPECTION)
417 add_executable(inspect "${AOM_ROOT}/examples/inspect.c"
418 $<TARGET_OBJECTS:aom_common_app_util>
419 $<TARGET_OBJECTS:aom_decoder_app_util>)
420 list(APPEND AOM_DECODER_EXAMPLE_TARGETS inspect)
423 add_preproc_definition(_POSIX_SOURCE)
424 append_link_flag_to_target("inspect" "--emrun")
425 append_link_flag_to_target("inspect" "-s USE_PTHREADS=0")
426 append_link_flag_to_target("inspect" "-s WASM=1")
427 append_link_flag_to_target("inspect" "-s MODULARIZE=1")
428 append_link_flag_to_target("inspect" "-s ALLOW_MEMORY_GROWTH=1")
429 append_link_flag_to_target(
430 "inspect" "-s \'EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF8ToString\"]\'")
431 append_link_flag_to_target("inspect"
432 "-s EXPORT_NAME=\"\'DecoderModule\'\"")
433 append_link_flag_to_target("inspect" "--memory-init-file 0")
435 if("${CMAKE_BUILD_TYPE}" STREQUAL "")
437 # Default to -O3 when no build type is specified.
438 append_compiler_flag("-O3")
441 em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
445 # Maintain a list of decoder example targets.
446 list(APPEND AOM_DECODER_EXAMPLE_TARGETS aomdec decode_to_md5 decode_with_drops
447 scalable_decoder simple_decoder)
449 # Add decoder examples to the app targets list.
450 list(APPEND AOM_APP_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS})
453 if(CONFIG_LIBYUV OR CONFIG_TUNE_BUTTERAUGLI)
454 add_library(yuv OBJECT ${AOM_LIBYUV_SOURCES})
456 target_compile_options(yuv PRIVATE -Wno-shadow)
458 include_directories("${AOM_ROOT}/third_party/libyuv/include")
461 if(CONFIG_AV1_ENCODER)
463 add_executable(aomenc "${AOM_ROOT}/apps/aomenc.c"
464 $<TARGET_OBJECTS:aom_common_app_util>
465 $<TARGET_OBJECTS:aom_encoder_app_util>
466 $<TARGET_OBJECTS:aom_encoder_stats>)
467 add_executable(lossless_encoder "${AOM_ROOT}/examples/lossless_encoder.c"
468 $<TARGET_OBJECTS:aom_common_app_util>
469 $<TARGET_OBJECTS:aom_encoder_app_util>)
470 add_executable(set_maps "${AOM_ROOT}/examples/set_maps.c"
471 $<TARGET_OBJECTS:aom_common_app_util>
472 $<TARGET_OBJECTS:aom_encoder_app_util>)
473 add_executable(simple_encoder "${AOM_ROOT}/examples/simple_encoder.c"
474 $<TARGET_OBJECTS:aom_common_app_util>
475 $<TARGET_OBJECTS:aom_encoder_app_util>)
476 add_executable(twopass_encoder "${AOM_ROOT}/examples/twopass_encoder.c"
477 $<TARGET_OBJECTS:aom_common_app_util>
478 $<TARGET_OBJECTS:aom_encoder_app_util>)
479 add_executable(noise_model "${AOM_ROOT}/examples/noise_model.c"
480 $<TARGET_OBJECTS:aom_common_app_util>
481 $<TARGET_OBJECTS:aom_encoder_app_util>)
482 add_executable(photon_noise_table
483 "${AOM_ROOT}/examples/photon_noise_table.c"
484 $<TARGET_OBJECTS:aom_common_app_util>
485 $<TARGET_OBJECTS:aom_encoder_app_util>)
486 add_executable(scalable_encoder "${AOM_ROOT}/examples/scalable_encoder.c"
487 $<TARGET_OBJECTS:aom_common_app_util>
488 $<TARGET_OBJECTS:aom_encoder_app_util>)
490 # Maintain a list of encoder example targets.
491 list(APPEND AOM_ENCODER_EXAMPLE_TARGETS aomenc lossless_encoder noise_model
492 photon_noise_table set_maps simple_encoder scalable_encoder
495 if(NOT BUILD_SHARED_LIBS)
496 add_executable(svc_encoder_rtc "${AOM_ROOT}/examples/svc_encoder_rtc.cc"
497 $<TARGET_OBJECTS:aom_common_app_util>
498 $<TARGET_OBJECTS:aom_encoder_app_util>)
499 target_link_libraries(svc_encoder_rtc ${AOM_LIB_LINK_TYPE} aom_av1_rc)
500 list(APPEND AOM_ENCODER_EXAMPLE_TARGETS svc_encoder_rtc)
505 if(CONFIG_ENTROPY_STATS AND NOT BUILD_SHARED_LIBS)
507 # TODO(tomfinegan): Sort out why a simple link command with
508 # aom_entropy_optimizer.c won't work on macos, but dragging in all the
509 # helper machinery allows the link to succeed.
510 add_executable(aom_entropy_optimizer
511 "${AOM_GEN_SRC_DIR}/usage_exit.c"
512 "${AOM_ROOT}/tools/aom_entropy_optimizer.c"
513 $<TARGET_OBJECTS:aom_common_app_util>
514 $<TARGET_OBJECTS:aom_encoder_app_util>)
516 # Maintain a list of encoder tool targets.
517 list(APPEND AOM_ENCODER_TOOL_TARGETS aom_entropy_optimizer)
521 # Add encoder examples and tools to the targets list.
522 list(APPEND AOM_APP_TARGETS ${AOM_ENCODER_EXAMPLE_TARGETS}
523 ${AOM_ENCODER_TOOL_TARGETS})
525 if(CONFIG_TUNE_BUTTERAUGLI)
526 find_package(PkgConfig)
527 # Use find_library() with STATIC_LINK_JXL for static build since
528 # pkg_check_modules() with LIBJXL_STATIC is not working.
529 if(STATIC_LINK_JXL OR NOT PKG_CONFIG_FOUND)
530 find_library(LIBJXL_LIBRARIES libjxl.a)
531 find_library(LIBHWY_LIBRARIES libhwy.a)
532 find_library(LIBSKCMS_LIBRARIES libskcms.a)
533 find_library(LIBBROTLICOMMON_LIBRARIES libbrotlicommon-static.a)
534 find_library(LIBBROTLIENC_LIBRARIES libbrotlienc-static.a)
535 find_library(LIBBROTLIDEC_LIBRARIES libbrotlidec-static.a)
536 find_path(LIBJXL_INCLUDE_DIRS butteraugli.h PATH_SUFFIXES jxl)
539 AND LIBSKCMS_LIBRARIES
540 AND LIBBROTLICOMMON_LIBRARIES
541 AND LIBBROTLIENC_LIBRARIES
542 AND LIBBROTLIDEC_LIBRARIES
543 AND LIBJXL_INCLUDE_DIRS)
544 message(STATUS "Found JXL library: ${LIBJXL_LIBRARIES} "
545 "${LIBHWY_LIBRARIES} ${LIBSKCMS_LIBRARIES} "
546 "${LIBBROTLICOMMON_LIBRARIES} ${LIBBROTLIENC_LIBRARIES}"
547 "${LIBBROTLIDEC_LIBRARIES}")
548 message(STATUS "Found JXL include: ${LIBJXL_INCLUDE_DIRS}")
550 message(FATAL_ERROR "JXL library not found.")
552 target_link_libraries(aom
553 PRIVATE ${LIBJXL_LIBRARIES} ${LIBHWY_LIBRARIES}
554 ${LIBSKCMS_LIBRARIES}
555 ${LIBBROTLIENC_LIBRARIES}
556 ${LIBBROTLIDEC_LIBRARIES}
557 ${LIBBROTLICOMMON_LIBRARIES})
558 target_include_directories(aom_dsp_encoder PRIVATE ${LIBJXL_INCLUDE_DIRS})
560 pkg_check_modules(LIBJXL REQUIRED libjxl)
561 target_link_libraries(aom PRIVATE ${LIBJXL_LDFLAGS} ${LIBJXL_LIBRARIES})
562 target_include_directories(aom_dsp_encoder PRIVATE ${LIBJXL_INCLUDE_DIRS})
564 append_compiler_flag("${LIBJXL_CFLAGS}")
566 pkg_check_modules(LIBHWY REQUIRED libhwy)
567 target_link_libraries(aom PRIVATE ${LIBHWY_LDFLAGS} ${LIBHWY_LIBRARIES})
568 target_include_directories(aom_dsp_encoder
569 PRIVATE ${LIBLIBHWY_INCLUDE_DIRS})
571 append_compiler_flag("${LIBHWY_CFLAGS}")
575 set_target_properties(aom PROPERTIES LINKER_LANGUAGE CXX)
576 if(BUILD_SHARED_LIBS)
577 set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX)
580 list(APPEND AOM_LIB_TARGETS yuv)
581 target_sources(aom PRIVATE $<TARGET_OBJECTS:yuv>)
582 if(BUILD_SHARED_LIBS)
583 target_sources(aom_static PRIVATE $<TARGET_OBJECTS:yuv>)
588 include(FetchContent)
590 set(TFLITE_TAG "v2.6.1")
592 message(STATUS "Fetching TFLite ${TFLITE_TAG}...")
594 # static linking makes life with TFLite much easier
595 set(TFLITE_C_BUILD_SHARED_LIBS OFF)
597 # We don't care about comparing against these delegates (yet), and disabling
598 # it reduces compile time meaningfully
599 set(TFLITE_ENABLE_RUY OFF)
600 set(TFLITE_ENABLE_XNNPACK OFF)
602 fetchcontent_declare(tflite
603 GIT_REPOSITORY https://github.com/tensorflow/tensorflow
604 GIT_TAG ${TFLITE_TAG}
607 fetchcontent_getproperties(tflite)
608 if(NOT tflite_POPULATED)
609 fetchcontent_populate(tflite)
610 # Some of the subprojects (e.g. Eigen) are very noisy and emit status
611 # messages all the time. Temporary ignore status messages while adding
612 # this to silence it. Ugly but effective.
613 set(OLD_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL})
614 set(CMAKE_MESSAGE_LOG_LEVEL WARNING)
615 add_subdirectory(${tflite_SOURCE_DIR}/tensorflow/lite/c
616 ${tflite_BINARY_DIR})
617 set(CMAKE_MESSAGE_LOG_LEVEL ${OLD_CMAKE_MESSAGE_LOG_LEVEL})
620 # Disable some noisy warnings in tflite
621 target_compile_options(tensorflow-lite PRIVATE -w)
623 # tensorflowlite_c is implicitly declared by this FetchContent
624 include_directories(${tflite_SOURCE_DIR})
625 target_link_libraries(aom PRIVATE tensorflow-lite)
629 find_package(PkgConfig)
631 pkg_check_modules(VMAF REQUIRED libvmaf)
632 if(BUILD_SHARED_LIBS)
633 target_link_libraries(aom_static
634 PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES})
636 target_link_libraries(aom PRIVATE ${VMAF_LDFLAGS} ${VMAF_LIBRARIES})
637 target_include_directories(aom_dsp_encoder PRIVATE ${VMAF_INCLUDE_DIRS})
639 foreach(flag "${VMAF_CFLAGS}")
640 append_compiler_flag("${flag}")
644 message(FATAL_ERROR "CONFIG_TUNE_VMAF error: pkg-config not found.")
646 set_target_properties(aom PROPERTIES LINKER_LANGUAGE CXX)
647 if(BUILD_SHARED_LIBS)
648 set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX)
655 # Maintain a separate variable listing only the examples to facilitate
656 # installation of example programs into an examples sub directory of
657 # $AOM_DIST_DIR/bin when building the dist target.
658 list(APPEND AOM_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS}
659 ${AOM_ENCODER_EXAMPLE_TARGETS})
663 if(CONFIG_AV1_DECODER)
664 add_executable(dump_obu "${AOM_GEN_SRC_DIR}/usage_exit.c"
665 "${AOM_ROOT}/tools/dump_obu.cc"
666 "${AOM_ROOT}/tools/obu_parser.cc"
667 "${AOM_ROOT}/tools/obu_parser.h"
668 $<TARGET_OBJECTS:aom_common_app_util>
669 $<TARGET_OBJECTS:aom_decoder_app_util>)
671 list(APPEND AOM_TOOL_TARGETS dump_obu)
672 list(APPEND AOM_APP_TARGETS dump_obu)
674 # Maintain a separate variable listing only the examples to facilitate
675 # installation of example programs into an tools sub directory of
676 # $AOM_DIST_DIR/bin when building the dist target.
677 list(APPEND AOM_TOOL_TARGETS ${AOM_DECODER_TOOL_TARGETS}
678 ${AOM_ENCODER_TOOL_TARGETS})
682 if(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
683 add_executable(aom_cx_set_ref "${AOM_ROOT}/examples/aom_cx_set_ref.c"
684 $<TARGET_OBJECTS:aom_common_app_util>
685 $<TARGET_OBJECTS:aom_encoder_app_util>)
686 list(APPEND AOM_EXAMPLE_TARGETS aom_cx_set_ref)
687 list(APPEND AOM_APP_TARGETS aom_cx_set_ref)
690 if(ENABLE_EXAMPLES AND CONFIG_AV1_ENCODER)
691 add_executable(lightfield_encoder "${AOM_ROOT}/examples/lightfield_encoder.c"
692 $<TARGET_OBJECTS:aom_common_app_util>
693 $<TARGET_OBJECTS:aom_encoder_app_util>)
694 list(APPEND AOM_EXAMPLE_TARGETS lightfield_encoder)
695 list(APPEND AOM_APP_TARGETS lightfield_encoder)
698 if(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER)
699 add_executable(lightfield_tile_list_decoder
700 "${AOM_ROOT}/examples/lightfield_tile_list_decoder.c"
701 $<TARGET_OBJECTS:aom_common_app_util>
702 $<TARGET_OBJECTS:aom_decoder_app_util>)
703 list(APPEND AOM_EXAMPLE_TARGETS lightfield_tile_list_decoder)
704 list(APPEND AOM_APP_TARGETS lightfield_tile_list_decoder)
707 if(ENABLE_EXAMPLES AND CONFIG_AV1_DECODER)
708 add_executable(lightfield_decoder "${AOM_ROOT}/examples/lightfield_decoder.c"
709 $<TARGET_OBJECTS:aom_common_app_util>
710 $<TARGET_OBJECTS:aom_decoder_app_util>)
711 list(APPEND AOM_EXAMPLE_TARGETS lightfield_decoder)
712 list(APPEND AOM_APP_TARGETS lightfield_decoder)
715 if(ENABLE_EXAMPLES AND CONFIG_AV1_ENCODER AND CONFIG_AV1_DECODER)
716 add_executable(lightfield_bitstream_parsing
717 "${AOM_ROOT}/examples/lightfield_bitstream_parsing.c"
718 $<TARGET_OBJECTS:aom_common_app_util>
719 $<TARGET_OBJECTS:aom_encoder_app_util>
720 $<TARGET_OBJECTS:aom_decoder_app_util>)
721 list(APPEND AOM_EXAMPLE_TARGETS lightfield_bitstream_parsing)
722 list(APPEND AOM_APP_TARGETS lightfield_bitstream_parsing)
725 foreach(aom_app ${AOM_APP_TARGETS})
726 target_link_libraries(${aom_app} ${AOM_LIB_LINK_TYPE} aom)
729 if(ENABLE_EXAMPLES OR ENABLE_TESTS OR ENABLE_TOOLS)
731 # Add to existing targets.
732 foreach(aom_app ${AOM_APP_TARGETS})
733 target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:yuv>)
734 set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX)
739 add_library(webm OBJECT ${AOM_LIBWEBM_SOURCES})
740 include_directories("${AOM_ROOT}/third_party/libwebm")
741 target_compile_definitions(webm PRIVATE __STDC_CONSTANT_MACROS)
742 target_compile_definitions(webm PRIVATE __STDC_LIMIT_MACROS)
745 target_compile_options(webm PRIVATE -Wno-shadow)
748 # Add to existing targets.
749 if(CONFIG_AV1_DECODER)
750 target_sources(aom_decoder_app_util PRIVATE ${AOM_WEBM_DECODER_SOURCES})
753 if(CONFIG_AV1_ENCODER)
754 target_sources(aom_encoder_app_util PRIVATE ${AOM_WEBM_ENCODER_SOURCES})
757 foreach(aom_app ${AOM_APP_TARGETS})
758 target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:webm>)
759 set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX)
766 # Create test_libaom target and the targets it depends on.
767 setup_aom_test_targets()
770 if(HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
771 find_package(Threads)
772 target_link_libraries(aom ${AOM_LIB_LINK_TYPE} Threads::Threads)
773 if(BUILD_SHARED_LIBS)
774 target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} Threads::Threads)
780 # TODO(tomfinegan): Make sure target has no C++ files before doing this as
781 # it's not necessary in that case.
782 if(CONFIG_LIBYUV OR CONFIG_WEBM_IO)
784 # The Xcode generator does not obey LINKER_LANGUAGE. Because of the issue
785 # what looks like a C++ file needs to be in any target that Xcode will link
786 # when the target contains a C++ dependency. Without this Xcode will try to
787 # link with the C linker, which always ends badly when a dependency actually
790 # Note: LINKER_LANGUAGE is explicitly set to C++ for all targets touched
791 # here, it really is the Xcode generator's fault, or just a deficiency in
793 foreach(aom_app ${AOM_APP_TARGETS})
794 add_no_op_source_file_to_target("${aom_app}" "cc")
799 if(ENABLE_EXAMPLES AND "${CMAKE_GENERATOR}" MATCHES "Makefiles$")
801 # For historical purposes place the example binaries in the example directory.
802 file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/examples")
804 foreach(target ${AOM_EXAMPLE_TARGETS})
805 if(NOT "${target}" MATCHES "aomdec\|aomenc")
806 set_target_properties(${target}
807 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
808 "${AOM_CONFIG_DIR}/examples")
812 if(ENABLE_TOOLS AND AOM_TOOL_TARGETS)
814 # The same expectation is true for tool targets.
815 file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/tools")
816 set_target_properties(${AOM_TOOL_TARGETS}
817 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
818 "${AOM_CONFIG_DIR}/tools")
822 if(BUILD_SHARED_LIBS)
823 # Don't use -Wl,-z,defs with Clang's sanitizers.
825 # Clang's AddressSanitizer documentation says "When linking shared libraries,
826 # the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link
827 # errors (don't use it with AddressSanitizer)." See
828 # https://clang.llvm.org/docs/AddressSanitizer.html#usage.
831 AND NOT (CMAKE_C_COMPILER_ID MATCHES "Clang" AND SANITIZE))
832 # The -z defs linker option reports unresolved symbol references from object
833 # files when building a shared library.
834 if("${CMAKE_VERSION}" VERSION_LESS "3.13")
835 # target_link_options() is not available before CMake 3.13.
836 target_link_libraries(aom PRIVATE -Wl,-z,defs)
838 target_link_options(aom PRIVATE LINKER:-z,defs)
842 include("${AOM_ROOT}/build/cmake/exports.cmake")
843 setup_exports_target()
846 # Do not allow implicit vector type conversions on Clang builds (this is already
847 # the default on GCC builds).
848 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
849 append_compiler_flag("-flax-vector-conversions=none")
852 # Handle user supplied compile and link flags last to ensure they're obeyed.
855 # Aomedia documentation rule.
856 set(DOXYGEN_VERSION_VALUE 0)
858 find_package(Doxygen)
860 # Check if Doxygen version is >= minimum required version(i.e. 1.8.10).
861 set(MINIMUM_DOXYGEN_VERSION 1008010)
864 # Strip SHA1 from version string if present.
866 REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" DOXYGEN_VERSION
868 # Replace dots with semicolons to create a list.
869 string(REGEX REPLACE "\\." ";" DOXYGEN_VERSION_LIST ${DOXYGEN_VERSION})
870 # Parse version components from the list.
871 list(GET DOXYGEN_VERSION_LIST 0 DOXYGEN_MAJOR)
872 list(GET DOXYGEN_VERSION_LIST 1 DOXYGEN_MINOR)
873 list(GET DOXYGEN_VERSION_LIST 2 DOXYGEN_PATCH)
876 # Construct a version value for comparison.
877 math(EXPR DOXYGEN_MAJOR "${DOXYGEN_MAJOR}*1000000")
878 math(EXPR DOXYGEN_MINOR "${DOXYGEN_MINOR}*1000")
879 math(EXPR DOXYGEN_VERSION_VALUE
880 "${DOXYGEN_MAJOR} + ${DOXYGEN_MINOR} + ${DOXYGEN_PATCH}")
882 if(${DOXYGEN_VERSION_VALUE} LESS ${MINIMUM_DOXYGEN_VERSION})
883 set(DOXYGEN_FOUND NO)
888 include("${AOM_ROOT}/docs.cmake")
889 setup_documentation_targets()
892 "--- Cannot find doxygen(version 1.8.10 or newer), ENABLE_DOCS turned off."
899 if(CONFIG_AV1_DECODER AND ENABLE_EXAMPLES)
900 list(APPEND AOM_DIST_APPS $<TARGET_FILE:aomdec>)
902 if(CONFIG_AV1_ENCODER AND ENABLE_EXAMPLES)
903 list(APPEND AOM_DIST_APPS $<TARGET_FILE:aomenc>)
907 foreach(example ${AOM_EXAMPLE_TARGETS})
908 list(APPEND AOM_DIST_EXAMPLES $<TARGET_FILE:${example}>)
909 set_property(TARGET ${example} PROPERTY FOLDER examples)
914 foreach(tool ${AOM_TOOL_TARGETS})
915 list(APPEND AOM_DIST_TOOLS $<TARGET_FILE:${tool}>)
916 set_property(TARGET ${tool} PROPERTY FOLDER tools)
921 set(AOM_DIST_DIR "${AOM_CONFIG_DIR}/dist")
924 add_custom_target(dist
925 COMMAND ${CMAKE_COMMAND}
926 -DAOM_ROOT=${AOM_ROOT}
927 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
928 -DAOM_DIST_DIR=${AOM_DIST_DIR}
929 -DAOM_DIST_APPS="${AOM_DIST_APPS}"
930 -DAOM_DIST_EXAMPLES="${AOM_DIST_EXAMPLES}"
931 -DAOM_DIST_TOOLS="${AOM_DIST_TOOLS}"
932 -DAOM_DIST_INCLUDES="${AOM_INSTALL_INCS}"
933 -DAOM_DIST_LIBS=$<TARGET_FILE:aom>
934 -DENABLE_DOCS=${ENABLE_DOCS} -P
935 "${AOM_ROOT}/build/cmake/dist.cmake"
936 DEPENDS ${AOM_INSTALL_BINS} ${AOM_INSTALL_LIBS}
937 ${AOM_INSTALL_INCS} ${AOM_EXAMPLE_TARGETS}
941 add_dependencies(dist docs)
944 # Collect all variables containing libaom source files.
945 get_cmake_property(all_cmake_vars VARIABLES)
946 foreach(var ${all_cmake_vars})
947 if("${var}" MATCHES "SOURCES$\|_INTRIN_\|_ASM_"
948 AND NOT "${var}" MATCHES "DOXYGEN\|LIBYUV\|_PKG_\|TEST"
949 AND NOT "${var}" MATCHES "_ASM_NASM\|_ASM_COMPILER")
950 list(APPEND aom_source_vars ${var})
954 if(NOT CONFIG_AV1_DECODER)
955 list(FILTER aom_source_vars EXCLUDE REGEX "_DECODER_")
958 # Libaom_srcs.txt generation.
959 set(libaom_srcs_txt_file "${AOM_CONFIG_DIR}/libaom_srcs.txt")
960 file(WRITE "${libaom_srcs_txt_file}" "# This file is generated. DO NOT EDIT.\n")
962 # Static source file list first.
963 foreach(aom_source_var ${aom_source_vars})
964 foreach(file ${${aom_source_var}})
965 if(NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
966 string(REPLACE "${AOM_ROOT}/" "" file "${file}")
967 if(NOT CONFIG_AV1_DECODER AND "${file}" MATCHES "aom_decoder")
970 file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
975 file(APPEND "${libaom_srcs_txt_file}"
976 "# Files below this line are generated by the libaom build system.\n")
977 foreach(aom_source_var ${aom_source_vars})
978 foreach(file ${${aom_source_var}})
979 if("${file}" MATCHES "${AOM_CONFIG_DIR}")
980 string(REPLACE "${AOM_CONFIG_DIR}/" "" file "${file}")
981 file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
986 # Libaom_srcs.gni generation.
987 set(libaom_srcs_gni_file "${AOM_CONFIG_DIR}/libaom_srcs.gni")
988 file(WRITE "${libaom_srcs_gni_file}" "# This file is generated. DO NOT EDIT.\n")
990 foreach(aom_source_var ${aom_source_vars})
991 if("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
992 string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
993 file(APPEND "${libaom_srcs_gni_file}" "\n${aom_source_var_lowercase} = [\n")
996 foreach(file ${${aom_source_var}})
997 if(NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
998 string(REPLACE "${AOM_ROOT}" "//third_party/libaom/source/libaom" file
1000 if(NOT CONFIG_AV1_DECODER AND "${file}" MATCHES "aom_decoder")
1003 file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
1007 if("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
1008 file(APPEND "${libaom_srcs_gni_file}" "]\n")
1012 file(APPEND "${libaom_srcs_gni_file}"
1013 "\n# Files below this line are generated by the libaom build system.\n")
1015 foreach(aom_source_var ${aom_source_vars})
1016 if("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
1017 string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
1018 file(APPEND "${libaom_srcs_gni_file}"
1019 "\n${aom_source_var_lowercase}_gen = [\n")
1021 foreach(file ${${aom_source_var}})
1022 if(NOT "${file}" MATCHES "${AOM_ROOT}")
1023 string(REPLACE "${AOM_CONFIG_DIR}" "//third_party/libaom/source/libaom"
1025 file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
1029 if("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
1030 file(APPEND "${libaom_srcs_gni_file}" "]\n")
1034 # Generate aom.pc and setup install rule.
1035 setup_aom_install_targets()