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