hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 1 | # Copyright (c) 2015 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/webrtc.gni") |
kjellander | fd5b4e9 | 2016-06-13 12:08:33 -0700 | [diff] [blame] | 10 | import("//testing/test.gni") |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 11 | |
| 12 | group("api") { |
| 13 | deps = [ |
| 14 | ":libjingle_peerconnection", |
| 15 | ] |
| 16 | } |
| 17 | |
| 18 | config("libjingle_peerconnection_warnings_config") { |
| 19 | # GN orders flags on a target before flags from configs. The default config |
| 20 | # adds these flags so to cancel them out they need to come from a config and |
| 21 | # cannot be on the target directly. |
| 22 | if (!is_win) { |
| 23 | cflags = [ "-Wno-sign-compare" ] |
| 24 | if (!is_clang) { |
| 25 | cflags += [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | source_set("libjingle_peerconnection") { |
| 31 | cflags = [] |
| 32 | sources = [ |
| 33 | "audiotrack.cc", |
| 34 | "audiotrack.h", |
| 35 | "datachannel.cc", |
| 36 | "datachannel.h", |
| 37 | "datachannelinterface.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 38 | "dtlsidentitystore.h", |
| 39 | "dtmfsender.cc", |
| 40 | "dtmfsender.h", |
| 41 | "dtmfsenderinterface.h", |
| 42 | "jsep.h", |
| 43 | "jsepicecandidate.cc", |
| 44 | "jsepicecandidate.h", |
| 45 | "jsepsessiondescription.cc", |
| 46 | "jsepsessiondescription.h", |
| 47 | "localaudiosource.cc", |
| 48 | "localaudiosource.h", |
| 49 | "mediaconstraintsinterface.cc", |
| 50 | "mediaconstraintsinterface.h", |
| 51 | "mediacontroller.cc", |
| 52 | "mediacontroller.h", |
| 53 | "mediastream.cc", |
| 54 | "mediastream.h", |
| 55 | "mediastreaminterface.h", |
| 56 | "mediastreamobserver.cc", |
| 57 | "mediastreamobserver.h", |
| 58 | "mediastreamprovider.h", |
| 59 | "mediastreamproxy.h", |
| 60 | "mediastreamtrack.h", |
| 61 | "mediastreamtrackproxy.h", |
| 62 | "notifier.h", |
| 63 | "peerconnection.cc", |
| 64 | "peerconnection.h", |
| 65 | "peerconnectionfactory.cc", |
| 66 | "peerconnectionfactory.h", |
| 67 | "peerconnectionfactoryproxy.h", |
| 68 | "peerconnectioninterface.h", |
| 69 | "peerconnectionproxy.h", |
| 70 | "proxy.h", |
| 71 | "remoteaudiosource.cc", |
| 72 | "remoteaudiosource.h", |
| 73 | "rtpparameters.h", |
| 74 | "rtpreceiver.cc", |
| 75 | "rtpreceiver.h", |
| 76 | "rtpreceiverinterface.h", |
| 77 | "rtpsender.cc", |
| 78 | "rtpsender.h", |
| 79 | "rtpsenderinterface.h", |
| 80 | "sctputils.cc", |
| 81 | "sctputils.h", |
| 82 | "statscollector.cc", |
| 83 | "statscollector.h", |
| 84 | "statstypes.cc", |
| 85 | "statstypes.h", |
| 86 | "streamcollection.h", |
| 87 | "videocapturertracksource.cc", |
| 88 | "videocapturertracksource.h", |
| 89 | "videosourceproxy.h", |
| 90 | "videotrack.cc", |
| 91 | "videotrack.h", |
| 92 | "videotracksource.cc", |
| 93 | "videotracksource.h", |
| 94 | "webrtcsdp.cc", |
| 95 | "webrtcsdp.h", |
| 96 | "webrtcsession.cc", |
| 97 | "webrtcsession.h", |
| 98 | "webrtcsessiondescriptionfactory.cc", |
| 99 | "webrtcsessiondescriptionfactory.h", |
| 100 | ] |
| 101 | |
| 102 | configs += [ |
| 103 | "..:common_config", |
| 104 | ":libjingle_peerconnection_warnings_config", |
| 105 | ] |
| 106 | public_configs = [ "..:common_inherited_config" ] |
| 107 | |
| 108 | if (is_clang) { |
kjellander | fd5b4e9 | 2016-06-13 12:08:33 -0700 | [diff] [blame] | 109 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 110 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 111 | } |
| 112 | |
| 113 | if (is_win) { |
| 114 | cflags += [ "/wd4389" ] # signed/unsigned mismatch. |
| 115 | } |
| 116 | |
| 117 | deps = [ |
katrielc | 14897d0 | 2016-06-03 13:14:28 -0700 | [diff] [blame] | 118 | "../call", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 119 | "../media", |
| 120 | "../pc", |
| 121 | ] |
| 122 | |
| 123 | if (rtc_use_quic) { |
| 124 | sources += [ |
| 125 | "quicdatachannel.cc", |
| 126 | "quicdatachannel.h", |
| 127 | "quicdatatransport.cc", |
| 128 | "quicdatatransport.h", |
| 129 | ] |
| 130 | deps += [ "//third_party/libquic" ] |
| 131 | public_deps = [ |
| 132 | "//third_party/libquic", |
| 133 | ] |
| 134 | } |
| 135 | } |
kjellander | fd5b4e9 | 2016-06-13 12:08:33 -0700 | [diff] [blame] | 136 | |
| 137 | if (is_android) { |
| 138 | config("libjingle_peerconnection_jni_warnings_config") { |
| 139 | # The warnings below are enabled by default. Since GN orders compiler flags |
| 140 | # for a target before flags from configs, the only way to disable such |
| 141 | # warnings is by having them in a separate config, loaded from the target. |
| 142 | if (!is_win) { |
| 143 | cflags = [ |
| 144 | "-Wno-sign-compare", |
| 145 | "-Wno-unused-variable", |
| 146 | ] |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | source_set("libjingle_peerconnection_jni") { |
| 151 | sources = [ |
| 152 | "androidvideocapturer.cc", |
| 153 | "androidvideocapturer.h", |
| 154 | "java/jni/androidmediacodeccommon.h", |
| 155 | "java/jni/androidmediadecoder_jni.cc", |
| 156 | "java/jni/androidmediadecoder_jni.h", |
| 157 | "java/jni/androidmediaencoder_jni.cc", |
| 158 | "java/jni/androidmediaencoder_jni.h", |
| 159 | "java/jni/androidmetrics_jni.cc", |
| 160 | "java/jni/androidnetworkmonitor_jni.cc", |
| 161 | "java/jni/androidnetworkmonitor_jni.h", |
| 162 | "java/jni/androidvideocapturer_jni.cc", |
| 163 | "java/jni/androidvideocapturer_jni.h", |
| 164 | "java/jni/classreferenceholder.cc", |
| 165 | "java/jni/classreferenceholder.h", |
| 166 | "java/jni/jni_helpers.cc", |
| 167 | "java/jni/jni_helpers.h", |
| 168 | "java/jni/native_handle_impl.cc", |
| 169 | "java/jni/native_handle_impl.h", |
| 170 | "java/jni/peerconnection_jni.cc", |
| 171 | "java/jni/surfacetexturehelper_jni.cc", |
| 172 | "java/jni/surfacetexturehelper_jni.h", |
| 173 | ] |
| 174 | |
| 175 | configs += [ |
| 176 | "..:common_config", |
| 177 | ":libjingle_peerconnection_jni_warnings_config", |
| 178 | ] |
| 179 | public_configs = [ "..:common_inherited_config" ] |
| 180 | |
| 181 | if (is_clang) { |
| 182 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 183 | configs -= [ |
| 184 | "//build/config/clang:extra_warnings", |
| 185 | "//build/config/clang:find_bad_constructs", |
| 186 | ] |
| 187 | } |
| 188 | |
| 189 | # TODO(jschuh): Bug 1348: fix this warning. |
| 190 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 191 | |
| 192 | if (is_win) { |
| 193 | cflags += [ |
| 194 | "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch. |
| 195 | "/wd4389", # signed/unsigned mismatch. |
| 196 | ] |
| 197 | } |
| 198 | |
| 199 | deps = [ |
| 200 | ":libjingle_peerconnection", |
| 201 | "../system_wrappers:field_trial_default", |
| 202 | "../system_wrappers:metrics_default", |
| 203 | ] |
| 204 | |
| 205 | if (rtc_build_libyuv) { |
| 206 | deps += [ "$rtc_libyuv_dir" ] |
| 207 | public_deps = [ |
| 208 | "$rtc_libyuv_dir", |
| 209 | ] |
| 210 | } else { |
| 211 | # Need to add a directory normally exported by libyuv. |
| 212 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | if (rtc_include_tests) { |
| 218 | config("peerconnection_unittests_config") { |
| 219 | # The warnings below are enabled by default. Since GN orders compiler flags |
| 220 | # for a target before flags from configs, the only way to disable such |
| 221 | # warnings is by having them in a separate config, loaded from the target. |
| 222 | # TODO(kjellander): Make the code compile without disabling these flags. |
| 223 | # See https://bugs.webrtc.org/3307. |
| 224 | if (is_clang && is_win) { |
| 225 | cflags = [ "-Wno-unused-function" ] |
| 226 | } |
| 227 | |
| 228 | if (!is_win) { |
| 229 | cflags = [ "-Wno-sign-compare" ] |
| 230 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | test("peerconnection_unittests") { |
| 235 | testonly = true |
| 236 | sources = [ |
| 237 | "datachannel_unittest.cc", |
| 238 | "dtmfsender_unittest.cc", |
| 239 | "fakemetricsobserver.cc", |
| 240 | "fakemetricsobserver.h", |
| 241 | "jsepsessiondescription_unittest.cc", |
| 242 | "localaudiosource_unittest.cc", |
| 243 | "mediaconstraintsinterface_unittest.cc", |
| 244 | "mediastream_unittest.cc", |
| 245 | "peerconnection_unittest.cc", |
| 246 | "peerconnectionendtoend_unittest.cc", |
| 247 | "peerconnectionfactory_unittest.cc", |
| 248 | "peerconnectioninterface_unittest.cc", |
| 249 | "proxy_unittest.cc", |
| 250 | "rtpsenderreceiver_unittest.cc", |
| 251 | "statscollector_unittest.cc", |
| 252 | "test/fakeaudiocapturemodule.cc", |
| 253 | "test/fakeaudiocapturemodule.h", |
| 254 | "test/fakeaudiocapturemodule_unittest.cc", |
| 255 | "test/fakeconstraints.h", |
| 256 | "test/fakedatachannelprovider.h", |
| 257 | "test/fakeperiodicvideocapturer.h", |
| 258 | "test/fakertccertificategenerator.h", |
| 259 | "test/fakevideotrackrenderer.h", |
| 260 | "test/mockpeerconnectionobservers.h", |
| 261 | "test/peerconnectiontestwrapper.cc", |
| 262 | "test/peerconnectiontestwrapper.h", |
| 263 | "test/testsdpstrings.h", |
| 264 | "videocapturertracksource_unittest.cc", |
| 265 | "videotrack_unittest.cc", |
| 266 | "webrtcsdp_unittest.cc", |
| 267 | "webrtcsession_unittest.cc", |
| 268 | ] |
| 269 | |
| 270 | defines = [ "HAVE_SCTP" ] |
| 271 | |
| 272 | configs += [ |
| 273 | "..:common_config", |
| 274 | ":peerconnection_unittests_config", |
| 275 | ] |
| 276 | public_configs = [ "..:common_inherited_config" ] |
| 277 | |
| 278 | if (is_clang) { |
| 279 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 280 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 281 | } |
| 282 | |
| 283 | # TODO(jschuh): Bug 1348: fix this warning. |
| 284 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 285 | |
| 286 | if (is_win) { |
| 287 | cflags = [ |
| 288 | "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. |
| 289 | "/wd4389", # signed/unsigned mismatch. |
| 290 | ] |
| 291 | } |
| 292 | |
| 293 | if (rtc_use_quic) { |
| 294 | public_deps = [ |
| 295 | "//third_party/libquic", |
| 296 | ] |
| 297 | sources += [ |
| 298 | "quicdatachannel_unittest.cc", |
| 299 | "quicdatatransport_unittest.cc", |
| 300 | ] |
| 301 | } |
| 302 | |
| 303 | deps = [] |
| 304 | if (is_android) { |
| 305 | sources += [ |
| 306 | "test/androidtestinitializer.cc", |
| 307 | "test/androidtestinitializer.h", |
| 308 | ] |
| 309 | deps += [ |
| 310 | ":libjingle_peerconnection_jni", |
| 311 | "//testing/android/native_test:native_test_support", |
| 312 | ] |
| 313 | } |
| 314 | |
| 315 | deps += [ |
| 316 | ":libjingle_peerconnection", |
| 317 | "..:webrtc_common", |
| 318 | "../base:rtc_base_tests_utils", |
| 319 | "../media:rtc_unittest_main", |
| 320 | "../pc:rtc_pc", |
| 321 | "../system_wrappers:metrics_default", |
| 322 | "//testing/gmock", |
| 323 | ] |
| 324 | |
| 325 | if (is_android) { |
| 326 | deps += [ "//testing/android/native_test:native_test_support" ] |
| 327 | } |
| 328 | } |
| 329 | } |