blob: 5176862c429f102b79e75da78cc396462a6875d7 [file] [log] [blame]
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +00001# Copyright (c) 2014 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
mbonadei9aa3f0a2017-01-24 06:58:22 -08009import("../../webrtc.gni")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000010
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000011# Note this target is missing an implementation for the video capture.
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +000012# Targets must link with either 'video_capture' or
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000013# 'video_capture_internal_impl' depending on whether they want to
14# use the internal capturer.
kjellanderb62dbbe2016-09-23 00:38:52 -070015rtc_static_library("video_capture_module") {
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000016 sources = [
17 "device_info_impl.cc",
18 "device_info_impl.h",
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010019 "video_capture.h",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000020 "video_capture_config.h",
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010021 "video_capture_defines.h",
guidou41bce132016-08-04 06:48:17 -070022 "video_capture_factory.cc",
sakal06bfe1f2016-08-04 07:54:04 -070023 "video_capture_factory.h",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000024 "video_capture_impl.cc",
25 "video_capture_impl.h",
26 ]
27
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000028 deps = [
mbonadei1140f972017-04-26 03:38:35 -070029 "..:module_api",
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000030 "../..:webrtc_common",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000031 "../../common_video",
ehmaldonadof6a861a2017-07-19 10:40:47 -070032 "../../rtc_base:rtc_base_approved",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000033 "../../system_wrappers",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000034 ]
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000035
kjellandere40a7ee2016-10-16 23:56:12 -070036 if (!build_with_chromium && is_clang) {
37 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070038 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000039 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000040}
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000041
kjellanderb62dbbe2016-09-23 00:38:52 -070042rtc_static_library("video_capture") {
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000043 sources = [
44 "external/device_info_external.cc",
45 "external/video_capture_external.cc",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000046 ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000047
48 deps = [
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +000049 ":video_capture_module",
ehmaldonadof6a861a2017-07-19 10:40:47 -070050 "../../rtc_base:rtc_base_approved",
andresp@webrtc.orgc7134f82014-09-18 10:06:54 +000051 "../../system_wrappers",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000052 ]
53
kjellandere40a7ee2016-10-16 23:56:12 -070054 if (!build_with_chromium && is_clang) {
55 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070056 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000057 }
58}
59
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000060if (!build_with_chromium) {
61 config("video_capture_internal_impl_config") {
kthelgason20a52e12016-09-30 00:43:12 -070062 if (is_ios || is_mac) {
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000063 libs = [
64 "AVFoundation.framework",
65 "CoreMedia.framework",
66 "CoreVideo.framework",
67 ]
68 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000069 }
70
ehmaldonadod02fe4b2016-08-26 13:31:24 -070071 config("video_capture_internal_impl_warnings_config") {
72 if (is_win && is_clang) {
73 cflags = [
74 "-Wno-comment",
75 "-Wno-ignored-attributes",
76
77 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6269
78 # for -Wno-ignored-qualifiers
79 "-Wno-ignored-qualifiers",
80 "-Wno-microsoft-extra-qualification",
81 "-Wno-missing-braces",
82 "-Wno-overloaded-virtual",
83 "-Wno-reorder",
84 "-Wno-writable-strings",
85 ]
86 }
87 }
88
mbonadei054b1082017-09-04 06:54:54 -070089 if (is_ios || is_mac) {
90 rtc_source_set("video_capture_internal_impl_objc") {
91 visibility = [ ":video_capture_internal_impl" ]
92 configs += [ ":video_capture_internal_impl_warnings_config" ]
93
94 deps = [
95 ":video_capture_module",
96 "../../rtc_base:rtc_base_approved",
97 "../../system_wrappers",
98 ]
99
100 sources = [
101 "objc/device_info.h",
102 "objc/device_info.mm",
103 "objc/device_info_objc.h",
104 "objc/device_info_objc.mm",
105 "objc/rtc_video_capture_objc.h",
106 "objc/rtc_video_capture_objc.mm",
107 "objc/video_capture.h",
108 "objc/video_capture.mm",
109 ]
110
111 all_dependent_configs = [ ":video_capture_internal_impl_config" ]
112
113 if (!build_with_chromium && is_clang) {
114 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
115 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
116 }
117 }
118 }
119
120 rtc_source_set("video_capture_internal_impl") {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700121 configs += [ ":video_capture_internal_impl_warnings_config" ]
122
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000123 deps = [
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000124 ":video_capture_module",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700125 "../../rtc_base:rtc_base_approved",
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000126 "../../system_wrappers",
127 ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +0000128
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000129 if (is_linux) {
130 sources = [
131 "linux/device_info_linux.cc",
132 "linux/device_info_linux.h",
133 "linux/video_capture_linux.cc",
134 "linux/video_capture_linux.h",
135 ]
Sam Zackrisson2ed6e4f2017-08-16 13:39:25 +0200136 deps += [
137 "../..:webrtc_common",
138 "../../media:rtc_media_base",
139 ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000140 }
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000141 if (is_win) {
142 sources = [
143 "windows/device_info_ds.cc",
144 "windows/device_info_ds.h",
145 "windows/device_info_mf.cc",
146 "windows/device_info_mf.h",
147 "windows/help_functions_ds.cc",
148 "windows/help_functions_ds.h",
149 "windows/sink_filter_ds.cc",
150 "windows/sink_filter_ds.h",
151 "windows/video_capture_ds.cc",
152 "windows/video_capture_ds.h",
153 "windows/video_capture_factory_windows.cc",
154 "windows/video_capture_mf.cc",
155 "windows/video_capture_mf.h",
156 ]
157
158 libs = [ "Strmiids.lib" ]
159
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200160 deps += [ "//third_party/winsdk_samples" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000161 }
kthelgason20a52e12016-09-30 00:43:12 -0700162 if (is_ios || is_mac) {
mbonadei054b1082017-09-04 06:54:54 -0700163 deps += [ ":video_capture_internal_impl_objc" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000164 }
165
166 all_dependent_configs = [ ":video_capture_internal_impl_config" ]
167
kjellandere40a7ee2016-10-16 23:56:12 -0700168 if (!build_with_chromium && is_clang) {
169 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700170 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000171 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +0000172 }
sakal06bfe1f2016-08-04 07:54:04 -0700173
kjellanderf96c51a2016-08-15 09:21:31 -0700174 if (!is_android && rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700175 rtc_test("video_capture_tests") {
sakal06bfe1f2016-08-04 07:54:04 -0700176 sources = [
sakal06bfe1f2016-08-04 07:54:04 -0700177 "test/video_capture_unittest.cc",
178 ]
179
180 cflags = []
181 if (is_linux || is_mac) {
182 cflags += [ "-Wno-write-strings" ]
183 }
184
185 ldflags = []
186 if (is_linux || is_mac) {
187 ldflags += [
188 "-lpthread",
189 "-lm",
190 ]
191 }
192 if (is_linux) {
193 ldflags += [
194 "-lrt",
195 "-lXext",
196 "-lX11",
197 ]
198 }
199
200 deps = [
201 ":video_capture_internal_impl",
202 ":video_capture_module",
ehmaldonado36df2d72016-12-08 09:56:16 -0800203 "../../common_video:common_video",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700204 "../../rtc_base:rtc_base_approved",
ehmaldonado36df2d72016-12-08 09:56:16 -0800205 "../../system_wrappers:system_wrappers",
kjellanderf96c51a2016-08-15 09:21:31 -0700206 "../../system_wrappers:system_wrappers_default",
207 "../../test:video_test_common",
208 "../utility",
209 "//testing/gtest",
sakal06bfe1f2016-08-04 07:54:04 -0700210 ]
jianjun.zhuc0247402017-07-11 06:20:45 -0700211 deps += [ "../../test:test_main" ]
sakal06bfe1f2016-08-04 07:54:04 -0700212
kjellandere40a7ee2016-10-16 23:56:12 -0700213 if (!build_with_chromium && is_clang) {
214 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700215 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
sakal06bfe1f2016-08-04 07:54:04 -0700216 }
217 }
218 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000219}