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 | |
| 9 | import("//build/config/linux/pkg_config.gni") |
| 10 | import("../build/webrtc.gni") |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 11 | import("//testing/test.gni") |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 12 | |
| 13 | group("media") { |
| 14 | deps = [ |
| 15 | ":rtc_media", |
| 16 | ] |
| 17 | } |
| 18 | |
| 19 | config("rtc_media_defines_config") { |
| 20 | defines = [ |
| 21 | "HAVE_WEBRTC_VIDEO", |
| 22 | "HAVE_WEBRTC_VOICE", |
| 23 | ] |
| 24 | } |
| 25 | |
| 26 | config("rtc_media_warnings_config") { |
| 27 | # GN orders flags on a target before flags from configs. The default config |
| 28 | # adds these flags so to cancel them out they need to come from a config and |
| 29 | # cannot be on the target directly. |
| 30 | if (!is_win) { |
| 31 | cflags = [ "-Wno-deprecated-declarations" ] |
| 32 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | if (is_linux && rtc_use_gtk) { |
| 37 | pkg_config("gtk-lib") { |
| 38 | packages = [ |
| 39 | "gobject-2.0", |
| 40 | "gthread-2.0", |
| 41 | "gtk+-2.0", |
| 42 | ] |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | source_set("rtc_media") { |
| 47 | defines = [] |
| 48 | libs = [] |
| 49 | deps = [] |
| 50 | sources = [ |
| 51 | "base/audiosource.h", |
| 52 | "base/codec.cc", |
| 53 | "base/codec.h", |
| 54 | "base/cpuid.cc", |
| 55 | "base/cpuid.h", |
| 56 | "base/cryptoparams.h", |
| 57 | "base/device.h", |
| 58 | "base/fakescreencapturerfactory.h", |
| 59 | "base/hybriddataengine.h", |
| 60 | "base/mediachannel.h", |
| 61 | "base/mediacommon.h", |
| 62 | "base/mediaconstants.cc", |
| 63 | "base/mediaconstants.h", |
| 64 | "base/mediaengine.cc", |
| 65 | "base/mediaengine.h", |
| 66 | "base/rtpdataengine.cc", |
| 67 | "base/rtpdataengine.h", |
| 68 | "base/rtpdump.cc", |
| 69 | "base/rtpdump.h", |
| 70 | "base/rtputils.cc", |
| 71 | "base/rtputils.h", |
| 72 | "base/screencastid.h", |
| 73 | "base/streamparams.cc", |
| 74 | "base/streamparams.h", |
| 75 | "base/turnutils.cc", |
| 76 | "base/turnutils.h", |
| 77 | "base/videoadapter.cc", |
| 78 | "base/videoadapter.h", |
| 79 | "base/videobroadcaster.cc", |
| 80 | "base/videobroadcaster.h", |
| 81 | "base/videocapturer.cc", |
| 82 | "base/videocapturer.h", |
| 83 | "base/videocapturerfactory.h", |
| 84 | "base/videocommon.cc", |
| 85 | "base/videocommon.h", |
| 86 | "base/videoframe.cc", |
| 87 | "base/videoframe.h", |
| 88 | "base/videoframefactory.cc", |
| 89 | "base/videoframefactory.h", |
| 90 | "base/videorenderer.h", |
| 91 | "base/videosourcebase.cc", |
| 92 | "base/videosourcebase.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 93 | "devices/videorendererfactory.h", |
| 94 | "engine/nullwebrtcvideoengine.h", |
ossu | 6f06cca | 2016-07-13 10:06:22 -0700 | [diff] [blame] | 95 | "engine/payload_type_mapper.cc", |
| 96 | "engine/payload_type_mapper.h", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 97 | "engine/simulcast.cc", |
| 98 | "engine/simulcast.h", |
| 99 | "engine/webrtccommon.h", |
| 100 | "engine/webrtcmediaengine.cc", |
| 101 | "engine/webrtcmediaengine.h", |
| 102 | "engine/webrtcvideocapturer.cc", |
| 103 | "engine/webrtcvideocapturer.h", |
| 104 | "engine/webrtcvideocapturerfactory.cc", |
| 105 | "engine/webrtcvideocapturerfactory.h", |
| 106 | "engine/webrtcvideodecoderfactory.h", |
| 107 | "engine/webrtcvideoencoderfactory.h", |
| 108 | "engine/webrtcvideoengine2.cc", |
| 109 | "engine/webrtcvideoengine2.h", |
| 110 | "engine/webrtcvideoframe.cc", |
| 111 | "engine/webrtcvideoframe.h", |
| 112 | "engine/webrtcvideoframefactory.cc", |
| 113 | "engine/webrtcvideoframefactory.h", |
| 114 | "engine/webrtcvoe.h", |
| 115 | "engine/webrtcvoiceengine.cc", |
| 116 | "engine/webrtcvoiceengine.h", |
| 117 | "sctp/sctpdataengine.cc", |
| 118 | "sctp/sctpdataengine.h", |
| 119 | ] |
| 120 | |
| 121 | configs += [ |
| 122 | "..:common_config", |
| 123 | ":rtc_media_warnings_config", |
| 124 | ] |
| 125 | |
| 126 | public_configs = [ "..:common_inherited_config" ] |
| 127 | |
| 128 | if (is_clang) { |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 129 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 130 | configs -= [ |
| 131 | "//build/config/clang:extra_warnings", |
| 132 | "//build/config/clang:find_bad_constructs", |
| 133 | ] |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | if (is_win) { |
| 137 | cflags = [ |
| 138 | "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch. |
| 139 | "/wd4267", # conversion from "size_t" to "int", possible loss of data. |
| 140 | "/wd4389", # signed/unsigned mismatch. |
| 141 | ] |
| 142 | } |
| 143 | |
kjellander | ec5c906 | 2016-08-19 01:07:30 -0700 | [diff] [blame] | 144 | include_dirs = [] |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 145 | if (rtc_build_libyuv) { |
| 146 | deps += [ "$rtc_libyuv_dir" ] |
| 147 | public_deps = [ |
| 148 | "$rtc_libyuv_dir", |
| 149 | ] |
| 150 | } else { |
| 151 | # Need to add a directory normally exported by libyuv. |
| 152 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 153 | } |
| 154 | |
| 155 | if (rtc_build_usrsctp) { |
kjellander | ec5c906 | 2016-08-19 01:07:30 -0700 | [diff] [blame] | 156 | include_dirs += [ |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 157 | # TODO(jiayl): move this into the public_configs of |
| 158 | # //third_party/usrsctp/BUILD.gn. |
| 159 | "//third_party/usrsctp/usrsctplib", |
| 160 | ] |
| 161 | deps += [ "//third_party/usrsctp" ] |
| 162 | } |
| 163 | |
| 164 | if (build_with_chromium) { |
| 165 | deps += [ "../modules/video_capture:video_capture" ] |
| 166 | } else { |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 167 | public_configs += [ ":rtc_media_defines_config" ] |
| 168 | deps += [ "../modules/video_capture:video_capture_internal_impl" ] |
| 169 | } |
| 170 | if (is_linux && rtc_use_gtk) { |
| 171 | sources += [ |
| 172 | "devices/gtkvideorenderer.cc", |
| 173 | "devices/gtkvideorenderer.h", |
| 174 | ] |
| 175 | public_configs += [ ":gtk-lib" ] |
| 176 | } |
| 177 | if (is_win) { |
| 178 | sources += [ |
| 179 | "devices/gdivideorenderer.cc", |
| 180 | "devices/gdivideorenderer.h", |
| 181 | ] |
| 182 | libs += [ |
| 183 | "d3d9.lib", |
| 184 | "gdi32.lib", |
| 185 | "strmiids.lib", |
| 186 | ] |
| 187 | } |
| 188 | if (is_mac && current_cpu == "x86") { |
| 189 | sources += [ |
| 190 | "devices/carbonvideorenderer.cc", |
| 191 | "devices/carbonvideorenderer.h", |
| 192 | ] |
| 193 | libs += [ "Carbon.framework" ] |
| 194 | } |
| 195 | if (is_ios || (is_mac && current_cpu != "x86")) { |
| 196 | defines += [ "CARBON_DEPRECATED=YES" ] |
| 197 | } |
| 198 | |
| 199 | deps += [ |
| 200 | "..:webrtc_common", |
| 201 | "../base:rtc_base_approved", |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 202 | "../call", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 203 | "../libjingle/xmllite", |
| 204 | "../libjingle/xmpp", |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 205 | "../modules/video_coding", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 206 | "../p2p", |
| 207 | "../system_wrappers", |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 208 | "../video", |
kjellander | c76dc95 | 2016-06-03 03:09:32 -0700 | [diff] [blame] | 209 | "../voice_engine", |
| 210 | ] |
| 211 | } |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 212 | |
| 213 | if (rtc_include_tests) { |
| 214 | config("rtc_unittest_main_config") { |
| 215 | # GN orders flags on a target before flags from configs. The default config |
| 216 | # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 217 | # come from a config and can"t be on the target directly. |
| 218 | if (is_clang && is_ios) { |
| 219 | cflags = [ "-Wno-unused-variable" ] |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | source_set("rtc_unittest_main") { |
| 224 | testonly = true |
| 225 | |
kjellander | ec5c906 | 2016-08-19 01:07:30 -0700 | [diff] [blame] | 226 | include_dirs = [] |
| 227 | public_deps = [] |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 228 | deps = [] |
| 229 | sources = [ |
| 230 | "base/fakemediaengine.h", |
| 231 | "base/fakenetworkinterface.h", |
| 232 | "base/fakertp.h", |
| 233 | "base/fakevideocapturer.h", |
| 234 | "base/fakevideorenderer.h", |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 235 | "base/test/mock_mediachannel.h", |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 236 | "base/testutils.cc", |
| 237 | "base/testutils.h", |
| 238 | "engine/fakewebrtccall.cc", |
| 239 | "engine/fakewebrtccall.h", |
| 240 | "engine/fakewebrtccommon.h", |
| 241 | "engine/fakewebrtcdeviceinfo.h", |
| 242 | "engine/fakewebrtcvcmfactory.h", |
| 243 | "engine/fakewebrtcvideocapturemodule.h", |
| 244 | "engine/fakewebrtcvideoengine.h", |
| 245 | "engine/fakewebrtcvoiceengine.h", |
| 246 | ] |
| 247 | |
| 248 | configs += [ |
| 249 | "..:common_config", |
| 250 | ":rtc_unittest_main_config", |
| 251 | ] |
| 252 | public_configs = [ "..:common_inherited_config" ] |
| 253 | |
| 254 | if (rtc_build_libyuv) { |
| 255 | deps += [ "$rtc_libyuv_dir" ] |
kjellander | ec5c906 | 2016-08-19 01:07:30 -0700 | [diff] [blame] | 256 | public_deps += [ "$rtc_libyuv_dir" ] |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 257 | } else { |
| 258 | # Need to add a directory normally exported by libyuv. |
| 259 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 260 | } |
| 261 | |
| 262 | if (is_clang) { |
| 263 | # Suppress warnings from the Chromium Clang plugin. |
| 264 | # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 265 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 266 | } |
| 267 | |
| 268 | deps += [ |
| 269 | "../base:rtc_base_tests_utils", |
| 270 | "//testing/gtest", |
| 271 | ] |
| 272 | public_deps += [ "//testing/gmock" ] |
| 273 | } |
| 274 | |
| 275 | config("rtc_media_unittests_config") { |
| 276 | # GN orders flags on a target before flags from configs. The default config |
| 277 | # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 278 | # come from a config and can"t be on the target directly. |
| 279 | # TODO(kjellander): Make the code compile without disabling these flags. |
| 280 | # See https://bugs.webrtc.org/3307. |
| 281 | if (is_clang && is_win) { |
| 282 | cflags += [ "-Wno-unused-function" ] |
| 283 | } |
| 284 | if (!is_win) { |
| 285 | cflags = [ "-Wno-sign-compare" ] |
| 286 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | test("rtc_media_unittests") { |
| 291 | testonly = true |
| 292 | |
| 293 | deps = [] |
| 294 | sources = [ |
| 295 | "base/codec_unittest.cc", |
| 296 | "base/rtpdataengine_unittest.cc", |
| 297 | "base/rtpdump_unittest.cc", |
| 298 | "base/rtputils_unittest.cc", |
| 299 | "base/streamparams_unittest.cc", |
| 300 | "base/turnutils_unittest.cc", |
| 301 | "base/videoadapter_unittest.cc", |
| 302 | "base/videobroadcaster_unittest.cc", |
| 303 | "base/videocapturer_unittest.cc", |
| 304 | "base/videocommon_unittest.cc", |
| 305 | "base/videoengine_unittest.h", |
| 306 | "base/videoframe_unittest.h", |
| 307 | "engine/nullwebrtcvideoengine_unittest.cc", |
ossu | c54071d | 2016-08-17 02:45:41 -0700 | [diff] [blame] | 308 | "engine/payload_type_mapper_unittest.cc", |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 309 | "engine/simulcast_unittest.cc", |
| 310 | "engine/webrtcmediaengine_unittest.cc", |
| 311 | "engine/webrtcvideocapturer_unittest.cc", |
| 312 | "engine/webrtcvideoengine2_unittest.cc", |
| 313 | "engine/webrtcvideoframe_unittest.cc", |
| 314 | "engine/webrtcvideoframefactory_unittest.cc", |
| 315 | "engine/webrtcvoiceengine_unittest.cc", |
| 316 | "sctp/sctpdataengine_unittest.cc", |
| 317 | ] |
| 318 | |
| 319 | configs += [ |
| 320 | "..:common_config", |
| 321 | ":rtc_media_unittests_config", |
| 322 | ] |
| 323 | public_configs = [ "..:common_inherited_config" ] |
| 324 | |
| 325 | if (is_win) { |
| 326 | cflags = [ |
| 327 | "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. |
| 328 | "/wd4373", # virtual function override. |
| 329 | "/wd4389", # signed/unsigned mismatch. |
| 330 | ] |
| 331 | } |
| 332 | |
| 333 | if (is_clang) { |
| 334 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 335 | configs -= [ |
| 336 | "//build/config/clang:extra_warnings", |
| 337 | "//build/config/clang:find_bad_constructs", |
| 338 | ] |
| 339 | } |
| 340 | |
| 341 | if (is_android) { |
| 342 | deps += [ "//testing/android/native_test:native_test_support" ] |
kjellander | 28a0ffd | 2016-08-24 07:48:42 -0700 | [diff] [blame] | 343 | shard_timeout = 900 |
| 344 | } |
| 345 | if (is_android || is_ios) { |
kjellander | 82a9449 | 2016-06-12 22:12:01 -0700 | [diff] [blame] | 346 | data = [ |
| 347 | "//resources/media/captured-320x240-2s-48.frames", |
| 348 | "//resources/media/faces.1280x720_P420.yuv", |
| 349 | "//resources/media/faces_I420.jpg", |
| 350 | "//resources/media/faces_I422.jpg", |
| 351 | "//resources/media/faces_I444.jpg", |
| 352 | "//resources/media/faces_I411.jpg", |
| 353 | "//resources/media/faces_I400.jpg", |
| 354 | ] |
| 355 | } |
| 356 | |
| 357 | deps += [ |
| 358 | # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243. |
| 359 | ":rtc_media", |
| 360 | ":rtc_unittest_main", |
| 361 | "../audio", |
| 362 | "../base:rtc_base_tests_utils", |
| 363 | "../system_wrappers:metrics_default", |
| 364 | ] |
| 365 | } |
| 366 | } |