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