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