kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [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 | |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 9 | import("//build/config/arm.gni") |
hbos | 62756ee | 2016-02-08 02:57:00 -0800 | [diff] [blame] | 10 | import("//build/config/features.gni") |
kjellander@webrtc.org | acb8085 | 2015-01-25 19:17:56 +0000 | [diff] [blame] | 11 | import("//build/config/mips.gni") |
Henrik Kjellander | b79472a | 2015-10-14 08:13:58 +0200 | [diff] [blame] | 12 | import("//build_overrides/webrtc.gni") |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame^] | 13 | import("//testing/test.gni") |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 14 | |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 15 | declare_args() { |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 16 | # Disable this to avoid building the Opus audio codec. |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 17 | rtc_include_opus = true |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 18 | |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 19 | # Disable to use absolute header paths for some libraries. |
| 20 | rtc_relative_path = true |
| 21 | |
kjellander@webrtc.org | e281f7f | 2014-09-02 11:22:06 +0000 | [diff] [blame] | 22 | # Used to specify an external Jsoncpp include path when not compiling the |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 23 | # library that comes with WebRTC (i.e. rtc_build_json == 0). |
| 24 | rtc_jsoncpp_root = "//third_party/jsoncpp/source/include" |
kjellander@webrtc.org | e281f7f | 2014-09-02 11:22:06 +0000 | [diff] [blame] | 25 | |
| 26 | # Used to specify an external OpenSSL include path when not compiling the |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 27 | # library that comes with WebRTC (i.e. rtc_build_ssl == 0). |
| 28 | rtc_ssl_root = "" |
kjellander@webrtc.org | e281f7f | 2014-09-02 11:22:06 +0000 | [diff] [blame] | 29 | |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 30 | # Selects fixed-point code where possible. |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 31 | rtc_prefer_fixed_point = false |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 32 | |
kjellander@webrtc.org | 78f440c | 2014-06-21 14:25:16 +0000 | [diff] [blame] | 33 | # Enable data logging. Produces text files with data logged within engines |
| 34 | # which can be easily parsed for offline processing. |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 35 | rtc_enable_data_logging = false |
kjellander@webrtc.org | 78f440c | 2014-06-21 14:25:16 +0000 | [diff] [blame] | 36 | |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 37 | # Enables the use of protocol buffers for debug recordings. |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 38 | rtc_enable_protobuf = true |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 39 | |
peah | 1bcfce5 | 2016-08-26 07:16:04 -0700 | [diff] [blame] | 40 | # Disable the code for the intelligibility enhancer by default. |
| 41 | rtc_enable_intelligibility_enhancer = false |
| 42 | |
peah | f28a389 | 2016-09-01 08:58:21 -0700 | [diff] [blame] | 43 | # Selects whether debug dumps for the audio processing module |
| 44 | # should be generated. |
| 45 | apm_debug_dump = false |
| 46 | |
kjellander@webrtc.org | 11bea89 | 2014-07-03 17:04:12 +0000 | [diff] [blame] | 47 | # Disable these to not build components which can be externally provided. |
Henrik Kjellander | e6cefb6 | 2015-04-27 14:39:04 +0200 | [diff] [blame] | 48 | rtc_build_expat = true |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 49 | rtc_build_json = true |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 50 | rtc_build_libjpeg = true |
| 51 | rtc_build_libsrtp = true |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 52 | rtc_build_libvpx = true |
kjellander | fb11424 | 2016-06-13 00:19:48 -0700 | [diff] [blame] | 53 | rtc_libvpx_build_vp9 = true |
Henrik Kjellander | e6cefb6 | 2015-04-27 14:39:04 +0200 | [diff] [blame] | 54 | rtc_build_libyuv = true |
Andrew MacDonald | 23dc68e | 2015-04-24 08:46:51 -0700 | [diff] [blame] | 55 | rtc_build_openmax_dl = true |
Henrik Kjellander | e6cefb6 | 2015-04-27 14:39:04 +0200 | [diff] [blame] | 56 | rtc_build_opus = true |
| 57 | rtc_build_ssl = true |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 58 | rtc_build_usrsctp = true |
kjellander@webrtc.org | 11bea89 | 2014-07-03 17:04:12 +0000 | [diff] [blame] | 59 | |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 60 | # Disable by default. |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 61 | rtc_have_dbus_glib = false |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 62 | |
| 63 | # Enable to use the Mozilla internal settings. |
| 64 | build_with_mozilla = false |
| 65 | |
henrika@webrtc.org | 45db7ee | 2015-01-12 14:27:23 +0000 | [diff] [blame] | 66 | rtc_enable_android_opensl = false |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 67 | |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 68 | # Link-Time Optimizations. |
| 69 | # Executes code generation at link-time instead of compile-time. |
| 70 | # https://gcc.gnu.org/wiki/LinkTimeOptimization |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 71 | rtc_use_lto = false |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 72 | |
kjellander@webrtc.org | 2db1dbb | 2016-03-11 21:34:24 -0800 | [diff] [blame] | 73 | rtc_restrict_logging = true |
kjellander@webrtc.org | 788f058 | 2014-08-28 13:51:08 +0000 | [diff] [blame] | 74 | |
Johan Ahlers | 9ddac18 | 2016-07-22 08:57:23 +0200 | [diff] [blame] | 75 | # Set to "func", "block", "edge" for coverage generation. |
| 76 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 77 | # It is recommend to set include_examples=0. |
| 78 | # Use llvm's sancov -html-report for human readable reports. |
| 79 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 80 | rtc_sanitize_coverage = "" |
| 81 | |
phoglund | ff27439 | 2016-05-17 03:44:28 -0700 | [diff] [blame] | 82 | # Enable libevent task queues on platforms that support it. |
| 83 | if (is_win || is_mac || is_ios || is_nacl) { |
| 84 | rtc_enable_libevent = false |
| 85 | rtc_build_libevent = false |
| 86 | } else { |
| 87 | rtc_enable_libevent = true |
| 88 | rtc_build_libevent = true |
| 89 | } |
| 90 | |
pkotwicz | a75339c | 2016-02-10 10:21:07 -0800 | [diff] [blame] | 91 | if (current_cpu == "arm" || current_cpu == "arm64") { |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 92 | rtc_prefer_fixed_point = true |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 93 | } |
kjellander@webrtc.org | 524b8f7 | 2014-08-31 20:32:53 +0000 | [diff] [blame] | 94 | |
Gordana.Cmiljanovic | caea17a | 2016-06-01 00:53:36 -0700 | [diff] [blame] | 95 | if (!is_ios && (current_cpu != "arm" || arm_version >= 7) && |
| 96 | current_cpu != "mips64el") { |
andrew@webrtc.org | 4165f7a | 2014-10-08 18:01:27 +0000 | [diff] [blame] | 97 | rtc_use_openmax_dl = true |
| 98 | } else { |
| 99 | rtc_use_openmax_dl = false |
| 100 | } |
| 101 | |
Andrew MacDonald | ac4234c | 2015-06-24 18:25:54 -0700 | [diff] [blame] | 102 | # Determines whether NEON code will be built. |
petermayo | 50cf10d | 2015-07-09 09:45:04 -0700 | [diff] [blame] | 103 | rtc_build_with_neon = |
pasko | e305d95 | 2016-05-17 10:56:40 -0700 | [diff] [blame] | 104 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
Zeke Chin | 71f6f44 | 2015-06-29 14:34:58 -0700 | [diff] [blame] | 105 | |
| 106 | # Enable this to use HW H.264 encoder/decoder on iOS PeerConnections. |
| 107 | # Enabling this may break interop with Android clients that support H264. |
| 108 | rtc_use_objc_h264 = false |
hbos | a9a1d2a | 2016-01-11 10:19:02 -0800 | [diff] [blame] | 109 | |
hbos | 902c03e | 2016-01-21 03:34:40 -0800 | [diff] [blame] | 110 | # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on |
hbos | 62756ee | 2016-02-08 02:57:00 -0800 | [diff] [blame] | 111 | # all platforms except Android and iOS. Because FFmpeg can be built |
| 112 | # with/without H.264 support, |ffmpeg_branding| has to separately be set to a |
| 113 | # value that includes H.264, for example "Chrome". If FFmpeg is built without |
| 114 | # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See |
| 115 | # also: |rtc_initialize_ffmpeg|. |
hbos | a9a1d2a | 2016-01-11 10:19:02 -0800 | [diff] [blame] | 116 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 117 | # http://www.openh264.org, https://www.ffmpeg.org/ |
hbos | 62756ee | 2016-02-08 02:57:00 -0800 | [diff] [blame] | 118 | rtc_use_h264 = proprietary_codecs && !is_android && !is_ios |
hbos | c5a39c2 | 2016-02-02 02:26:05 -0800 | [diff] [blame] | 119 | |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 120 | # Determines whether QUIC code will be built. |
| 121 | rtc_use_quic = false |
| 122 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 123 | # By default, use normal platform audio support or dummy audio, but don't |
| 124 | # use file-based audio playout and record. |
| 125 | rtc_use_dummy_audio_file_devices = false |
| 126 | |
hbos | c5a39c2 | 2016-02-02 02:26:05 -0800 | [diff] [blame] | 127 | # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done |
| 128 | # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must |
| 129 | # only be initialized once. Projects that initialize FFmpeg externally, such |
| 130 | # as Chromium, must turn this flag off so that WebRTC does not also |
| 131 | # initialize. |
| 132 | rtc_initialize_ffmpeg = !build_with_chromium |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 133 | |
| 134 | # Build sources requiring GTK. NOTICE: This is not present in Chrome OS |
| 135 | # build environments, even if available for Chromium builds. |
| 136 | rtc_use_gtk = !build_with_chromium |
kjellander@webrtc.org | 851a09e | 2014-06-17 08:54:03 +0000 | [diff] [blame] | 137 | } |
kjellander@webrtc.org | ce22f13 | 2015-02-16 12:47:20 +0000 | [diff] [blame] | 138 | |
kwiberg | f8c2bac | 2016-01-18 06:38:32 -0800 | [diff] [blame] | 139 | # A second declare_args block, so that declarations within it can |
| 140 | # depend on the possibly overridden variables in the first |
| 141 | # declare_args block. |
| 142 | declare_args() { |
| 143 | # Include the iLBC audio codec? |
| 144 | rtc_include_ilbc = !(build_with_chromium || build_with_mozilla) |
| 145 | } |
| 146 | |
kjellander@webrtc.org | ce22f13 | 2015-02-16 12:47:20 +0000 | [diff] [blame] | 147 | # Make it possible to provide custom locations for some libraries (move these |
| 148 | # up into declare_args should we need to actually use them for the GN build). |
kjellander | e26e787 | 2016-03-04 14:39:28 -0800 | [diff] [blame] | 149 | rtc_libvpx_dir = "//third_party/libvpx" |
kjellander@webrtc.org | ce22f13 | 2015-02-16 12:47:20 +0000 | [diff] [blame] | 150 | rtc_libyuv_dir = "//third_party/libyuv" |
| 151 | rtc_opus_dir = "//third_party/opus" |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame^] | 152 | |
| 153 | ############################################################################### |
| 154 | # Templates |
| 155 | # |
| 156 | |
| 157 | # Points to //webrtc/ in webrtc stand-alone or to //third_party/webrtc/ in |
| 158 | # chromium. |
| 159 | # We need absolute paths for all configs in templates as they are shared in |
| 160 | # different subdirectories. |
| 161 | webrtc_root = get_path_info("../", "abspath") |
| 162 | |
| 163 | # Common configs to remove or add in all rtc targets. |
| 164 | rtc_remove_configs = [] |
| 165 | rtc_add_configs = [] |
| 166 | |
| 167 | set_defaults("rtc_test") { |
| 168 | configs = [] |
| 169 | suppressed_configs = [] |
| 170 | } |
| 171 | |
| 172 | set_defaults("rtc_source_set") { |
| 173 | configs = [] |
| 174 | suppressed_configs = [] |
| 175 | } |
| 176 | |
| 177 | set_defaults("rtc_executable") { |
| 178 | configs = [] |
| 179 | suppressed_configs = [] |
| 180 | } |
| 181 | |
| 182 | set_defaults("rtc_static_library") { |
| 183 | configs = [] |
| 184 | suppressed_configs = [] |
| 185 | } |
| 186 | |
| 187 | template("rtc_test") { |
| 188 | test(target_name) { |
| 189 | forward_variables_from(invoker, |
| 190 | "*", |
| 191 | [ |
| 192 | "configs", |
| 193 | "suppressed_configs", |
| 194 | ]) |
| 195 | configs += invoker.configs |
| 196 | configs += rtc_add_configs |
| 197 | configs -= rtc_remove_configs |
| 198 | configs -= invoker.suppressed_configs |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | template("rtc_source_set") { |
| 203 | source_set(target_name) { |
| 204 | forward_variables_from(invoker, |
| 205 | "*", |
| 206 | [ |
| 207 | "configs", |
| 208 | "suppressed_configs", |
| 209 | ]) |
| 210 | configs += invoker.configs |
| 211 | configs += rtc_add_configs |
| 212 | configs -= rtc_remove_configs |
| 213 | configs -= invoker.suppressed_configs |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | template("rtc_executable") { |
| 218 | executable(target_name) { |
| 219 | forward_variables_from(invoker, |
| 220 | "*", |
| 221 | [ |
| 222 | "configs", |
| 223 | "suppressed_configs", |
| 224 | ]) |
| 225 | configs += invoker.configs |
| 226 | configs += rtc_add_configs |
| 227 | configs -= rtc_remove_configs |
| 228 | configs -= invoker.suppressed_configs |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | template("rtc_static_library") { |
| 233 | static_library(target_name) { |
| 234 | forward_variables_from(invoker, |
| 235 | "*", |
| 236 | [ |
| 237 | "configs", |
| 238 | "suppressed_configs", |
| 239 | ]) |
| 240 | configs += invoker.configs |
| 241 | configs += rtc_add_configs |
| 242 | configs -= rtc_remove_configs |
| 243 | configs -= invoker.suppressed_configs |
| 244 | } |
| 245 | } |