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