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