kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 1 | # Copyright (c) 2016 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 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 9 | import("../webrtc.gni") |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 10 | if (is_android) { |
| 11 | import("//build/config/android/config.gni") |
| 12 | import("//build/config/android/rules.gni") |
| 13 | } |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 14 | |
| 15 | group("pc") { |
kjellander | 705ecc5 | 2016-09-15 00:53:26 -0700 | [diff] [blame] | 16 | public_deps = [ |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 17 | ":rtc_pc", |
| 18 | ] |
| 19 | } |
| 20 | |
| 21 | config("rtc_pc_config") { |
jbauch | eaa9c1d | 2017-03-06 11:32:22 -0800 | [diff] [blame] | 22 | defines = [] |
deadbeef | 40610e2 | 2016-12-22 10:53:38 -0800 | [diff] [blame] | 23 | if (rtc_enable_sctp) { |
| 24 | defines += [ "HAVE_SCTP" ] |
| 25 | } |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 26 | } |
| 27 | |
kjellander | b62dbbe | 2016-09-23 00:38:52 -0700 | [diff] [blame] | 28 | rtc_static_library("rtc_pc") { |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 29 | defines = [] |
| 30 | sources = [ |
| 31 | "audiomonitor.cc", |
| 32 | "audiomonitor.h", |
| 33 | "bundlefilter.cc", |
| 34 | "bundlefilter.h", |
| 35 | "channel.cc", |
| 36 | "channel.h", |
| 37 | "channelmanager.cc", |
| 38 | "channelmanager.h", |
| 39 | "currentspeakermonitor.cc", |
| 40 | "currentspeakermonitor.h", |
jbauch | dfcab72 | 2017-03-06 00:14:10 -0800 | [diff] [blame] | 41 | "externalhmac.cc", |
| 42 | "externalhmac.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 43 | "mediamonitor.cc", |
| 44 | "mediamonitor.h", |
| 45 | "mediasession.cc", |
| 46 | "mediasession.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 47 | "rtcpmuxfilter.cc", |
| 48 | "rtcpmuxfilter.h", |
zstein | d48dbda | 2017-04-04 19:45:57 -0700 | [diff] [blame] | 49 | "rtptransport.cc", |
| 50 | "rtptransport.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 51 | "srtpfilter.cc", |
| 52 | "srtpfilter.h", |
| 53 | "voicechannel.h", |
| 54 | ] |
| 55 | |
| 56 | deps = [ |
kjellander | a69d973 | 2016-08-31 07:33:05 -0700 | [diff] [blame] | 57 | "../api:call_api", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 58 | "../base:rtc_base", |
| 59 | "../media", |
| 60 | ] |
| 61 | |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 62 | if (rtc_build_libsrtp) { |
| 63 | deps += [ "//third_party/libsrtp" ] |
| 64 | } |
| 65 | |
ehmaldonado | e9cc686 | 2016-09-05 06:10:18 -0700 | [diff] [blame] | 66 | public_configs = [ ":rtc_pc_config" ] |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 67 | |
kjellander | e40a7ee | 2016-10-16 23:56:12 -0700 | [diff] [blame] | 68 | if (!build_with_chromium && is_clang) { |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 69 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame] | 70 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 71 | } |
| 72 | } |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 73 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 74 | config("libjingle_peerconnection_warnings_config") { |
| 75 | # GN orders flags on a target before flags from configs. The default config |
| 76 | # adds these flags so to cancel them out they need to come from a config and |
| 77 | # cannot be on the target directly. |
| 78 | if (!is_win && !is_clang) { |
| 79 | cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | rtc_static_library("libjingle_peerconnection") { |
| 84 | check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828) |
| 85 | cflags = [] |
| 86 | sources = [ |
| 87 | "audiotrack.cc", |
| 88 | "audiotrack.h", |
| 89 | "datachannel.cc", |
| 90 | "datachannel.h", |
| 91 | "dtmfsender.cc", |
| 92 | "dtmfsender.h", |
deadbeef | 1dcb164 | 2017-03-29 21:08:16 -0700 | [diff] [blame] | 93 | "iceserverparsing.cc", |
| 94 | "iceserverparsing.h", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 95 | "jsepicecandidate.cc", |
| 96 | "jsepsessiondescription.cc", |
| 97 | "localaudiosource.cc", |
| 98 | "localaudiosource.h", |
| 99 | "mediacontroller.cc", |
| 100 | "mediacontroller.h", |
| 101 | "mediastream.cc", |
| 102 | "mediastream.h", |
| 103 | "mediastreamobserver.cc", |
| 104 | "mediastreamobserver.h", |
| 105 | "mediastreamtrack.h", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 106 | "peerconnection.cc", |
| 107 | "peerconnection.h", |
| 108 | "peerconnectionfactory.cc", |
| 109 | "peerconnectionfactory.h", |
| 110 | "remoteaudiosource.cc", |
| 111 | "remoteaudiosource.h", |
| 112 | "rtcstatscollector.cc", |
| 113 | "rtcstatscollector.h", |
| 114 | "rtpreceiver.cc", |
| 115 | "rtpreceiver.h", |
| 116 | "rtpsender.cc", |
| 117 | "rtpsender.h", |
| 118 | "sctputils.cc", |
| 119 | "sctputils.h", |
| 120 | "statscollector.cc", |
| 121 | "statscollector.h", |
| 122 | "streamcollection.h", |
deadbeef | 804c1af | 2017-02-11 19:07:31 -0800 | [diff] [blame] | 123 | "trackmediainfomap.cc", |
| 124 | "trackmediainfomap.h", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 125 | "videocapturertracksource.cc", |
| 126 | "videocapturertracksource.h", |
| 127 | "videotrack.cc", |
| 128 | "videotrack.h", |
| 129 | "videotracksource.cc", |
| 130 | "videotracksource.h", |
| 131 | "webrtcsdp.cc", |
| 132 | "webrtcsdp.h", |
| 133 | "webrtcsession.cc", |
| 134 | "webrtcsession.h", |
| 135 | "webrtcsessiondescriptionfactory.cc", |
| 136 | "webrtcsessiondescriptionfactory.h", |
| 137 | ] |
| 138 | |
| 139 | configs += [ ":libjingle_peerconnection_warnings_config" ] |
| 140 | |
| 141 | if (!build_with_chromium && is_clang) { |
| 142 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 143 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 144 | } |
| 145 | |
| 146 | deps = [ |
| 147 | ":rtc_pc", |
| 148 | "../api:call_api", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 149 | "../api:rtc_stats_api", |
ilnik | d60d06a | 2017-04-05 03:02:20 -0700 | [diff] [blame^] | 150 | "../api/video_codecs:video_codecs_api", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 151 | "../call", |
| 152 | "../media", |
| 153 | "../stats", |
| 154 | ] |
| 155 | |
ossu | da25006 | 2017-01-23 07:37:43 -0800 | [diff] [blame] | 156 | public_deps = [ |
| 157 | "../api:libjingle_peerconnection_api", |
| 158 | ] |
| 159 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 160 | if (rtc_use_quic) { |
| 161 | sources += [ |
| 162 | "quicdatachannel.cc", |
| 163 | "quicdatachannel.h", |
| 164 | "quicdatatransport.cc", |
| 165 | "quicdatatransport.h", |
| 166 | ] |
| 167 | deps += [ "//third_party/libquic" ] |
| 168 | public_deps = [ |
| 169 | "//third_party/libquic", |
| 170 | ] |
| 171 | } |
| 172 | } |
| 173 | |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 174 | if (rtc_include_tests) { |
| 175 | config("rtc_pc_unittests_config") { |
| 176 | # GN orders flags on a target before flags from configs. The default config |
| 177 | # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 178 | # come from a config and can't be on the target directly. |
| 179 | if (!is_win && !is_clang) { |
| 180 | cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. |
| 181 | } |
| 182 | } |
| 183 | |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame] | 184 | rtc_test("rtc_pc_unittests") { |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 185 | testonly = true |
| 186 | |
| 187 | sources = [ |
| 188 | "bundlefilter_unittest.cc", |
| 189 | "channel_unittest.cc", |
| 190 | "channelmanager_unittest.cc", |
| 191 | "currentspeakermonitor_unittest.cc", |
| 192 | "mediasession_unittest.cc", |
| 193 | "rtcpmuxfilter_unittest.cc", |
| 194 | "srtpfilter_unittest.cc", |
| 195 | ] |
| 196 | |
| 197 | include_dirs = [ "//third_party/libsrtp/srtp" ] |
| 198 | |
ehmaldonado | 7a2ce0b | 2016-09-05 01:35:44 -0700 | [diff] [blame] | 199 | configs += [ ":rtc_pc_unittests_config" ] |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 200 | |
kjellander | e40a7ee | 2016-10-16 23:56:12 -0700 | [diff] [blame] | 201 | if (!build_with_chromium && is_clang) { |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 202 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame] | 203 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | if (is_win) { |
| 207 | libs = [ "strmiids.lib" ] |
| 208 | } |
| 209 | |
| 210 | deps = [ |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 211 | ":libjingle_peerconnection", |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 212 | ":rtc_pc", |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 213 | "../base:rtc_base_tests_utils", |
| 214 | "../media:rtc_unittest_main", |
| 215 | "../system_wrappers:metrics_default", |
| 216 | ] |
| 217 | |
| 218 | if (rtc_build_libsrtp) { |
| 219 | deps += [ "//third_party/libsrtp" ] |
| 220 | } |
| 221 | |
| 222 | if (is_android) { |
| 223 | deps += [ "//testing/android/native_test:native_test_support" ] |
| 224 | } |
| 225 | } |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 226 | |
deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 227 | rtc_source_set("pc_test_utils") { |
| 228 | testonly = true |
| 229 | sources = [ |
| 230 | "test/fakeaudiocapturemodule.cc", |
| 231 | "test/fakeaudiocapturemodule.h", |
| 232 | "test/fakedatachannelprovider.h", |
| 233 | "test/fakeperiodicvideocapturer.h", |
| 234 | "test/fakertccertificategenerator.h", |
| 235 | "test/fakevideotrackrenderer.h", |
| 236 | "test/fakevideotracksource.h", |
| 237 | "test/mock_datachannel.h", |
| 238 | "test/mock_peerconnection.h", |
| 239 | "test/mock_webrtcsession.h", |
| 240 | "test/mockpeerconnectionobservers.h", |
| 241 | "test/peerconnectiontestwrapper.cc", |
| 242 | "test/peerconnectiontestwrapper.h", |
| 243 | "test/rtcstatsobtainer.h", |
| 244 | "test/testsdpstrings.h", |
| 245 | ] |
| 246 | |
| 247 | deps = [ |
| 248 | ":libjingle_peerconnection", |
| 249 | "../base:rtc_base_tests_utils", |
| 250 | "//testing/gmock", |
| 251 | ] |
| 252 | |
| 253 | if (!build_with_chromium && is_clang) { |
| 254 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 255 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 256 | } |
| 257 | } |
| 258 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 259 | config("peerconnection_unittests_config") { |
| 260 | # The warnings below are enabled by default. Since GN orders compiler flags |
| 261 | # for a target before flags from configs, the only way to disable such |
| 262 | # warnings is by having them in a separate config, loaded from the target. |
| 263 | # TODO(kjellander): Make the code compile without disabling these flags. |
| 264 | # See https://bugs.webrtc.org/3307. |
| 265 | if (is_clang && is_win) { |
| 266 | cflags = [ |
| 267 | # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267 |
| 268 | # for -Wno-sign-compare |
| 269 | "-Wno-sign-compare", |
| 270 | "-Wno-unused-function", |
| 271 | ] |
| 272 | } |
| 273 | |
| 274 | if (!is_win) { |
| 275 | cflags = [ "-Wno-sign-compare" ] |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | rtc_test("peerconnection_unittests") { |
| 280 | check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828) |
| 281 | testonly = true |
| 282 | sources = [ |
| 283 | "datachannel_unittest.cc", |
| 284 | "dtmfsender_unittest.cc", |
| 285 | "fakemediacontroller.h", |
deadbeef | 1dcb164 | 2017-03-29 21:08:16 -0700 | [diff] [blame] | 286 | "iceserverparsing_unittest.cc", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 287 | "jsepsessiondescription_unittest.cc", |
| 288 | "localaudiosource_unittest.cc", |
| 289 | "mediaconstraintsinterface_unittest.cc", |
| 290 | "mediastream_unittest.cc", |
deadbeef | 1dcb164 | 2017-03-29 21:08:16 -0700 | [diff] [blame] | 291 | "peerconnection_integrationtest.cc", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 292 | "peerconnectionendtoend_unittest.cc", |
| 293 | "peerconnectionfactory_unittest.cc", |
| 294 | "peerconnectioninterface_unittest.cc", |
| 295 | "proxy_unittest.cc", |
| 296 | "rtcstats_integrationtest.cc", |
| 297 | "rtcstatscollector_unittest.cc", |
| 298 | "rtpsenderreceiver_unittest.cc", |
| 299 | "sctputils_unittest.cc", |
| 300 | "statscollector_unittest.cc", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 301 | "test/fakeaudiocapturemodule_unittest.cc", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 302 | "test/testsdpstrings.h", |
deadbeef | 804c1af | 2017-02-11 19:07:31 -0800 | [diff] [blame] | 303 | "trackmediainfomap_unittest.cc", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 304 | "videocapturertracksource_unittest.cc", |
| 305 | "videotrack_unittest.cc", |
| 306 | "webrtcsdp_unittest.cc", |
| 307 | "webrtcsession_unittest.cc", |
| 308 | ] |
| 309 | |
| 310 | if (rtc_enable_sctp) { |
| 311 | defines = [ "HAVE_SCTP" ] |
| 312 | } |
| 313 | |
| 314 | configs += [ ":peerconnection_unittests_config" ] |
| 315 | |
| 316 | if (!build_with_chromium && is_clang) { |
| 317 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 318 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 319 | } |
| 320 | |
| 321 | # TODO(jschuh): Bug 1348: fix this warning. |
| 322 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 323 | |
| 324 | if (is_win) { |
| 325 | cflags = [ |
| 326 | "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. |
| 327 | "/wd4389", # signed/unsigned mismatch. |
| 328 | ] |
| 329 | } |
| 330 | |
| 331 | if (rtc_use_quic) { |
| 332 | public_deps = [ |
| 333 | "//third_party/libquic", |
| 334 | ] |
| 335 | sources += [ |
| 336 | "quicdatachannel_unittest.cc", |
| 337 | "quicdatatransport_unittest.cc", |
| 338 | ] |
| 339 | } |
| 340 | |
| 341 | deps = [] |
| 342 | if (is_android) { |
| 343 | sources += [ |
| 344 | "test/androidtestinitializer.cc", |
| 345 | "test/androidtestinitializer.h", |
| 346 | ] |
| 347 | deps += [ |
| 348 | "//testing/android/native_test:native_test_support", |
| 349 | "//webrtc/sdk/android:libjingle_peerconnection_java", |
| 350 | "//webrtc/sdk/android:libjingle_peerconnection_jni", |
| 351 | ] |
| 352 | } |
| 353 | |
| 354 | deps += [ |
| 355 | ":libjingle_peerconnection", |
deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 356 | ":pc_test_utils", |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 357 | "..:webrtc_common", |
| 358 | "../api:fakemetricsobserver", |
| 359 | "../base:rtc_base_tests_utils", |
| 360 | "../media:rtc_unittest_main", |
| 361 | "../pc:rtc_pc", |
| 362 | "../system_wrappers:metrics_default", |
| 363 | "//testing/gmock", |
| 364 | ] |
| 365 | |
| 366 | if (is_android) { |
| 367 | deps += [ "//testing/android/native_test:native_test_support" ] |
| 368 | |
| 369 | shard_timeout = 900 |
| 370 | } |
| 371 | } |
kjellander | 142f8c5 | 2016-06-13 00:08:24 -0700 | [diff] [blame] | 372 | } |