hjon | aa32c3e | 2015-12-14 03:58:11 | [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 19:08:33 | [diff] [blame] | 10 | import("//testing/test.gni") |
Sami Kalliomaki | 9c0c75b | 2016-06-29 12:55:00 | [diff] [blame^] | 11 | if (is_android) { |
| 12 | import("//build/config/android/config.gni") |
| 13 | import("//build/config/android/rules.gni") |
| 14 | } |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 15 | |
| 16 | group("api") { |
| 17 | deps = [ |
| 18 | ":libjingle_peerconnection", |
| 19 | ] |
| 20 | } |
| 21 | |
| 22 | config("libjingle_peerconnection_warnings_config") { |
| 23 | # GN orders flags on a target before flags from configs. The default config |
| 24 | # adds these flags so to cancel them out they need to come from a config and |
| 25 | # cannot be on the target directly. |
kjellander | 3e33bfe | 2016-06-20 14:04:09 | [diff] [blame] | 26 | if (!is_win && !is_clang) { |
| 27 | cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 28 | } |
| 29 | } |
| 30 | |
| 31 | source_set("libjingle_peerconnection") { |
| 32 | cflags = [] |
| 33 | sources = [ |
| 34 | "audiotrack.cc", |
| 35 | "audiotrack.h", |
| 36 | "datachannel.cc", |
| 37 | "datachannel.h", |
| 38 | "datachannelinterface.h", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 39 | "dtlsidentitystore.h", |
| 40 | "dtmfsender.cc", |
| 41 | "dtmfsender.h", |
| 42 | "dtmfsenderinterface.h", |
| 43 | "jsep.h", |
| 44 | "jsepicecandidate.cc", |
| 45 | "jsepicecandidate.h", |
| 46 | "jsepsessiondescription.cc", |
| 47 | "jsepsessiondescription.h", |
| 48 | "localaudiosource.cc", |
| 49 | "localaudiosource.h", |
| 50 | "mediaconstraintsinterface.cc", |
| 51 | "mediaconstraintsinterface.h", |
| 52 | "mediacontroller.cc", |
| 53 | "mediacontroller.h", |
| 54 | "mediastream.cc", |
| 55 | "mediastream.h", |
| 56 | "mediastreaminterface.h", |
| 57 | "mediastreamobserver.cc", |
| 58 | "mediastreamobserver.h", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 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 19:08:33 | [diff] [blame] | 109 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 110 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 111 | } |
| 112 | |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 113 | deps = [ |
katrielc | 14897d0 | 2016-06-03 20:14:28 | [diff] [blame] | 114 | "../call", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 115 | "../media", |
| 116 | "../pc", |
| 117 | ] |
| 118 | |
| 119 | if (rtc_use_quic) { |
| 120 | sources += [ |
| 121 | "quicdatachannel.cc", |
| 122 | "quicdatachannel.h", |
| 123 | "quicdatatransport.cc", |
| 124 | "quicdatatransport.h", |
| 125 | ] |
| 126 | deps += [ "//third_party/libquic" ] |
| 127 | public_deps = [ |
| 128 | "//third_party/libquic", |
| 129 | ] |
| 130 | } |
| 131 | } |
kjellander | fd5b4e9 | 2016-06-13 19:08:33 | [diff] [blame] | 132 | |
kjellander | 69b3462 | 2016-06-21 08:05:16 | [diff] [blame] | 133 | # Exclude the targets below from the Chromium build since they cannot be built |
| 134 | # due to incompability with Chromium's logging implementation. |
| 135 | if (is_android && !build_with_chromium) { |
kjellander | fd5b4e9 | 2016-06-13 19:08:33 | [diff] [blame] | 136 | config("libjingle_peerconnection_jni_warnings_config") { |
| 137 | # The warnings below are enabled by default. Since GN orders compiler flags |
| 138 | # for a target before flags from configs, the only way to disable such |
| 139 | # warnings is by having them in a separate config, loaded from the target. |
| 140 | if (!is_win) { |
| 141 | cflags = [ |
| 142 | "-Wno-sign-compare", |
| 143 | "-Wno-unused-variable", |
| 144 | ] |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | source_set("libjingle_peerconnection_jni") { |
| 149 | sources = [ |
| 150 | "androidvideocapturer.cc", |
| 151 | "androidvideocapturer.h", |
| 152 | "java/jni/androidmediacodeccommon.h", |
| 153 | "java/jni/androidmediadecoder_jni.cc", |
| 154 | "java/jni/androidmediadecoder_jni.h", |
| 155 | "java/jni/androidmediaencoder_jni.cc", |
| 156 | "java/jni/androidmediaencoder_jni.h", |
| 157 | "java/jni/androidmetrics_jni.cc", |
| 158 | "java/jni/androidnetworkmonitor_jni.cc", |
| 159 | "java/jni/androidnetworkmonitor_jni.h", |
| 160 | "java/jni/androidvideocapturer_jni.cc", |
| 161 | "java/jni/androidvideocapturer_jni.h", |
| 162 | "java/jni/classreferenceholder.cc", |
| 163 | "java/jni/classreferenceholder.h", |
| 164 | "java/jni/jni_helpers.cc", |
| 165 | "java/jni/jni_helpers.h", |
| 166 | "java/jni/native_handle_impl.cc", |
| 167 | "java/jni/native_handle_impl.h", |
| 168 | "java/jni/peerconnection_jni.cc", |
| 169 | "java/jni/surfacetexturehelper_jni.cc", |
| 170 | "java/jni/surfacetexturehelper_jni.h", |
| 171 | ] |
| 172 | |
| 173 | configs += [ |
| 174 | "..:common_config", |
| 175 | ":libjingle_peerconnection_jni_warnings_config", |
| 176 | ] |
| 177 | public_configs = [ "..:common_inherited_config" ] |
| 178 | |
| 179 | if (is_clang) { |
| 180 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 181 | configs -= [ |
| 182 | "//build/config/clang:extra_warnings", |
| 183 | "//build/config/clang:find_bad_constructs", |
| 184 | ] |
| 185 | } |
| 186 | |
| 187 | # TODO(jschuh): Bug 1348: fix this warning. |
| 188 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 189 | |
| 190 | if (is_win) { |
| 191 | cflags += [ |
| 192 | "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch. |
| 193 | "/wd4389", # signed/unsigned mismatch. |
| 194 | ] |
| 195 | } |
| 196 | |
| 197 | deps = [ |
| 198 | ":libjingle_peerconnection", |
| 199 | "../system_wrappers:field_trial_default", |
| 200 | "../system_wrappers:metrics_default", |
| 201 | ] |
| 202 | |
| 203 | if (rtc_build_libyuv) { |
| 204 | deps += [ "$rtc_libyuv_dir" ] |
| 205 | public_deps = [ |
| 206 | "$rtc_libyuv_dir", |
| 207 | ] |
| 208 | } else { |
| 209 | # Need to add a directory normally exported by libyuv. |
| 210 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 211 | } |
| 212 | } |
Sami Kalliomaki | 9c0c75b | 2016-06-29 12:55:00 | [diff] [blame^] | 213 | |
| 214 | shared_library("libjingle_peerconnection_so") { |
| 215 | sources = [ |
| 216 | "java/jni/jni_onload.cc", |
| 217 | ] |
| 218 | |
| 219 | configs -= [ "//build/config/android:hide_native_jni_exports" ] |
| 220 | |
| 221 | deps = [ |
| 222 | ":libjingle_peerconnection", |
| 223 | ":libjingle_peerconnection_jni", |
| 224 | ] |
| 225 | } |
| 226 | |
| 227 | android_library("libjingle_peerconnection_java") { |
| 228 | java_files = [ |
| 229 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/BuildInfo.java", |
| 230 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java", |
| 231 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java", |
| 232 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java", |
| 233 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java", |
| 234 | "../modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java", |
| 235 | "java/android/org/webrtc/Camera1Enumerator.java", |
| 236 | "java/android/org/webrtc/Camera2Capturer.java", |
| 237 | "java/android/org/webrtc/Camera2Enumerator.java", |
| 238 | "java/android/org/webrtc/CameraEnumerationAndroid.java", |
| 239 | "java/android/org/webrtc/CameraEnumerator.java", |
| 240 | "java/android/org/webrtc/CameraVideoCapturer.java", |
| 241 | "java/android/org/webrtc/EglBase.java", |
| 242 | "java/android/org/webrtc/EglBase10.java", |
| 243 | "java/android/org/webrtc/EglBase14.java", |
| 244 | "java/android/org/webrtc/GlRectDrawer.java", |
| 245 | "java/android/org/webrtc/GlShader.java", |
| 246 | "java/android/org/webrtc/GlTextureFrameBuffer.java", |
| 247 | "java/android/org/webrtc/GlUtil.java", |
| 248 | "java/android/org/webrtc/NetworkMonitor.java", |
| 249 | "java/android/org/webrtc/NetworkMonitorAutoDetect.java", |
| 250 | "java/android/org/webrtc/RendererCommon.java", |
| 251 | "java/android/org/webrtc/SurfaceTextureHelper.java", |
| 252 | "java/android/org/webrtc/SurfaceViewRenderer.java", |
| 253 | "java/android/org/webrtc/VideoCapturerAndroid.java", |
| 254 | "java/android/org/webrtc/VideoRendererGui.java", |
| 255 | "java/src/org/webrtc/AudioSource.java", |
| 256 | "java/src/org/webrtc/AudioTrack.java", |
| 257 | "java/src/org/webrtc/CallSessionFileRotatingLogSink.java", |
| 258 | "java/src/org/webrtc/DataChannel.java", |
| 259 | "java/src/org/webrtc/IceCandidate.java", |
| 260 | "java/src/org/webrtc/MediaCodecVideoDecoder.java", |
| 261 | "java/src/org/webrtc/MediaCodecVideoEncoder.java", |
| 262 | "java/src/org/webrtc/MediaConstraints.java", |
| 263 | "java/src/org/webrtc/MediaSource.java", |
| 264 | "java/src/org/webrtc/MediaStream.java", |
| 265 | "java/src/org/webrtc/MediaStreamTrack.java", |
| 266 | "java/src/org/webrtc/Metrics.java", |
| 267 | "java/src/org/webrtc/PeerConnection.java", |
| 268 | "java/src/org/webrtc/PeerConnectionFactory.java", |
| 269 | "java/src/org/webrtc/RtpParameters.java", |
| 270 | "java/src/org/webrtc/RtpReceiver.java", |
| 271 | "java/src/org/webrtc/RtpSender.java", |
| 272 | "java/src/org/webrtc/SdpObserver.java", |
| 273 | "java/src/org/webrtc/SessionDescription.java", |
| 274 | "java/src/org/webrtc/StatsObserver.java", |
| 275 | "java/src/org/webrtc/StatsReport.java", |
| 276 | "java/src/org/webrtc/VideoCapturer.java", |
| 277 | "java/src/org/webrtc/VideoRenderer.java", |
| 278 | "java/src/org/webrtc/VideoSource.java", |
| 279 | "java/src/org/webrtc/VideoTrack.java", |
| 280 | ] |
| 281 | |
| 282 | deps = [ |
| 283 | "//webrtc/base:base_java", |
| 284 | ] |
| 285 | } |
kjellander | fd5b4e9 | 2016-06-13 19:08:33 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | if (rtc_include_tests) { |
| 289 | config("peerconnection_unittests_config") { |
| 290 | # The warnings below are enabled by default. Since GN orders compiler flags |
| 291 | # for a target before flags from configs, the only way to disable such |
| 292 | # warnings is by having them in a separate config, loaded from the target. |
| 293 | # TODO(kjellander): Make the code compile without disabling these flags. |
| 294 | # See https://bugs.webrtc.org/3307. |
| 295 | if (is_clang && is_win) { |
| 296 | cflags = [ "-Wno-unused-function" ] |
| 297 | } |
| 298 | |
| 299 | if (!is_win) { |
| 300 | cflags = [ "-Wno-sign-compare" ] |
| 301 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | test("peerconnection_unittests") { |
| 306 | testonly = true |
| 307 | sources = [ |
| 308 | "datachannel_unittest.cc", |
| 309 | "dtmfsender_unittest.cc", |
| 310 | "fakemetricsobserver.cc", |
| 311 | "fakemetricsobserver.h", |
| 312 | "jsepsessiondescription_unittest.cc", |
| 313 | "localaudiosource_unittest.cc", |
| 314 | "mediaconstraintsinterface_unittest.cc", |
| 315 | "mediastream_unittest.cc", |
| 316 | "peerconnection_unittest.cc", |
| 317 | "peerconnectionendtoend_unittest.cc", |
| 318 | "peerconnectionfactory_unittest.cc", |
| 319 | "peerconnectioninterface_unittest.cc", |
| 320 | "proxy_unittest.cc", |
| 321 | "rtpsenderreceiver_unittest.cc", |
| 322 | "statscollector_unittest.cc", |
| 323 | "test/fakeaudiocapturemodule.cc", |
| 324 | "test/fakeaudiocapturemodule.h", |
| 325 | "test/fakeaudiocapturemodule_unittest.cc", |
| 326 | "test/fakeconstraints.h", |
| 327 | "test/fakedatachannelprovider.h", |
| 328 | "test/fakeperiodicvideocapturer.h", |
| 329 | "test/fakertccertificategenerator.h", |
| 330 | "test/fakevideotrackrenderer.h", |
| 331 | "test/mockpeerconnectionobservers.h", |
| 332 | "test/peerconnectiontestwrapper.cc", |
| 333 | "test/peerconnectiontestwrapper.h", |
| 334 | "test/testsdpstrings.h", |
| 335 | "videocapturertracksource_unittest.cc", |
| 336 | "videotrack_unittest.cc", |
| 337 | "webrtcsdp_unittest.cc", |
| 338 | "webrtcsession_unittest.cc", |
| 339 | ] |
| 340 | |
| 341 | defines = [ "HAVE_SCTP" ] |
| 342 | |
| 343 | configs += [ |
| 344 | "..:common_config", |
| 345 | ":peerconnection_unittests_config", |
| 346 | ] |
| 347 | public_configs = [ "..:common_inherited_config" ] |
| 348 | |
| 349 | if (is_clang) { |
| 350 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 351 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 352 | } |
| 353 | |
| 354 | # TODO(jschuh): Bug 1348: fix this warning. |
| 355 | configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 356 | |
| 357 | if (is_win) { |
| 358 | cflags = [ |
| 359 | "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. |
| 360 | "/wd4389", # signed/unsigned mismatch. |
| 361 | ] |
| 362 | } |
| 363 | |
| 364 | if (rtc_use_quic) { |
| 365 | public_deps = [ |
| 366 | "//third_party/libquic", |
| 367 | ] |
| 368 | sources += [ |
| 369 | "quicdatachannel_unittest.cc", |
| 370 | "quicdatatransport_unittest.cc", |
| 371 | ] |
| 372 | } |
| 373 | |
| 374 | deps = [] |
| 375 | if (is_android) { |
| 376 | sources += [ |
| 377 | "test/androidtestinitializer.cc", |
| 378 | "test/androidtestinitializer.h", |
| 379 | ] |
| 380 | deps += [ |
| 381 | ":libjingle_peerconnection_jni", |
| 382 | "//testing/android/native_test:native_test_support", |
| 383 | ] |
| 384 | } |
| 385 | |
| 386 | deps += [ |
| 387 | ":libjingle_peerconnection", |
| 388 | "..:webrtc_common", |
| 389 | "../base:rtc_base_tests_utils", |
| 390 | "../media:rtc_unittest_main", |
| 391 | "../pc:rtc_pc", |
| 392 | "../system_wrappers:metrics_default", |
| 393 | "//testing/gmock", |
| 394 | ] |
| 395 | |
| 396 | if (is_android) { |
| 397 | deps += [ "//testing/android/native_test:native_test_support" ] |
| 398 | } |
| 399 | } |
| 400 | } |