blob: 71a4eda8be75cd123365a717cf48c02448eed608 [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +00001# 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
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +00009import("//build/config/arm.gni")
hbos62756ee2016-02-08 02:57:00 -080010import("//build/config/features.gni")
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +000011import("//build/config/mips.gni")
ehmaldonado1dd23352016-09-02 07:03:15 -070012import("//build/config/sanitizers/sanitizers.gni")
ehmaldonado4016a0b2016-09-07 06:50:19 -070013import("//build_overrides/build.gni")
ehmaldonado38a21322016-09-02 04:10:34 -070014import("//testing/test.gni")
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000015
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000016declare_args() {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000017 # Disable this to avoid building the Opus audio codec.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000018 rtc_include_opus = true
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000019
kjellanderc76dc952016-06-03 03:09:32 -070020 # Disable to use absolute header paths for some libraries.
21 rtc_relative_path = true
22
kjellander@webrtc.orge281f7f2014-09-02 11:22:06 +000023 # Used to specify an external Jsoncpp include path when not compiling the
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000024 # library that comes with WebRTC (i.e. rtc_build_json == 0).
25 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
kjellander@webrtc.orge281f7f2014-09-02 11:22:06 +000026
27 # Used to specify an external OpenSSL include path when not compiling the
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000028 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
29 rtc_ssl_root = ""
kjellander@webrtc.orge281f7f2014-09-02 11:22:06 +000030
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000031 # Selects fixed-point code where possible.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000032 rtc_prefer_fixed_point = false
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000033
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000034 # Enable data logging. Produces text files with data logged within engines
35 # which can be easily parsed for offline processing.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000036 rtc_enable_data_logging = false
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000037
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000038 # Enables the use of protocol buffers for debug recordings.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000039 rtc_enable_protobuf = true
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000040
peah1bcfce52016-08-26 07:16:04 -070041 # Disable the code for the intelligibility enhancer by default.
42 rtc_enable_intelligibility_enhancer = false
43
peahf28a3892016-09-01 08:58:21 -070044 # Selects whether debug dumps for the audio processing module
45 # should be generated.
46 apm_debug_dump = false
47
kjellander@webrtc.org11bea892014-07-03 17:04:12 +000048 # Disable these to not build components which can be externally provided.
Henrik Kjellandere6cefb62015-04-27 14:39:04 +020049 rtc_build_expat = true
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000050 rtc_build_json = true
kjellanderc76dc952016-06-03 03:09:32 -070051 rtc_build_libjpeg = true
52 rtc_build_libsrtp = true
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000053 rtc_build_libvpx = true
kjellanderfb114242016-06-13 00:19:48 -070054 rtc_libvpx_build_vp9 = true
Henrik Kjellandere6cefb62015-04-27 14:39:04 +020055 rtc_build_libyuv = true
Andrew MacDonald23dc68e2015-04-24 08:46:51 -070056 rtc_build_openmax_dl = true
Henrik Kjellandere6cefb62015-04-27 14:39:04 +020057 rtc_build_opus = true
58 rtc_build_ssl = true
kjellanderc76dc952016-06-03 03:09:32 -070059 rtc_build_usrsctp = true
kjellander@webrtc.org11bea892014-07-03 17:04:12 +000060
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000061 # Disable by default.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000062 rtc_have_dbus_glib = false
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000063
64 # Enable to use the Mozilla internal settings.
65 build_with_mozilla = false
66
henrika@webrtc.org45db7ee2015-01-12 14:27:23 +000067 rtc_enable_android_opensl = false
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000068
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000069 # Link-Time Optimizations.
70 # Executes code generation at link-time instead of compile-time.
71 # https://gcc.gnu.org/wiki/LinkTimeOptimization
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000072 rtc_use_lto = false
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000073
Johan Ahlers9ddac182016-07-22 08:57:23 +020074 # Set to "func", "block", "edge" for coverage generation.
75 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
76 # It is recommend to set include_examples=0.
77 # Use llvm's sancov -html-report for human readable reports.
78 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
79 rtc_sanitize_coverage = ""
80
phoglundff274392016-05-17 03:44:28 -070081 # Enable libevent task queues on platforms that support it.
82 if (is_win || is_mac || is_ios || is_nacl) {
83 rtc_enable_libevent = false
84 rtc_build_libevent = false
85 } else {
86 rtc_enable_libevent = true
87 rtc_build_libevent = true
88 }
89
pkotwicza75339c2016-02-10 10:21:07 -080090 if (current_cpu == "arm" || current_cpu == "arm64") {
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000091 rtc_prefer_fixed_point = true
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000092 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000093
Gordana.Cmiljanoviccaea17a2016-06-01 00:53:36 -070094 if (!is_ios && (current_cpu != "arm" || arm_version >= 7) &&
95 current_cpu != "mips64el") {
andrew@webrtc.org4165f7a2014-10-08 18:01:27 +000096 rtc_use_openmax_dl = true
97 } else {
98 rtc_use_openmax_dl = false
99 }
100
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700101 # Determines whether NEON code will be built.
petermayo50cf10d2015-07-09 09:45:04 -0700102 rtc_build_with_neon =
paskoe305d952016-05-17 10:56:40 -0700103 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
Zeke Chin71f6f442015-06-29 14:34:58 -0700104
105 # Enable this to use HW H.264 encoder/decoder on iOS PeerConnections.
106 # Enabling this may break interop with Android clients that support H264.
107 rtc_use_objc_h264 = false
hbosa9a1d2a2016-01-11 10:19:02 -0800108
hbos902c03e2016-01-21 03:34:40 -0800109 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
hbos62756ee2016-02-08 02:57:00 -0800110 # all platforms except Android and iOS. Because FFmpeg can be built
111 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
112 # value that includes H.264, for example "Chrome". If FFmpeg is built without
113 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
114 # also: |rtc_initialize_ffmpeg|.
hbosa9a1d2a2016-01-11 10:19:02 -0800115 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
116 # http://www.openh264.org, https://www.ffmpeg.org/
hbos62756ee2016-02-08 02:57:00 -0800117 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
hbosc5a39c22016-02-02 02:26:05 -0800118
kjellanderc76dc952016-06-03 03:09:32 -0700119 # Determines whether QUIC code will be built.
120 rtc_use_quic = false
121
noahricc594aa612016-08-16 18:21:18 -0700122 # By default, use normal platform audio support or dummy audio, but don't
123 # use file-based audio playout and record.
124 rtc_use_dummy_audio_file_devices = false
125
hbosc5a39c22016-02-02 02:26:05 -0800126 # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
127 # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
128 # only be initialized once. Projects that initialize FFmpeg externally, such
129 # as Chromium, must turn this flag off so that WebRTC does not also
130 # initialize.
131 rtc_initialize_ffmpeg = !build_with_chromium
kjellanderc76dc952016-06-03 03:09:32 -0700132
133 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
134 # build environments, even if available for Chromium builds.
135 rtc_use_gtk = !build_with_chromium
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000136}
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000137
kwibergf8c2bac2016-01-18 06:38:32 -0800138# A second declare_args block, so that declarations within it can
139# depend on the possibly overridden variables in the first
140# declare_args block.
141declare_args() {
142 # Include the iLBC audio codec?
143 rtc_include_ilbc = !(build_with_chromium || build_with_mozilla)
ehmaldonadoedaa4a42016-09-06 02:27:47 -0700144
145 rtc_restrict_logging = build_with_chromium
ehmaldonado4016a0b2016-09-07 06:50:19 -0700146
147 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
148 rtc_include_pulse_audio = !build_with_chromium
149
150 # Chromium uses its own IO handling, so the internal ADM is only built for
151 # standalone WebRTC.
152 rtc_include_internal_audio_device = !build_with_chromium
153
154 # Include tests in standalone checkout.
155 rtc_include_tests = !build_with_chromium
kwibergf8c2bac2016-01-18 06:38:32 -0800156}
157
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000158# Make it possible to provide custom locations for some libraries (move these
159# up into declare_args should we need to actually use them for the GN build).
kjellandere26e7872016-03-04 14:39:28 -0800160rtc_libvpx_dir = "//third_party/libvpx"
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000161rtc_libyuv_dir = "//third_party/libyuv"
162rtc_opus_dir = "//third_party/opus"
ehmaldonado38a21322016-09-02 04:10:34 -0700163
164###############################################################################
165# Templates
166#
167
168# Points to //webrtc/ in webrtc stand-alone or to //third_party/webrtc/ in
169# chromium.
170# We need absolute paths for all configs in templates as they are shared in
171# different subdirectories.
172webrtc_root = get_path_info("../", "abspath")
173
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700174# Global configuration that should be applied to all WebRTC targets.
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700175# You normally shouldn't need to include this in your target as it's
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700176# automatically included when using the rtc_* templates.
177# It sets defines, include paths and compilation warnings accordingly,
178# both for WebRTC stand-alone builds and for the scenario when WebRTC
179# native code is built as part of Chromium.
180rtc_common_config = webrtc_root + ":common_config"
181
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700182# Global public configuration that should be applied to all WebRTC targets. You
183# normally shouldn't need to include this in your target as it's automatically
184# included when using the rtc_* templates. It set the defines, include paths and
185# compilation warnings that should be propagated to dependents of the targets
186# depending on the target having this config.
187rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
188
ehmaldonado38a21322016-09-02 04:10:34 -0700189# Common configs to remove or add in all rtc targets.
190rtc_remove_configs = []
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700191rtc_add_configs = [ rtc_common_config ]
ehmaldonado38a21322016-09-02 04:10:34 -0700192
ehmaldonadof71d2982016-09-05 10:03:57 -0700193if (!is_debug && is_win) {
ehmaldonado59af8b72016-09-05 02:48:54 -0700194 rtc_remove_configs += [ "//build/config/compiler:default_optimization" ]
195 rtc_add_configs += [ "//build/config/compiler:optimize_max" ]
196}
197
ehmaldonado38a21322016-09-02 04:10:34 -0700198set_defaults("rtc_test") {
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700199 configs = rtc_add_configs
ehmaldonado38a21322016-09-02 04:10:34 -0700200 suppressed_configs = []
201}
202
203set_defaults("rtc_source_set") {
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700204 configs = rtc_add_configs
ehmaldonado38a21322016-09-02 04:10:34 -0700205 suppressed_configs = []
206}
207
208set_defaults("rtc_executable") {
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700209 configs = rtc_add_configs
ehmaldonado38a21322016-09-02 04:10:34 -0700210 suppressed_configs = []
211}
212
213set_defaults("rtc_static_library") {
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700214 configs = rtc_add_configs
ehmaldonado38a21322016-09-02 04:10:34 -0700215 suppressed_configs = []
216}
217
ehmaldonadoacf9f472016-09-08 04:26:37 -0700218set_defaults("rtc_shared_library") {
219 configs = rtc_add_configs
220 suppressed_configs = []
221}
222
ehmaldonado38a21322016-09-02 04:10:34 -0700223template("rtc_test") {
224 test(target_name) {
225 forward_variables_from(invoker,
226 "*",
227 [
228 "configs",
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700229 "public_configs",
ehmaldonado38a21322016-09-02 04:10:34 -0700230 "suppressed_configs",
231 ])
232 configs += invoker.configs
ehmaldonado38a21322016-09-02 04:10:34 -0700233 configs -= rtc_remove_configs
234 configs -= invoker.suppressed_configs
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700235 public_configs = [ rtc_common_inherited_config ]
236 if (defined(invoker.public_configs)) {
237 public_configs += invoker.public_configs
238 }
ehmaldonado38a21322016-09-02 04:10:34 -0700239 }
240}
241
242template("rtc_source_set") {
243 source_set(target_name) {
244 forward_variables_from(invoker,
245 "*",
246 [
247 "configs",
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700248 "public_configs",
ehmaldonado38a21322016-09-02 04:10:34 -0700249 "suppressed_configs",
250 ])
251 configs += invoker.configs
ehmaldonado38a21322016-09-02 04:10:34 -0700252 configs -= rtc_remove_configs
253 configs -= invoker.suppressed_configs
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700254 public_configs = [ rtc_common_inherited_config ]
255 if (defined(invoker.public_configs)) {
256 public_configs += invoker.public_configs
257 }
ehmaldonado38a21322016-09-02 04:10:34 -0700258 }
259}
260
261template("rtc_executable") {
262 executable(target_name) {
263 forward_variables_from(invoker,
264 "*",
265 [
ehmaldonado1dd23352016-09-02 07:03:15 -0700266 "deps",
ehmaldonado38a21322016-09-02 04:10:34 -0700267 "configs",
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700268 "public_configs",
ehmaldonado38a21322016-09-02 04:10:34 -0700269 "suppressed_configs",
270 ])
271 configs += invoker.configs
ehmaldonado38a21322016-09-02 04:10:34 -0700272 configs -= rtc_remove_configs
273 configs -= invoker.suppressed_configs
ehmaldonado1dd23352016-09-02 07:03:15 -0700274 deps = [
275 "//build/config/sanitizers:deps",
276 ]
277 deps += invoker.deps
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700278 public_configs = [ rtc_common_inherited_config ]
279 if (defined(invoker.public_configs)) {
280 public_configs += invoker.public_configs
281 }
ehmaldonado38a21322016-09-02 04:10:34 -0700282 }
283}
284
285template("rtc_static_library") {
286 static_library(target_name) {
287 forward_variables_from(invoker,
288 "*",
289 [
290 "configs",
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700291 "public_configs",
ehmaldonado38a21322016-09-02 04:10:34 -0700292 "suppressed_configs",
293 ])
294 configs += invoker.configs
ehmaldonado38a21322016-09-02 04:10:34 -0700295 configs -= rtc_remove_configs
296 configs -= invoker.suppressed_configs
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700297 public_configs = [ rtc_common_inherited_config ]
298 if (defined(invoker.public_configs)) {
299 public_configs += invoker.public_configs
300 }
ehmaldonado38a21322016-09-02 04:10:34 -0700301 }
302}
ehmaldonadoacf9f472016-09-08 04:26:37 -0700303
304template("rtc_shared_library") {
305 shared_library(target_name) {
306 forward_variables_from(invoker,
307 "*",
308 [
309 "configs",
310 "public_configs",
311 "suppressed_configs",
312 ])
313 configs += invoker.configs
314 configs -= rtc_remove_configs
315 configs -= invoker.suppressed_configs
316 public_configs = [ rtc_common_inherited_config ]
317 if (defined(invoker.public_configs)) {
318 public_configs += invoker.public_configs
319 }
320 }
321}