blob: 60573ba4b1c359c9c8f629a052eae2d2280b1c27 [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
9import("../../build/webrtc.gni")
10
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",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000022 "video_capture_delay.h",
guidou41bce132016-08-04 06:48:17 -070023 "video_capture_factory.cc",
sakal06bfe1f2016-08-04 07:54:04 -070024 "video_capture_factory.h",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000025 "video_capture_impl.cc",
26 "video_capture_impl.h",
27 ]
28
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000029 deps = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000030 "../..:webrtc_common",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000031 "../../common_video",
32 "../../system_wrappers",
33 "../utility",
34 ]
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000035
36 if (is_clang) {
37 # Suppress warnings from Chrome's Clang plugins.
38 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070039 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000040 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000041}
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000042
kjellanderb62dbbe2016-09-23 00:38:52 -070043rtc_static_library("video_capture") {
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000044 sources = [
45 "external/device_info_external.cc",
46 "external/video_capture_external.cc",
kjellander@webrtc.org788f0582014-08-28 13:51:08 +000047 ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000048
49 deps = [
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +000050 ":video_capture_module",
andresp@webrtc.orgc7134f82014-09-18 10:06:54 +000051 "../../system_wrappers",
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000052 ]
53
54 if (is_clang) {
55 # Suppress warnings from Chrome's Clang plugins.
56 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -070057 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000058 }
59}
60
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000061if (!build_with_chromium) {
62 config("video_capture_internal_impl_config") {
kthelgasoneddb7572016-09-29 02:43:23 -070063 if (is_ios) {
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000064 libs = [
65 "AVFoundation.framework",
66 "CoreMedia.framework",
67 "CoreVideo.framework",
68 ]
69 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000070 }
71
ehmaldonadod02fe4b2016-08-26 13:31:24 -070072 config("video_capture_internal_impl_warnings_config") {
73 if (is_win && is_clang) {
74 cflags = [
75 "-Wno-comment",
76 "-Wno-ignored-attributes",
77
78 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6269
79 # for -Wno-ignored-qualifiers
80 "-Wno-ignored-qualifiers",
81 "-Wno-microsoft-extra-qualification",
82 "-Wno-missing-braces",
83 "-Wno-overloaded-virtual",
84 "-Wno-reorder",
85 "-Wno-writable-strings",
86 ]
87 }
88 }
89
kjellanderb62dbbe2016-09-23 00:38:52 -070090 rtc_static_library("video_capture_internal_impl") {
ehmaldonadod02fe4b2016-08-26 13:31:24 -070091 configs += [ ":video_capture_internal_impl_warnings_config" ]
92
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000093 deps = [
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +000094 ":video_capture_module",
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000095 "../../system_wrappers",
96 ]
andresp@webrtc.orga74eda12014-09-17 11:50:19 +000097
kjellander@webrtc.org853049f2015-01-20 11:40:45 +000098 if (is_linux) {
99 sources = [
100 "linux/device_info_linux.cc",
101 "linux/device_info_linux.h",
102 "linux/video_capture_linux.cc",
103 "linux/video_capture_linux.h",
104 ]
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000105 deps += [ "../..:webrtc_common" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000106 }
kthelgasoneddb7572016-09-29 02:43:23 -0700107 if (is_mac) {
108 sources = [
109 "mac/qtkit/video_capture_qtkit.h",
110 "mac/qtkit/video_capture_qtkit.mm",
111 "mac/qtkit/video_capture_qtkit_info.h",
112 "mac/qtkit/video_capture_qtkit_info.mm",
113 "mac/qtkit/video_capture_qtkit_info_objc.h",
114 "mac/qtkit/video_capture_qtkit_info_objc.mm",
115 "mac/qtkit/video_capture_qtkit_objc.h",
116 "mac/qtkit/video_capture_qtkit_objc.mm",
117 "mac/qtkit/video_capture_qtkit_utility.h",
118 "mac/video_capture_mac.mm",
119 ]
120
121 libs = [
122 # For NSAlert in video_capture_qtkit_info_objc.mm.
123 "Cocoa.framework",
124
125 # For GetGestalt in video_capture_mac.mm.
126 "CoreServices.framework",
127 "CoreVideo.framework",
128 "QTKit.framework",
129 ]
130 }
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000131 if (is_win) {
132 sources = [
133 "windows/device_info_ds.cc",
134 "windows/device_info_ds.h",
135 "windows/device_info_mf.cc",
136 "windows/device_info_mf.h",
137 "windows/help_functions_ds.cc",
138 "windows/help_functions_ds.h",
139 "windows/sink_filter_ds.cc",
140 "windows/sink_filter_ds.h",
141 "windows/video_capture_ds.cc",
142 "windows/video_capture_ds.h",
143 "windows/video_capture_factory_windows.cc",
144 "windows/video_capture_mf.cc",
145 "windows/video_capture_mf.h",
146 ]
147
148 libs = [ "Strmiids.lib" ]
149
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200150 deps += [ "//third_party/winsdk_samples" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000151 }
kthelgasoneddb7572016-09-29 02:43:23 -0700152 if (is_ios) {
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000153 sources = [
kthelgasoneddb7572016-09-29 02:43:23 -0700154 "ios/device_info_ios.h",
155 "ios/device_info_ios.mm",
156 "ios/device_info_ios_objc.h",
157 "ios/device_info_ios_objc.mm",
158 "ios/rtc_video_capture_ios_objc.h",
159 "ios/rtc_video_capture_ios_objc.mm",
160 "ios/video_capture_ios.h",
161 "ios/video_capture_ios.mm",
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000162 ]
163
164 cflags = [
165 "-fobjc-arc", # CLANG_ENABLE_OBJC_ARC = YES.
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200166
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000167 # To avoid warnings for deprecated videoMinFrameDuration and
168 # videoMaxFrameDuration properties in iOS 7.0.
169 # See webrtc:3705 for more details.
170 "-Wno-deprecated-declarations",
171 ]
172 }
173
174 all_dependent_configs = [ ":video_capture_internal_impl_config" ]
175
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000176 if (is_clang) {
177 # Suppress warnings from Chrome's Clang plugins.
178 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700179 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.org853049f2015-01-20 11:40:45 +0000180 }
andresp@webrtc.orga74eda12014-09-17 11:50:19 +0000181 }
sakal06bfe1f2016-08-04 07:54:04 -0700182
kjellanderf96c51a2016-08-15 09:21:31 -0700183 if (!is_android && rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700184 rtc_test("video_capture_tests") {
sakal06bfe1f2016-08-04 07:54:04 -0700185 sources = [
kthelgasoneddb7572016-09-29 02:43:23 -0700186 "test/video_capture_main_mac.mm",
sakal06bfe1f2016-08-04 07:54:04 -0700187 "test/video_capture_unittest.cc",
188 ]
189
190 cflags = []
191 if (is_linux || is_mac) {
192 cflags += [ "-Wno-write-strings" ]
193 }
194
195 ldflags = []
196 if (is_linux || is_mac) {
197 ldflags += [
198 "-lpthread",
199 "-lm",
200 ]
201 }
202 if (is_linux) {
203 ldflags += [
204 "-lrt",
205 "-lXext",
206 "-lX11",
207 ]
208 }
209
210 deps = [
211 ":video_capture_internal_impl",
212 ":video_capture_module",
kjellanderf96c51a2016-08-15 09:21:31 -0700213 "../../system_wrappers:system_wrappers_default",
214 "../../test:video_test_common",
215 "../utility",
216 "//testing/gtest",
sakal06bfe1f2016-08-04 07:54:04 -0700217 ]
kthelgasoneddb7572016-09-29 02:43:23 -0700218 if (is_mac) {
219 deps += [ "//webrtc/test:test_support_main_threaded_mac" ]
220 } else {
221 deps += [ "//webrtc/test:test_support_main" ]
222 }
sakal06bfe1f2016-08-04 07:54:04 -0700223
sakal06bfe1f2016-08-04 07:54:04 -0700224 if (is_clang) {
225 # Suppress warnings from Chrome's Clang plugins.
226 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700227 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
sakal06bfe1f2016-08-04 07:54:04 -0700228 }
229 }
230 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000231}