blob: 5cf320aa716d97a93176512d5abfc14a8171aba5 [file] [log] [blame]
Tom Fineganfc6f2362016-10-24 10:39:41 -07001##
2## Copyright (c) 2016, Alliance for Open Media. All rights reserved
3##
4## This source code is subject to the terms of the BSD 2 Clause License and
5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6## was not distributed with this source code in the LICENSE file, you can
7## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8## Media Patent License 1.0 was not distributed with this source code in the
9## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10##
Tom Finegan03e80212017-03-02 18:32:52 -080011cmake_minimum_required(VERSION 3.5)
Tom Fineganfc1aac52017-05-03 11:24:37 -070012
13if (NOT EMSCRIPTEN)
James Zerna14f2bb2017-07-06 19:51:57 -070014 if (NOT CMAKE_BUILD_TYPE)
James Zerndb0cc5b2017-08-30 19:40:54 -070015 set(CMAKE_BUILD_TYPE "Release" CACHE
James Zerna14f2bb2017-07-06 19:51:57 -070016 "Build type: Debug, Release, RelWithDebInfo or MinSizeRel" STRING FORCE)
Tom Fineganfc1aac52017-05-03 11:24:37 -070017 endif ()
18endif ()
19
Johann4ceee162017-10-02 12:59:57 -070020option(ENABLE_ADOPTED_EXPERIMENTS "Enable adopted experiments." ON)
Tom Finegana0ff4562017-05-23 08:27:47 -070021option(ENABLE_CCACHE "Enable ccache support." OFF)
22option(ENABLE_DISTCC "Enable distcc support." OFF)
Tom Finegan0d066ce2017-05-30 11:07:05 -070023option(ENABLE_DOCS "Enable documentation generation (doxygen required)." ON)
Tom Finegan9befd172017-09-29 15:19:19 -070024option(ENABLE_EXAMPLES "Enables build of example code." ON)
Tom Fineganf67fd8a2017-08-10 14:57:11 -070025option(ENABLE_GOMA "Enable goma support." OFF)
Tom Finegan375ee842017-06-02 10:34:02 -070026option(ENABLE_IDE_TEST_HOSTING
27 "Enables running tests within IDEs like Visual Studio and Xcode." OFF)
Tom Finegan9befd172017-09-29 15:19:19 -070028option(ENABLE_NASM "Use nasm instead of yasm for x86 assembly." OFF)
29option(ENABLE_TOOLS "Enable applications in tools sub directory." ON)
30option(ENABLE_WERROR "Converts warnings to errors at compile time." OFF)
Tom Finegana0ff4562017-05-23 08:27:47 -070031
Tom Finegane3bae4a2017-10-12 09:06:31 -070032# ARM assembly/intrinsics flags.
33option(ENABLE_NEON "Enables NEON optimizations on ARM targets." ON)
34option(ENABLE_NEON_ASM "Enables NEON ASM optimizations on ARM targets." ON)
35
36# MIPS assembly/intrinsics flags.
37option(ENABLE_DSPR2 "Enables DSPR2 optimizations on MIPS targets." OFF)
38option(ENABLE_MSA "Enables MSA optimizations on MIPS targets." OFF)
39
40# x86/x86_64 assembly/intrinsics flags.
41option(ENABLE_MMX "Enables MMX optimizations on x86/x86_64 targets." ON)
42option(ENABLE_SSE "Enables SSE optimizations on x86/x86_64 targets." ON)
43option(ENABLE_SSE2 "Enables SSE2 optimizations on x86/x86_64 targets." ON)
44option(ENABLE_SSE3 "Enables SSE3 optimizations on x86/x86_64 targets." ON)
45option(ENABLE_SSSE3 "Enables SSSE3 optimizations on x86/x86_64 targets." ON)
46option(ENABLE_SSE4_1 "Enables SSE4_1 optimizations on x86/x86_64 targets." ON)
47option(ENABLE_AVX "Enables AVX optimizations on x86/x86_64 targets." ON)
48option(ENABLE_AVX2 "Enables AVX2 optimizations on x86/x86_64 targets." ON)
49
Tom Finegan84f2d792017-06-15 23:06:44 -070050# $BUILD_SHARED_LIBS is a CMake built-in-- it's listed here for visibility.
51option(BUILD_SHARED_LIBS "CMake should generate a shared library build." OFF)
52
Tom Fineganfc6f2362016-10-24 10:39:41 -070053project(AOM C CXX)
54
55set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
Tom Finegan973d4d52016-10-26 11:42:42 -070056set(AOM_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
Tom Finegan6e9d0c12016-10-27 11:57:06 -070057
Tom Fineganf77394f2017-04-26 11:47:59 -070058if ("${AOM_ROOT}" STREQUAL "${AOM_CONFIG_DIR}")
59 message(FATAL_ERROR
60 "Building from within the aom source tree is not supported.\n"
61 "Hint: mkdir -p ../aom_build && cd ../aom_build\n"
62 "Run cmake from there.")
63endif ()
64
Tom Finegan973d4d52016-10-26 11:42:42 -070065include("${AOM_ROOT}/build/cmake/aom_configure.cmake")
Tom Finegan85ac13e2017-02-22 15:09:20 -080066include("${AOM_ROOT}/aom_dsp/aom_dsp.cmake")
Tom Finegandd6d0572017-03-01 19:01:23 -080067include("${AOM_ROOT}/aom_mem/aom_mem.cmake")
Tom Finegan507e2e12017-03-01 19:58:19 -080068include("${AOM_ROOT}/aom_ports/aom_ports.cmake")
Tom Fineganf0d14442017-03-01 20:42:51 -080069include("${AOM_ROOT}/aom_scale/aom_scale.cmake")
Tom Fineganb7d02542017-03-01 21:14:28 -080070include("${AOM_ROOT}/aom_util/aom_util.cmake")
Tom Finegan44916e72017-02-27 14:12:31 -080071include("${AOM_ROOT}/av1/av1.cmake")
Tom Finegan4db04d32017-02-23 14:37:27 -080072include("${AOM_ROOT}/test/test.cmake")
Tom Finegan8cc239b2017-08-07 12:28:12 -070073include("${AOM_ROOT}/build/cmake/sanitizers.cmake")
Tom Finegan84f2d792017-06-15 23:06:44 -070074include("${AOM_ROOT}/build/cmake/util.cmake")
Tom Finegan85ac13e2017-02-22 15:09:20 -080075
Tom Finegana0c21f02017-02-01 11:11:09 -080076set(AOM_RTCD_SOURCES
77 "${AOM_CONFIG_DIR}/aom_dsp_rtcd.h"
78 "${AOM_CONFIG_DIR}/aom_scale_rtcd.h"
79 "${AOM_CONFIG_DIR}/av1_rtcd.h"
80 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl"
81 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c"
82 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl"
83 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c"
84 "${AOM_ROOT}/av1/common/av1_rtcd_defs.pl"
85 "${AOM_ROOT}/av1/common/av1_rtcd.c"
86 "${AOM_ROOT}/build/make/rtcd.pl")
87
Tom Finegan957fe822016-11-09 10:37:27 -080088# TODO(tomfinegan): Use libwebm's cmake support directly.
Tom Finegan50c5a7e2017-01-31 21:36:56 -080089set(AOM_LIBWEBM_SOURCES
Tom Finegan957fe822016-11-09 10:37:27 -080090 "${AOM_ROOT}/third_party/libwebm/common/hdr_util.cc"
91 "${AOM_ROOT}/third_party/libwebm/common/hdr_util.h"
92 "${AOM_ROOT}/third_party/libwebm/common/webmids.h"
93 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.cc"
94 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxer.h"
95 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxertypes.h"
96 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.cc"
97 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvmuxerutil.h"
98 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.cc"
99 "${AOM_ROOT}/third_party/libwebm/mkvmuxer/mkvwriter.h"
100 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.cc"
101 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvparser.h"
102 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.cc"
103 "${AOM_ROOT}/third_party/libwebm/mkvparser/mkvreader.h")
104
Tom Finegan50c5a7e2017-01-31 21:36:56 -0800105set(AOM_LIBYUV_SOURCES
Tom Finegan9cd97002016-11-09 10:37:44 -0800106 "${AOM_ROOT}/third_party/libyuv/include/libyuv/basic_types.h"
107 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert.h"
108 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_argb.h"
109 "${AOM_ROOT}/third_party/libyuv/include/libyuv/convert_from.h"
110 "${AOM_ROOT}/third_party/libyuv/include/libyuv/cpu_id.h"
111 "${AOM_ROOT}/third_party/libyuv/include/libyuv/planar_functions.h"
112 "${AOM_ROOT}/third_party/libyuv/include/libyuv/rotate.h"
113 "${AOM_ROOT}/third_party/libyuv/include/libyuv/row.h"
114 "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale.h"
115 "${AOM_ROOT}/third_party/libyuv/include/libyuv/scale_row.h"
116 "${AOM_ROOT}/third_party/libyuv/source/cpu_id.cc"
117 "${AOM_ROOT}/third_party/libyuv/source/planar_functions.cc"
118 "${AOM_ROOT}/third_party/libyuv/source/row_any.cc"
119 "${AOM_ROOT}/third_party/libyuv/source/row_common.cc"
120 "${AOM_ROOT}/third_party/libyuv/source/row_gcc.cc"
121 "${AOM_ROOT}/third_party/libyuv/source/row_mips.cc"
122 "${AOM_ROOT}/third_party/libyuv/source/row_neon.cc"
123 "${AOM_ROOT}/third_party/libyuv/source/row_neon64.cc"
124 "${AOM_ROOT}/third_party/libyuv/source/row_win.cc"
125 "${AOM_ROOT}/third_party/libyuv/source/scale.cc"
126 "${AOM_ROOT}/third_party/libyuv/source/scale_any.cc"
127 "${AOM_ROOT}/third_party/libyuv/source/scale_common.cc"
128 "${AOM_ROOT}/third_party/libyuv/source/scale_gcc.cc"
129 "${AOM_ROOT}/third_party/libyuv/source/scale_mips.cc"
130 "${AOM_ROOT}/third_party/libyuv/source/scale_neon.cc"
131 "${AOM_ROOT}/third_party/libyuv/source/scale_neon64.cc"
132 "${AOM_ROOT}/third_party/libyuv/source/scale_win.cc")
133
Tom Finegan50c5a7e2017-01-31 21:36:56 -0800134set(AOM_SOURCES
Tom Finegan973d4d52016-10-26 11:42:42 -0700135 "${AOM_CONFIG_DIR}/aom_config.c"
136 "${AOM_CONFIG_DIR}/aom_config.h"
Tom Fineganfc6f2362016-10-24 10:39:41 -0700137 "${AOM_ROOT}/aom/aom.h"
138 "${AOM_ROOT}/aom/aom_codec.h"
139 "${AOM_ROOT}/aom/aom_decoder.h"
140 "${AOM_ROOT}/aom/aom_encoder.h"
141 "${AOM_ROOT}/aom/aom_frame_buffer.h"
142 "${AOM_ROOT}/aom/aom_image.h"
143 "${AOM_ROOT}/aom/aom_integer.h"
144 "${AOM_ROOT}/aom/aomcx.h"
145 "${AOM_ROOT}/aom/aomdx.h"
146 "${AOM_ROOT}/aom/internal/aom_codec_internal.h"
147 "${AOM_ROOT}/aom/src/aom_codec.c"
148 "${AOM_ROOT}/aom/src/aom_decoder.c"
149 "${AOM_ROOT}/aom/src/aom_encoder.c"
150 "${AOM_ROOT}/aom/src/aom_image.c")
151
Tom Finegan03f6ca72016-11-10 13:02:48 -0800152set(AOM_COMMON_APP_UTIL_SOURCES
Tom Finegana89fe0e2017-01-19 14:38:28 -0800153 "${AOM_ROOT}/args.c"
154 "${AOM_ROOT}/args.h"
Tom Finegan03f6ca72016-11-10 13:02:48 -0800155 "${AOM_ROOT}/md5_utils.c"
156 "${AOM_ROOT}/md5_utils.h"
157 "${AOM_ROOT}/tools_common.c"
158 "${AOM_ROOT}/tools_common.h"
Tom Fineganba02c242017-05-16 15:01:54 -0700159 "${AOM_ROOT}/video_common.h"
160 "${AOM_ROOT}/y4menc.c"
161 "${AOM_ROOT}/y4menc.h")
Tom Finegan03f6ca72016-11-10 13:02:48 -0800162
163set(AOM_DECODER_APP_UTIL_SOURCES
164 "${AOM_ROOT}/ivfdec.c"
165 "${AOM_ROOT}/ivfdec.h"
166 "${AOM_ROOT}/video_reader.c"
Tom Fineganba02c242017-05-16 15:01:54 -0700167 "${AOM_ROOT}/video_reader.h")
Tom Finegan03f6ca72016-11-10 13:02:48 -0800168
169set(AOM_ENCODER_APP_UTIL_SOURCES
170 "${AOM_ROOT}/ivfenc.c"
171 "${AOM_ROOT}/ivfenc.h"
172 "${AOM_ROOT}/video_writer.c"
Tom Finegana89fe0e2017-01-19 14:38:28 -0800173 "${AOM_ROOT}/video_writer.h"
174 "${AOM_ROOT}/warnings.c"
175 "${AOM_ROOT}/warnings.h"
176 "${AOM_ROOT}/y4minput.c"
Urvang Joshi09c293e2017-04-20 17:56:27 -0700177 "${AOM_ROOT}/y4minput.h"
178 "${AOM_ROOT}/examples/encoder_util.h"
179 "${AOM_ROOT}/examples/encoder_util.c")
Tom Finegana89fe0e2017-01-19 14:38:28 -0800180
181set(AOM_ENCODER_STATS_SOURCES
182 "${AOM_ROOT}/aomstats.c"
183 "${AOM_ROOT}/aomstats.h"
184 "${AOM_ROOT}/rate_hist.c"
185 "${AOM_ROOT}/rate_hist.h")
186
Tom Finegan872e5852017-08-29 15:15:58 -0700187set(AOM_PKG_CONFIG_SOURCES "${AOM_CONFIG_DIR}/aom.pc")
188
189set(AOM_VERSION_SOURCES "${AOM_CONFIG_DIR}/aom_version.h")
190
Tom Finegana89fe0e2017-01-19 14:38:28 -0800191set(AOM_WEBM_DECODER_SOURCES
192 "${AOM_ROOT}/webmdec.cc"
193 "${AOM_ROOT}/webmdec.h")
194
195set(AOM_WEBM_ENCODER_SOURCES
196 "${AOM_ROOT}/webmenc.cc"
197 "${AOM_ROOT}/webmenc.h")
198
199include_directories(${AOM_ROOT} ${AOM_CONFIG_DIR})
Tom Finegan03f6ca72016-11-10 13:02:48 -0800200
Tom Fineganfc6f2362016-10-24 10:39:41 -0700201# Targets
Tom Finegan872e5852017-08-29 15:15:58 -0700202add_library(aom_version ${AOM_VERSION_SOURCES})
203add_dummy_source_file_to_target(aom_version c)
204add_custom_command(
205 OUTPUT "${AOM_CONFIG_DIR}/aom_version.h"
206 COMMAND ${CMAKE_COMMAND}
207 ARGS -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
208 -DAOM_ROOT=${AOM_ROOT}
209 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
210 -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
211 -P "${AOM_ROOT}/build/cmake/version.cmake"
212 COMMENT "Writing aom_version.h"
213 VERBATIM)
214
215add_custom_target(aom_version_check
216 COMMAND ${CMAKE_COMMAND}
217 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
218 -DAOM_ROOT=${AOM_ROOT}
219 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
220 -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
221 -P "${AOM_ROOT}/build/cmake/version.cmake"
222 COMMENT "Updating version info if necessary."
223 VERBATIM)
224add_dependencies(aom_version aom_version_check)
225
226if (NOT MSVC)
227 add_library(aom_pc ${AOM_PKG_CONFIG_SOURCES})
228 add_dummy_source_file_to_target(aom_pc c)
229 add_custom_command(
230 OUTPUT "${AOM_CONFIG_DIR}/aom.pc"
231 COMMAND ${CMAKE_COMMAND}
232 ARGS -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
233 -DAOM_ROOT=${AOM_ROOT}
Tom Finegan40b2a972017-09-25 09:45:27 -0700234 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
Tom Finegan872e5852017-08-29 15:15:58 -0700235 -DCMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}
236 -DCONFIG_MULTITHREAD=${CONFIG_MULTITHREAD}
237 -DHAVE_PTHREAD_H=${HAVE_PTHREAD_H}
238 -P "${AOM_ROOT}/build/cmake/pkg_config.cmake"
239 COMMENT "Writing aom.pc"
240 VERBATIM)
Tom Finegan00b4df72017-09-01 11:30:34 -0700241 add_dependencies(aom_pc aom_version)
Tom Finegan872e5852017-08-29 15:15:58 -0700242endif ()
Tom Finegan872e5852017-08-29 15:15:58 -0700243
Tom Fineganf0d14442017-03-01 20:42:51 -0800244# TODO(tomfinegan): Move rtcd target setup where it belongs for each rtcd
245# source.
Tom Finegana0c21f02017-02-01 11:11:09 -0800246add_rtcd_build_step("${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl"
247 "${AOM_CONFIG_DIR}/aom_dsp_rtcd.h"
248 "${AOM_ROOT}/aom_dsp/aom_dsp_rtcd.c"
249 "aom_dsp_rtcd")
250add_rtcd_build_step("${AOM_ROOT}/aom_scale/aom_scale_rtcd.pl"
251 "${AOM_CONFIG_DIR}/aom_scale_rtcd.h"
252 "${AOM_ROOT}/aom_scale/aom_scale_rtcd.c"
253 "aom_scale_rtcd")
254add_rtcd_build_step("${AOM_ROOT}/av1/common/av1_rtcd_defs.pl"
255 "${AOM_CONFIG_DIR}/av1_rtcd.h"
256 "${AOM_ROOT}/av1/common/av1_rtcd.c"
257 "av1_rtcd")
Tom Finegan85ac13e2017-02-22 15:09:20 -0800258
Tom Finegana0c21f02017-02-01 11:11:09 -0800259add_library(aom_rtcd OBJECT ${AOM_RTCD_SOURCES})
Tom Finegan872e5852017-08-29 15:15:58 -0700260add_dependencies(aom_rtcd aom_version)
261
Tom Finegana7ed1432017-02-08 10:34:40 -0800262add_library(aom_encoder_stats OBJECT ${AOM_ENCODER_STATS_SOURCES})
Tom Fineganb7d02542017-03-01 21:14:28 -0800263add_library(aom ${AOM_SOURCES} $<TARGET_OBJECTS:aom_rtcd>)
Tom Finegan03f6ca72016-11-10 13:02:48 -0800264
Tom Finegan3e8986b2017-09-29 17:08:31 -0700265if (NOT MSVC AND NOT APPLE)
266 target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m)
267endif ()
268
Tom Finegana0c21f02017-02-01 11:11:09 -0800269# List of object and static library targets.
Tom Fineganb7d02542017-03-01 21:14:28 -0800270set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_rtcd aom_encoder_stats aom_mem
271 aom_scale aom)
Tom Finegana0c21f02017-02-01 11:11:09 -0800272
Tom Finegan507e2e12017-03-01 19:58:19 -0800273# Setup dependencies.
Tom Finegan85ac13e2017-02-22 15:09:20 -0800274setup_aom_dsp_targets()
Tom Finegandd6d0572017-03-01 19:01:23 -0800275setup_aom_mem_targets()
Tom Finegan507e2e12017-03-01 19:58:19 -0800276setup_aom_ports_targets()
Tom Fineganb7d02542017-03-01 21:14:28 -0800277setup_aom_util_targets()
Tom Fineganf0d14442017-03-01 20:42:51 -0800278setup_aom_scale_targets()
Tom Finegan44916e72017-02-27 14:12:31 -0800279setup_av1_targets()
Tom Finegan85ac13e2017-02-22 15:09:20 -0800280
Tom Finegana0c21f02017-02-01 11:11:09 -0800281# Make all library targets depend on aom_rtcd to make sure it builds first.
282foreach (aom_lib ${AOM_LIB_TARGETS})
283 if (NOT "${aom_lib}" STREQUAL "aom_rtcd")
284 add_dependencies(${aom_lib} aom_rtcd)
285 endif ()
286endforeach ()
Tom Fineganba02c242017-05-16 15:01:54 -0700287
Tom Finegane91bb452017-09-29 11:40:24 -0700288# Generate a stub file containing the C function usage_exit(). Users of the
289# aom_common_app_util library must define this function. This is a convenience
290# to allow omission of the function from applications that might want to use
291# other pieces of the util support without defining the usage_exit().
292file(WRITE "${AOM_CONFIG_DIR}/usage_exit.c" "void usage_exit(void) {}")
Tom Finegan03f6ca72016-11-10 13:02:48 -0800293
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700294#
295# Application and application support targets.
296#
297if (CONFIG_UNIT_TESTS OR ENABLE_EXAMPLES OR ENABLE_TOOLS)
298 add_library(aom_common_app_util OBJECT ${AOM_COMMON_APP_UTIL_SOURCES})
299 if (CONFIG_AV1_DECODER)
300 add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
301 endif ()
302 if (CONFIG_AV1_ENCODER)
303 add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
304 endif ()
305endif ()
306
307if (CONFIG_AV1_DECODER AND ENABLE_EXAMPLES)
Tom Fineganba02c242017-05-16 15:01:54 -0700308 add_executable(aomdec
Tom Finegan84f2d792017-06-15 23:06:44 -0700309 "${AOM_ROOT}/aomdec.c"
310 $<TARGET_OBJECTS:aom_common_app_util>
311 $<TARGET_OBJECTS:aom_decoder_app_util>)
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700312 add_executable(decode_to_md5
313 "${AOM_ROOT}/examples/decode_to_md5.c"
314 $<TARGET_OBJECTS:aom_common_app_util>
315 $<TARGET_OBJECTS:aom_decoder_app_util>)
316 add_executable(decode_with_drops
317 "${AOM_ROOT}/examples/decode_with_drops.c"
318 $<TARGET_OBJECTS:aom_common_app_util>
319 $<TARGET_OBJECTS:aom_decoder_app_util>)
320 add_executable(simple_decoder
321 "${AOM_ROOT}/examples/simple_decoder.c"
322 $<TARGET_OBJECTS:aom_common_app_util>
323 $<TARGET_OBJECTS:aom_decoder_app_util>)
Tom Finegana89fe0e2017-01-19 14:38:28 -0800324
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700325 if (CONFIG_ANALYZER)
326 add_executable(analyzer
327 "${AOM_ROOT}/examples/analyzer.cc"
Tom Finegan9befd172017-09-29 15:19:19 -0700328 $<TARGET_OBJECTS:aom_common_app_util>
329 $<TARGET_OBJECTS:aom_decoder_app_util>)
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700330 target_link_libraries(analyzer
331 ${AOM_LIB_LINK_TYPE} ${wxWidgets_LIBRARIES})
332 set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
333 set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS} analyzer)
Tom Fineganba02c242017-05-16 15:01:54 -0700334 endif ()
335
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700336 if (CONFIG_INSPECTION)
337 add_executable(inspect
338 "${AOM_ROOT}/examples/inspect.c"
339 $<TARGET_OBJECTS:aom_common_app_util>
340 $<TARGET_OBJECTS:aom_decoder_app_util>)
341 set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS} inspect)
342
343 if (EMSCRIPTEN)
344 add_preproc_definition(_POSIX_SOURCE)
345 append_link_flag_to_target("inspect" "-s TOTAL_MEMORY=134217728")
346 append_link_flag_to_target("inspect" "-s MODULARIZE=1")
347 append_link_flag_to_target("inspect"
348 "-s EXPORT_NAME=\"\'DecoderModule\'\"")
349 append_link_flag_to_target("inspect" "--memory-init-file 0")
350
351 if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
352 # Default to -O3 when no build type specified.
353 append_compiler_flag("-O3")
354 endif ()
355
356 em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
357 endif ()
358 endif ()
359
360 # Maintain a list of decoder example targets.
361 set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS}
362 aomdec decode_to_md5 decode_with_drops simple_decoder)
363
Tom Finegan9befd172017-09-29 15:19:19 -0700364 # Add decoder examples to the app targets list.
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700365 set(AOM_APP_TARGETS ${AOM_APP_TARGETS} ${AOM_DECODER_EXAMPLE_TARGETS})
Michael Bebenitaf4f27fe2017-03-02 17:40:44 -0800366endif ()
367
Tom Fineganba02c242017-05-16 15:01:54 -0700368if (CONFIG_AV1_ENCODER)
Tom Finegan9befd172017-09-29 15:19:19 -0700369 if (ENABLE_EXAMPLES)
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700370 add_executable(aomenc
371 "${AOM_ROOT}/aomenc.c"
372 $<TARGET_OBJECTS:aom_common_app_util>
373 $<TARGET_OBJECTS:aom_encoder_app_util>
374 $<TARGET_OBJECTS:aom_encoder_stats>)
Tom Finegan9befd172017-09-29 15:19:19 -0700375 add_executable(lossless_encoder
376 "${AOM_ROOT}/examples/lossless_encoder.c"
Tom Finegane91bb452017-09-29 11:40:24 -0700377 $<TARGET_OBJECTS:aom_common_app_util>
378 $<TARGET_OBJECTS:aom_encoder_app_util>)
Tom Finegan9befd172017-09-29 15:19:19 -0700379 add_executable(set_maps
380 "${AOM_ROOT}/examples/set_maps.c"
381 $<TARGET_OBJECTS:aom_common_app_util>
382 $<TARGET_OBJECTS:aom_encoder_app_util>)
383 add_executable(simple_encoder
384 "${AOM_ROOT}/examples/simple_encoder.c"
385 $<TARGET_OBJECTS:aom_common_app_util>
386 $<TARGET_OBJECTS:aom_encoder_app_util>)
387 add_executable(twopass_encoder
388 "${AOM_ROOT}/examples/twopass_encoder.c"
389 $<TARGET_OBJECTS:aom_common_app_util>
390 $<TARGET_OBJECTS:aom_encoder_app_util>)
391
392 # Maintain a list of encoder example targets.
393 set(AOM_ENCODER_EXAMPLE_TARGETS
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700394 aomenc lossless_encoder set_maps simple_encoder twopass_encoder)
Tom Finegane91bb452017-09-29 11:40:24 -0700395 endif ()
396
Tom Fineganbac99072017-10-11 09:16:54 -0700397 if (ENABLE_TOOLS)
398 if (CONFIG_ENTROPY_STATS AND NOT BUILD_SHARED_LIBS)
399 # TODO(tomfinegan): Sort out why a simple link command with
400 # aom_entropy_optimizer.c won't work on macos, but dragging in all the
401 # helper machinery allows the link to succeed.
402 add_executable(aom_entropy_optimizer
403 "${AOM_CONFIG_DIR}/usage_exit.c"
404 "${AOM_ROOT}/tools/aom_entropy_optimizer.c"
405 $<TARGET_OBJECTS:aom_common_app_util>
406 $<TARGET_OBJECTS:aom_encoder_app_util>)
Tom Finegan9befd172017-09-29 15:19:19 -0700407
Tom Fineganbac99072017-10-11 09:16:54 -0700408 # Maintain a list of encoder tool targets.
409 set(AOM_ENCODER_TOOL_TARGETS
410 ${AOM_ENCODER_TOOL_TARGETS} aom_entropy_optimizer)
411 endif ()
Tom Finegan9befd172017-09-29 15:19:19 -0700412 endif ()
Tom Fineganbac99072017-10-11 09:16:54 -0700413
414 # Add encoder examples and tools to the targets list.
415 set(AOM_APP_TARGETS ${AOM_APP_TARGETS}
416 ${AOM_ENCODER_EXAMPLE_TARGETS} ${AOM_ENCODER_TOOL_TARGETS})
Tom Fineganba02c242017-05-16 15:01:54 -0700417endif ()
418
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700419if (ENABLE_EXAMPLES)
420 # Maintain a separate variable listing only the examples to facilitate
421 # installation of example programs into an examples sub directory of
422 # $AOM_DIST_DIR/bin when building the dist target.
423 set(AOM_EXAMPLE_TARGETS
424 ${AOM_DECODER_EXAMPLE_TARGETS} ${AOM_ENCODER_EXAMPLE_TARGETS})
425endif ()
Tom Finegan78975672017-05-30 08:55:54 -0700426
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700427if (ENABLE_TOOLS)
428 # Maintain a separate variable listing only the examples to facilitate
429 # installation of example programs into an tools sub directory of
430 # $AOM_DIST_DIR/bin when building the dist target.
431 set(AOM_TOOL_TARGETS ${AOM_DECODER_TOOL_TARGETS} ${AOM_ENCODER_TOOL_TARGETS})
432endif ()
Tom Finegane91bb452017-09-29 11:40:24 -0700433
Tom Finegan9befd172017-09-29 15:19:19 -0700434if (ENABLE_EXAMPLES AND CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
Tom Fineganba02c242017-05-16 15:01:54 -0700435 add_executable(aom_cx_set_ref
436 "${AOM_ROOT}/examples/aom_cx_set_ref.c"
437 $<TARGET_OBJECTS:aom_common_app_util>
438 $<TARGET_OBJECTS:aom_encoder_app_util>)
Tom Finegan78975672017-05-30 08:55:54 -0700439 set(AOM_EXAMPLE_TARGETS ${AOM_EXAMPLE_TARGETS} aom_cx_set_ref)
Tom Fineganba02c242017-05-16 15:01:54 -0700440 set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aom_cx_set_ref)
441endif ()
Tom Finegan81279802017-02-01 11:27:05 -0800442
443foreach (aom_app ${AOM_APP_TARGETS})
Tom Finegand46b4d32017-05-09 09:14:03 -0700444 target_link_libraries(${aom_app} ${AOM_LIB_LINK_TYPE} aom)
Tom Finegan81279802017-02-01 11:27:05 -0800445endforeach ()
Tom Fineganfc6f2362016-10-24 10:39:41 -0700446
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700447if (CONFIG_UNIT_TESTS OR ENABLE_EXAMPLES OR ENABLE_TOOLS)
448 if (CONFIG_LIBYUV)
449 add_library(yuv OBJECT ${AOM_LIBYUV_SOURCES})
450 if (NOT MSVC)
451 target_compile_options(yuv PRIVATE -Wno-unused-parameter)
452 endif ()
453 include_directories("${AOM_ROOT}/third_party/libyuv/include")
Tom Finegan9cd97002016-11-09 10:37:44 -0800454
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700455 # Add to existing targets.
456 foreach (aom_app ${AOM_APP_TARGETS})
457 target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:yuv>)
458 set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX)
459 endforeach ()
Tom Finegan87fdc282017-02-10 10:30:28 -0800460 endif ()
Tom Finegan957fe822016-11-09 10:37:27 -0800461
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700462 if (CONFIG_WEBM_IO)
463 add_library(webm OBJECT ${AOM_LIBWEBM_SOURCES})
464 include_directories("${AOM_ROOT}/third_party/libwebm")
465 target_compile_definitions(webm PRIVATE __STDC_CONSTANT_MACROS)
466 target_compile_definitions(webm PRIVATE __STDC_LIMIT_MACROS)
Tom Fineganba02c242017-05-16 15:01:54 -0700467
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700468 if (NOT MSVC)
469 target_compile_options(webm PRIVATE -Wno-shadow)
470 endif ()
Tom Finegan81279802017-02-01 11:27:05 -0800471
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700472 # Add to existing targets.
473 if (CONFIG_AV1_DECODER)
474 target_sources(aom_decoder_app_util PRIVATE ${AOM_WEBM_DECODER_SOURCES})
475 endif ()
476
477 if (CONFIG_AV1_ENCODER)
478 target_sources(aom_encoder_app_util PRIVATE ${AOM_WEBM_ENCODER_SOURCES})
479 endif ()
480
481 foreach (aom_app ${AOM_APP_TARGETS})
482 target_sources(${aom_app} PRIVATE $<TARGET_OBJECTS:webm>)
483 set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX)
484 endforeach ()
485 endif ()
Tom Finegan957fe822016-11-09 10:37:27 -0800486endif ()
Tom Finegan7ba9ba82017-01-23 14:04:28 -0800487
488if (CONFIG_UNIT_TESTS)
Tom Finegan4db04d32017-02-23 14:37:27 -0800489 # Create test_libaom target and the targets it depends on.
490 setup_aom_test_targets()
Tom Finegan7ba9ba82017-01-23 14:04:28 -0800491endif ()
Tom Finegan9412ec32017-02-01 11:41:43 -0800492
Tom Finegan606f6462017-03-06 11:18:29 -0800493if (HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
494 find_package(Threads)
495 foreach (app_target ${AOM_APP_TARGETS})
Tom Finegand46b4d32017-05-09 09:14:03 -0700496 target_link_libraries(${app_target} ${AOM_LIB_LINK_TYPE} Threads::Threads)
Tom Finegan606f6462017-03-06 11:18:29 -0800497 endforeach ()
498endif ()
499
Tom Finegan9412ec32017-02-01 11:41:43 -0800500if (XCODE)
501 if (CONFIG_LIBYUV OR CONFIG_WEBM_IO)
502 # The Xcode generator does not obey LINKER_LANGUAGE. Because of the issue
503 # what looks like a C++ file needs to be in any target that Xcode will link
504 # when the target contains a C++ dependency.
505 # Without this Xcode will try to link with the C linker, which always ends
506 # badly when a dependency actually includes C++.
507 # Note: LINKER_LANGUAGE is explicitly set to C++ for all targets touched
508 # here, it really is the Xcode generator's fault, or just a deficiency in
509 # Xcode itself.
Tom Finegan9412ec32017-02-01 11:41:43 -0800510 foreach (aom_app ${AOM_APP_TARGETS})
Tom Finegan84f2d792017-06-15 23:06:44 -0700511 add_dummy_source_file_to_target("${aom_app}" "cc")
Tom Finegan9412ec32017-02-01 11:41:43 -0800512 endforeach ()
513 endif ()
514endif ()
Tom Finegan0a4ef082017-03-31 11:07:34 -0700515
Tom Finegan9befd172017-09-29 15:19:19 -0700516if (ENABLE_EXAMPLES AND "${CMAKE_GENERATOR}" MATCHES "Makefiles$")
Tom Finegan78975672017-05-30 08:55:54 -0700517 # Users of the configure build expect the example targets to be built in the
518 # examples sub directory of the configured build directory after running make.
519 file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/examples")
Tom Finegan938172c2017-10-07 13:58:34 -0700520
521 foreach (target ${AOM_EXAMPLE_TARGETS})
522 if (NOT "${target}" MATCHES "aomdec\|aomenc")
523 set_target_properties(${target} PROPERTIES
524 RUNTIME_OUTPUT_DIRECTORY
525 "${AOM_CONFIG_DIR}/examples")
526 endif ()
527 endforeach ()
Tom Finegane91bb452017-09-29 11:40:24 -0700528
Tom Finegan9befd172017-09-29 15:19:19 -0700529 if (ENABLE_TOOLS AND AOM_TOOL_TARGETS)
Tom Finegane91bb452017-09-29 11:40:24 -0700530 # The same expectation is true for tool targets.
531 file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/tools")
532 set_target_properties(${AOM_TOOL_TARGETS} PROPERTIES
533 RUNTIME_OUTPUT_DIRECTORY "${AOM_CONFIG_DIR}/tools")
534 endif ()
Tom Finegan78975672017-05-30 08:55:54 -0700535endif ()
536
Tom Finegan84f2d792017-06-15 23:06:44 -0700537if (BUILD_SHARED_LIBS)
538 include("${AOM_ROOT}/build/cmake/exports.cmake")
539 setup_exports_target()
Tom Finegan4a3a9c02017-07-14 08:34:20 -0700540 set_target_properties(aom PROPERTIES SOVERSION 0)
Tom Finegan84f2d792017-06-15 23:06:44 -0700541endif ()
542
Tom Fineganc8593982017-09-05 11:01:09 -0700543# Handle user supplied compile and link flags last to ensure they're obeyed.
544set_user_flags()
545
Tom Finegan0d066ce2017-05-30 11:07:05 -0700546# Aomedia documentation rule.
547if (ENABLE_DOCS)
548 include(FindDoxygen)
549 if (DOXYGEN_FOUND)
550 include("${AOM_ROOT}/docs.cmake")
551 setup_documentation_targets()
552 else ()
553 message("--- Cannot find doxygen, ENABLE_DOCS turned off.")
554 set(ENABLE_DOCS OFF)
555 endif ()
556endif ()
557
Tom Finegan0a4ef082017-03-31 11:07:34 -0700558# Aomedia install rule.
Tom Finegan0a4ef082017-03-31 11:07:34 -0700559set(AOM_INSTALL_INCS
560 "${AOM_ROOT}/aom/aom.h"
Tom Finegan0a4ef082017-03-31 11:07:34 -0700561 "${AOM_ROOT}/aom/aom_codec.h"
562 "${AOM_ROOT}/aom/aom_frame_buffer.h"
563 "${AOM_ROOT}/aom/aom_image.h"
564 "${AOM_ROOT}/aom/aom_integer.h"
Tom Finegan0a4ef082017-03-31 11:07:34 -0700565 "${AOM_ROOT}/aom/aom.h")
Tom Fineganba02c242017-05-16 15:01:54 -0700566
567if (CONFIG_AV1_DECODER)
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700568 if (ENABLE_EXAMPLES)
569 set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomdec)
570 endif ()
571
Tom Fineganba02c242017-05-16 15:01:54 -0700572 set(AOM_INSTALL_INCS
573 ${AOM_INSTALL_INCS}
574 "${AOM_ROOT}/aom/aom_decoder.h"
575 "${AOM_ROOT}/aom/aomdx.h")
576endif ()
577
578if (CONFIG_AV1_ENCODER)
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700579 if (ENABLE_EXAMPLES)
580 set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomenc)
581 endif ()
582
Tom Fineganba02c242017-05-16 15:01:54 -0700583 set(AOM_INSTALL_INCS
584 ${AOM_INSTALL_INCS}
585 "${AOM_ROOT}/aom/aomcx.h"
586 "${AOM_ROOT}/aom/aom_encoder.h")
Tom Fineganba02c242017-05-16 15:01:54 -0700587endif ()
588
Tom Finegan0a4ef082017-03-31 11:07:34 -0700589set(AOM_INSTALL_LIBS aom)
590
591install(FILES ${AOM_INSTALL_INCS}
592 DESTINATION "${CMAKE_INSTALL_PREFIX}/include/aom")
Tom Finegan782cdc12017-05-12 10:08:53 -0700593install(FILES "${AOM_CONFIG_DIR}/aom.pc"
594 DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
Tom Finegan0a4ef082017-03-31 11:07:34 -0700595install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700596
597if (ENABLE_EXAMPLES)
598 install(TARGETS ${AOM_INSTALL_BINS} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
599endif ()
Tom Finegan0d066ce2017-05-30 11:07:05 -0700600
Tom Finegan78975672017-05-30 08:55:54 -0700601# Aomedia dist rule.
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700602if (CONFIG_AV1_DECODER AND ENABLE_EXAMPLES)
Tom Finegan78975672017-05-30 08:55:54 -0700603 set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomdec>)
604endif ()
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700605if (CONFIG_AV1_ENCODER AND ENABLE_EXAMPLES)
Tom Finegan78975672017-05-30 08:55:54 -0700606 set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomenc>)
607endif ()
608
Tom Finegan9befd172017-09-29 15:19:19 -0700609if (ENABLE_EXAMPLES)
610 foreach (example ${AOM_EXAMPLE_TARGETS})
611 list(APPEND AOM_DIST_EXAMPLES $<TARGET_FILE:${example}>)
612 endforeach ()
613endif ()
Tom Finegan78975672017-05-30 08:55:54 -0700614
Tom Finegan9befd172017-09-29 15:19:19 -0700615if (ENABLE_TOOLS)
616 foreach (tool ${AOM_TOOL_TARGETS})
617 list(APPEND AOM_DIST_TOOLS $<TARGET_FILE:${tool}>)
618 endforeach ()
619endif ()
Tom Finegane91bb452017-09-29 11:40:24 -0700620
Tom Finegan78975672017-05-30 08:55:54 -0700621if (NOT AOM_DIST_DIR)
622 set(AOM_DIST_DIR "${AOM_CONFIG_DIR}/dist")
623endif ()
624
625add_custom_target(dist
626 COMMAND ${CMAKE_COMMAND}
627 -DAOM_ROOT=${AOM_ROOT}
628 -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
629 -DAOM_DIST_DIR=${AOM_DIST_DIR}
630 -DAOM_DIST_APPS="${AOM_DIST_APPS}"
631 -DAOM_DIST_EXAMPLES="${AOM_DIST_EXAMPLES}"
Tom Finegane91bb452017-09-29 11:40:24 -0700632 -DAOM_DIST_TOOLS="${AOM_DIST_TOOLS}"
Tom Finegan78975672017-05-30 08:55:54 -0700633 -DAOM_DIST_INCLUDES="${AOM_INSTALL_INCS}"
634 -DAOM_DIST_LIBS=$<TARGET_FILE:aom>
635 -DENABLE_DOCS=${ENABLE_DOCS}
636 -P "${AOM_ROOT}/build/cmake/dist.cmake"
637 DEPENDS ${AOM_INSTALL_BINS} ${AOM_INSTALL_LIBS}
Tom Finegan9cc0cfe2017-10-03 16:19:43 -0700638 ${AOM_INSTALL_INCS} ${AOM_EXAMPLE_TARGETS}
639 ${AOM_TOOL_TARGETS})
Tom Finegan78975672017-05-30 08:55:54 -0700640
Tom Finegan0d066ce2017-05-30 11:07:05 -0700641if (ENABLE_DOCS)
Tom Finegan78975672017-05-30 08:55:54 -0700642 add_dependencies(dist docs)
Tom Finegan0d066ce2017-05-30 11:07:05 -0700643endif ()
Tom Fineganc34abc82017-10-13 12:04:59 -0700644
645# Collect all variables containing libaom source files.
646get_cmake_property(all_cmake_vars VARIABLES)
647foreach (var ${all_cmake_vars})
648 if ("${var}" MATCHES "SOURCES$\|_INTRIN_\|_ASM_" AND NOT
649 "${var}" MATCHES "_APP_\|DOXYGEN\|LIBWEBM\|LIBYUV\|_PKG_\|TEST")
650 list(APPEND aom_source_vars ${var})
651 endif ()
652endforeach ()
653
654# Libaom_srcs.txt generation.
655set(libaom_srcs_txt_file "${AOM_CONFIG_DIR}/libaom_srcs.txt")
656file(WRITE "${libaom_srcs_txt_file}" "# This file is generated. DO NOT EDIT.\n")
657
658# Static source file list first.
659foreach (aom_source_var ${aom_source_vars})
660 foreach (file ${${aom_source_var}})
661 if (NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
662 string(REPLACE "${AOM_ROOT}/" "" file "${file}")
663 file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
664 endif ()
665 endforeach ()
666endforeach ()
667
668file(APPEND "${libaom_srcs_txt_file}"
669 "# Files below this line are generated by the libaom build system.\n")
670foreach (aom_source_var ${aom_source_vars})
671 foreach (file ${${aom_source_var}})
672 if ("${file}" MATCHES "${AOM_CONFIG_DIR}")
673 string(REPLACE "${AOM_CONFIG_DIR}/" "" file "${file}")
674 file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
675 endif ()
676 endforeach ()
677endforeach ()
678
679# Libaom_srcs.gni generation.
680set(libaom_srcs_gni_file "${AOM_CONFIG_DIR}/libaom_srcs.gni")
681file(WRITE "${libaom_srcs_gni_file}" "# This file is generated. DO NOT EDIT.\n")
682
683foreach (aom_source_var ${aom_source_vars})
684 if ("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
685 string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
686 file(APPEND "${libaom_srcs_gni_file}" "\n${aom_source_var_lowercase} = [\n")
687 endif ()
688
689 foreach (file ${${aom_source_var}})
690 if (NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
691 string(REPLACE "${AOM_ROOT}" "//third_party/aom/src" file "${file}")
692 file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
693 endif ()
694 endforeach ()
695
696 if ("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
697 file(APPEND "${libaom_srcs_gni_file}" "]\n")
698 endif ()
699endforeach ()
700
701file(APPEND "${libaom_srcs_gni_file}"
702 "\n# Files below this line are generated by the libaom build system.\n")
703
704foreach (aom_source_var ${aom_source_vars})
705 if ("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
706 string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
707 file(APPEND "${libaom_srcs_gni_file}"
708 "\n${aom_source_var_lowercase}_gen = [\n")
709 endif ()
710 foreach (file ${${aom_source_var}})
711 if (NOT "${file}" MATCHES "${AOM_ROOT}")
712 string(REPLACE "${AOM_CONFIG_DIR}" "//third_party/aom/src" file "${file}")
713 file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
714 endif ()
715 endforeach ()
716
717 if ("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
718 file(APPEND "${libaom_srcs_gni_file}" "]\n")
719 endif ()
720endforeach ()