diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn index ecef934a3e..cb3066eae6 100644 --- a/webrtc/api/BUILD.gn +++ b/webrtc/api/BUILD.gn @@ -7,6 +7,7 @@ # be found in the AUTHORS file in the root of the source tree. import("../build/webrtc.gni") +import("//testing/test.gni") group("api") { deps = [ @@ -105,9 +106,7 @@ source_set("libjingle_peerconnection") { public_configs = [ "..:common_inherited_config" ] if (is_clang) { - # Suppress warnings from Chrome's Clang plugins. - # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. - configs -= [ "//build/config/clang:extra_warnings" ] + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). configs -= [ "//build/config/clang:find_bad_constructs" ] } @@ -134,3 +133,197 @@ source_set("libjingle_peerconnection") { ] } } + +if (is_android) { + config("libjingle_peerconnection_jni_warnings_config") { + # The warnings below are enabled by default. Since GN orders compiler flags + # for a target before flags from configs, the only way to disable such + # warnings is by having them in a separate config, loaded from the target. + if (!is_win) { + cflags = [ + "-Wno-sign-compare", + "-Wno-unused-variable", + ] + } + } + + source_set("libjingle_peerconnection_jni") { + sources = [ + "androidvideocapturer.cc", + "androidvideocapturer.h", + "java/jni/androidmediacodeccommon.h", + "java/jni/androidmediadecoder_jni.cc", + "java/jni/androidmediadecoder_jni.h", + "java/jni/androidmediaencoder_jni.cc", + "java/jni/androidmediaencoder_jni.h", + "java/jni/androidmetrics_jni.cc", + "java/jni/androidnetworkmonitor_jni.cc", + "java/jni/androidnetworkmonitor_jni.h", + "java/jni/androidvideocapturer_jni.cc", + "java/jni/androidvideocapturer_jni.h", + "java/jni/classreferenceholder.cc", + "java/jni/classreferenceholder.h", + "java/jni/jni_helpers.cc", + "java/jni/jni_helpers.h", + "java/jni/native_handle_impl.cc", + "java/jni/native_handle_impl.h", + "java/jni/peerconnection_jni.cc", + "java/jni/surfacetexturehelper_jni.cc", + "java/jni/surfacetexturehelper_jni.h", + ] + + configs += [ + "..:common_config", + ":libjingle_peerconnection_jni_warnings_config", + ] + public_configs = [ "..:common_inherited_config" ] + + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ + "//build/config/clang:extra_warnings", + "//build/config/clang:find_bad_constructs", + ] + } + + # TODO(jschuh): Bug 1348: fix this warning. + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + + if (is_win) { + cflags += [ + "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch. + "/wd4389", # signed/unsigned mismatch. + ] + } + + deps = [ + ":libjingle_peerconnection", + "../system_wrappers:field_trial_default", + "../system_wrappers:metrics_default", + ] + + if (rtc_build_libyuv) { + deps += [ "$rtc_libyuv_dir" ] + public_deps = [ + "$rtc_libyuv_dir", + ] + } else { + # Need to add a directory normally exported by libyuv. + include_dirs += [ "$rtc_libyuv_dir/include" ] + } + } +} + +if (rtc_include_tests) { + config("peerconnection_unittests_config") { + # The warnings below are enabled by default. Since GN orders compiler flags + # for a target before flags from configs, the only way to disable such + # warnings is by having them in a separate config, loaded from the target. + # TODO(kjellander): Make the code compile without disabling these flags. + # See https://bugs.webrtc.org/3307. + if (is_clang && is_win) { + cflags = [ "-Wno-unused-function" ] + } + + if (!is_win) { + cflags = [ "-Wno-sign-compare" ] + cflags_cc = [ "-Wno-overloaded-virtual" ] + } + } + + test("peerconnection_unittests") { + testonly = true + sources = [ + "datachannel_unittest.cc", + "dtmfsender_unittest.cc", + "fakemetricsobserver.cc", + "fakemetricsobserver.h", + "jsepsessiondescription_unittest.cc", + "localaudiosource_unittest.cc", + "mediaconstraintsinterface_unittest.cc", + "mediastream_unittest.cc", + "peerconnection_unittest.cc", + "peerconnectionendtoend_unittest.cc", + "peerconnectionfactory_unittest.cc", + "peerconnectioninterface_unittest.cc", + "proxy_unittest.cc", + "rtpsenderreceiver_unittest.cc", + "statscollector_unittest.cc", + "test/fakeaudiocapturemodule.cc", + "test/fakeaudiocapturemodule.h", + "test/fakeaudiocapturemodule_unittest.cc", + "test/fakeconstraints.h", + "test/fakedatachannelprovider.h", + "test/fakeperiodicvideocapturer.h", + "test/fakertccertificategenerator.h", + "test/fakevideotrackrenderer.h", + "test/mockpeerconnectionobservers.h", + "test/peerconnectiontestwrapper.cc", + "test/peerconnectiontestwrapper.h", + "test/testsdpstrings.h", + "videocapturertracksource_unittest.cc", + "videotrack_unittest.cc", + "webrtcsdp_unittest.cc", + "webrtcsession_unittest.cc", + ] + + defines = [ "HAVE_SCTP" ] + + configs += [ + "..:common_config", + ":peerconnection_unittests_config", + ] + public_configs = [ "..:common_inherited_config" ] + + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + + # TODO(jschuh): Bug 1348: fix this warning. + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + + if (is_win) { + cflags = [ + "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. + "/wd4389", # signed/unsigned mismatch. + ] + } + + if (rtc_use_quic) { + public_deps = [ + "//third_party/libquic", + ] + sources += [ + "quicdatachannel_unittest.cc", + "quicdatatransport_unittest.cc", + ] + } + + deps = [] + if (is_android) { + sources += [ + "test/androidtestinitializer.cc", + "test/androidtestinitializer.h", + ] + deps += [ + ":libjingle_peerconnection_jni", + "//testing/android/native_test:native_test_support", + ] + } + + deps += [ + ":libjingle_peerconnection", + "..:webrtc_common", + "../base:rtc_base_tests_utils", + "../media:rtc_unittest_main", + "../pc:rtc_pc", + "../system_wrappers:metrics_default", + "//testing/gmock", + ] + + if (is_android) { + deps += [ "//testing/android/native_test:native_test_support" ] + } + } +} diff --git a/webrtc/api/api_tests.gyp b/webrtc/api/api_tests.gyp index 9e3a07490f..303c1ef72a 100644 --- a/webrtc/api/api_tests.gyp +++ b/webrtc/api/api_tests.gyp @@ -21,11 +21,6 @@ '<(webrtc_root)/pc/pc.gyp:rtc_pc', '<(webrtc_root)/system_wrappers/system_wrappers.gyp:metrics_default', ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(DEPTH)/testing/gmock/include', - ], - }, 'defines': [ # Feature selection. 'HAVE_SCTP',