blob: 53dcae2b7c862d9b6b3d21b986fa2c763d8050c6 [file] [log] [blame]
mbonadei9aa3f0a2017-01-24 06:58:22 -08001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import("//build/config/arm.gni")
10import("//build/config/features.gni")
11import("//build/config/mips.gni")
12import("//build/config/sanitizers/sanitizers.gni")
13import("//build_overrides/build.gni")
14import("//testing/test.gni")
15
16declare_args() {
17 # Disable this to avoid building the Opus audio codec.
18 rtc_include_opus = true
19
20 # Enable this to let the Opus audio codec change complexity on the fly.
21 rtc_opus_variable_complexity = false
22
23 # Disable to use absolute header paths for some libraries.
24 rtc_relative_path = true
25
26 # Used to specify an external Jsoncpp include path when not compiling the
27 # library that comes with WebRTC (i.e. rtc_build_json == 0).
28 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
29
30 # Used to specify an external OpenSSL include path when not compiling the
31 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
32 rtc_ssl_root = ""
33
34 # Selects fixed-point code where possible.
35 rtc_prefer_fixed_point = false
36
37 # Enables the use of protocol buffers for debug recordings.
38 rtc_enable_protobuf = true
39
40 # Disable the code for the intelligibility enhancer by default.
41 rtc_enable_intelligibility_enhancer = false
42
43 # Enable when an external authentication mechanism is used for performing
44 # packet authentication for RTP packets instead of libsrtp.
45 rtc_enable_external_auth = build_with_chromium
46
47 # Selects whether debug dumps for the audio processing module
48 # should be generated.
49 apm_debug_dump = false
50
51 # Set this to true to enable BWE test logging.
52 rtc_enable_bwe_test_logging = false
53
54 # Set this to disable building with support for SCTP data channels.
55 rtc_enable_sctp = true
56
57 # Disable these to not build components which can be externally provided.
58 rtc_build_expat = true
59 rtc_build_json = true
60 rtc_build_libjpeg = true
61 rtc_build_libsrtp = true
62 rtc_build_libvpx = true
63 rtc_libvpx_build_vp9 = true
64 rtc_build_libyuv = true
65 rtc_build_openmax_dl = true
66 rtc_build_opus = true
67 rtc_build_ssl = true
68 rtc_build_usrsctp = true
69
70 # Enable to use the Mozilla internal settings.
71 build_with_mozilla = false
72
73 rtc_enable_android_opensl = false
74
75 # Link-Time Optimizations.
76 # Executes code generation at link-time instead of compile-time.
77 # https://gcc.gnu.org/wiki/LinkTimeOptimization
78 rtc_use_lto = false
79
80 # Set to "func", "block", "edge" for coverage generation.
81 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
82 # It is recommend to set include_examples=0.
83 # Use llvm's sancov -html-report for human readable reports.
84 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
85 rtc_sanitize_coverage = ""
86
87 # Enable libevent task queues on platforms that support it.
88 if (is_win || is_mac || is_ios || is_nacl) {
89 rtc_enable_libevent = false
90 rtc_build_libevent = false
91 } else {
92 rtc_enable_libevent = true
93 rtc_build_libevent = true
94 }
95
96 if (current_cpu == "arm" || current_cpu == "arm64") {
97 rtc_prefer_fixed_point = true
98 }
99
100 if (!is_ios && (current_cpu != "arm" || arm_version >= 7) &&
101 current_cpu != "mips64el") {
102 rtc_use_openmax_dl = true
103 } else {
104 rtc_use_openmax_dl = false
105 }
106
107 # Determines whether NEON code will be built.
108 rtc_build_with_neon =
109 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
110
111 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
112 # all platforms except Android and iOS. Because FFmpeg can be built
113 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
114 # value that includes H.264, for example "Chrome". If FFmpeg is built without
115 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
116 # also: |rtc_initialize_ffmpeg|.
117 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
118 # http://www.openh264.org, https://www.ffmpeg.org/
119 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
120
121 # Determines whether QUIC code will be built.
122 rtc_use_quic = false
123
124 # By default, use normal platform audio support or dummy audio, but don't
125 # use file-based audio playout and record.
126 rtc_use_dummy_audio_file_devices = false
127
128 # When set to true, test targets will declare the files needed to run memcheck
129 # as data dependencies. This is to enable memcheck execution on swarming bots.
130 rtc_use_memcheck = false
131
132 # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
133 # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
134 # only be initialized once. Projects that initialize FFmpeg externally, such
135 # as Chromium, must turn this flag off so that WebRTC does not also
136 # initialize.
137 rtc_initialize_ffmpeg = !build_with_chromium
138
139 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
140 # build environments, even if available for Chromium builds.
141 rtc_use_gtk = !build_with_chromium
142}
143
144# A second declare_args block, so that declarations within it can
145# depend on the possibly overridden variables in the first
146# declare_args block.
147declare_args() {
148 # Include the iLBC audio codec?
149 rtc_include_ilbc = !(build_with_chromium || build_with_mozilla)
150
151 rtc_restrict_logging = build_with_chromium
152
153 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
154 rtc_include_pulse_audio = !build_with_chromium
155
156 # Chromium uses its own IO handling, so the internal ADM is only built for
157 # standalone WebRTC.
158 rtc_include_internal_audio_device = !build_with_chromium
159
160 # Include tests in standalone checkout.
161 rtc_include_tests = !build_with_chromium
162}
163
164# Make it possible to provide custom locations for some libraries (move these
165# up into declare_args should we need to actually use them for the GN build).
166rtc_libvpx_dir = "//third_party/libvpx"
167rtc_libyuv_dir = "//third_party/libyuv"
168rtc_opus_dir = "//third_party/opus"
169
170# Desktop capturer is supported only on Windows, OSX and Linux.
171rtc_desktop_capture_supported = is_win || is_mac || is_linux
172
173###############################################################################
174# Templates
175#
176
177# Points to //webrtc/ in webrtc stand-alone or to //third_party/webrtc/ in
178# chromium.
179# We need absolute paths for all configs in templates as they are shared in
180# different subdirectories.
181webrtc_root = get_path_info(".", "abspath")
182
183# Global configuration that should be applied to all WebRTC targets.
184# You normally shouldn't need to include this in your target as it's
185# automatically included when using the rtc_* templates.
186# It sets defines, include paths and compilation warnings accordingly,
187# both for WebRTC stand-alone builds and for the scenario when WebRTC
188# native code is built as part of Chromium.
189rtc_common_configs = [ webrtc_root + ":common_config" ]
190
191# Global public configuration that should be applied to all WebRTC targets. You
192# normally shouldn't need to include this in your target as it's automatically
193# included when using the rtc_* templates. It set the defines, include paths and
194# compilation warnings that should be propagated to dependents of the targets
195# depending on the target having this config.
196rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
197
198# Common configs to remove or add in all rtc targets.
199rtc_remove_configs = []
200rtc_add_configs = rtc_common_configs
201
202set_defaults("rtc_test") {
203 configs = rtc_add_configs
204 suppressed_configs = []
205}
206
207set_defaults("rtc_source_set") {
208 configs = rtc_add_configs
209 suppressed_configs = []
210}
211
212set_defaults("rtc_executable") {
213 configs = rtc_add_configs
214 suppressed_configs = []
215}
216
217set_defaults("rtc_static_library") {
218 configs = rtc_add_configs
219 suppressed_configs = []
220}
221
222set_defaults("rtc_shared_library") {
223 configs = rtc_add_configs
224 suppressed_configs = []
225}
226
227template("rtc_test") {
228 test(target_name) {
229 forward_variables_from(invoker,
230 "*",
231 [
232 "configs",
233 "public_configs",
234 "suppressed_configs",
235 ])
236 configs += invoker.configs
237 configs -= rtc_remove_configs
238 configs -= invoker.suppressed_configs
239 public_configs = [ rtc_common_inherited_config ]
240 if (defined(invoker.public_configs)) {
241 public_configs += invoker.public_configs
242 }
243 }
244}
245
246template("rtc_source_set") {
247 source_set(target_name) {
248 forward_variables_from(invoker,
249 "*",
250 [
251 "configs",
252 "public_configs",
253 "suppressed_configs",
254 ])
255 configs += invoker.configs
256 configs -= rtc_remove_configs
257 configs -= invoker.suppressed_configs
258 public_configs = [ rtc_common_inherited_config ]
259 if (defined(invoker.public_configs)) {
260 public_configs += invoker.public_configs
261 }
262 }
263}
264
265template("rtc_executable") {
266 executable(target_name) {
267 forward_variables_from(invoker,
268 "*",
269 [
270 "deps",
271 "configs",
272 "public_configs",
273 "suppressed_configs",
274 ])
275 configs += invoker.configs
276 configs -= rtc_remove_configs
277 configs -= invoker.suppressed_configs
278 deps = [
279 "//build/config/sanitizers:deps",
280 ]
281 deps += invoker.deps
282 public_configs = [ rtc_common_inherited_config ]
283 if (defined(invoker.public_configs)) {
284 public_configs += invoker.public_configs
285 }
286 }
287}
288
289template("rtc_static_library") {
290 static_library(target_name) {
291 forward_variables_from(invoker,
292 "*",
293 [
294 "configs",
295 "public_configs",
296 "suppressed_configs",
297 ])
298 configs += invoker.configs
299 configs -= rtc_remove_configs
300 configs -= invoker.suppressed_configs
301 public_configs = [ rtc_common_inherited_config ]
302 if (defined(invoker.public_configs)) {
303 public_configs += invoker.public_configs
304 }
305 }
306}
307
308template("rtc_shared_library") {
309 shared_library(target_name) {
310 forward_variables_from(invoker,
311 "*",
312 [
313 "configs",
314 "public_configs",
315 "suppressed_configs",
316 ])
317 configs += invoker.configs
318 configs -= rtc_remove_configs
319 configs -= invoker.suppressed_configs
320 public_configs = [ rtc_common_inherited_config ]
321 if (defined(invoker.public_configs)) {
322 public_configs += invoker.public_configs
323 }
324 }
325}