blob: cb86877750330dcea0979ee7af2a0d9ffad748c8 [file] [log] [blame]
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +02001# 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
9if (is_android) {
10 import("//build/config/android/config.gni")
11 import("//build/config/android/rules.gni")
tkchin2ddfdba2016-08-07 21:37:45 -070012} else if (is_mac) {
13 import("//build/config/mac/rules.gni")
14} else if (is_ios) {
15 import("//build/config/ios/rules.gni")
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020016}
17
18group("examples") {
19 deps = []
20
tkchin2ddfdba2016-08-07 21:37:45 -070021 if (is_android) {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020022 deps += [ ":AppRTCDemo" ]
23 }
24}
25
tkchin2ddfdba2016-08-07 21:37:45 -070026if (is_android) {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020027 android_apk("AppRTCDemo") {
28 apk_name = "AppRTCDemo"
29 android_manifest = "androidapp/AndroidManifest.xml"
30
31 deps = [
phoglund9a123aa2016-07-05 03:21:35 -070032 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020033 ":AppRTCDemo_resources",
34 "//base:base_java",
35 "//webrtc/base:base_java",
36 ]
37
38 shared_libraries = [ "//webrtc/api:libjingle_peerconnection_so" ]
39 }
40
phoglund9a123aa2016-07-05 03:21:35 -070041 android_library("AppRTCDemo_javalib") {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020042 java_files = [
43 "androidapp/src/org/appspot/apprtc/AppRTCAudioManager.java",
44 "androidapp/src/org/appspot/apprtc/AppRTCClient.java",
45 "androidapp/src/org/appspot/apprtc/AppRTCProximitySensor.java",
46 "androidapp/src/org/appspot/apprtc/CallActivity.java",
47 "androidapp/src/org/appspot/apprtc/CallFragment.java",
48 "androidapp/src/org/appspot/apprtc/CaptureQualityController.java",
49 "androidapp/src/org/appspot/apprtc/ConnectActivity.java",
50 "androidapp/src/org/appspot/apprtc/CpuMonitor.java",
51 "androidapp/src/org/appspot/apprtc/DirectRTCClient.java",
52 "androidapp/src/org/appspot/apprtc/HudFragment.java",
53 "androidapp/src/org/appspot/apprtc/PeerConnectionClient.java",
54 "androidapp/src/org/appspot/apprtc/PercentFrameLayout.java",
55 "androidapp/src/org/appspot/apprtc/RoomParametersFetcher.java",
56 "androidapp/src/org/appspot/apprtc/SettingsActivity.java",
57 "androidapp/src/org/appspot/apprtc/SettingsFragment.java",
58 "androidapp/src/org/appspot/apprtc/TCPChannelClient.java",
59 "androidapp/src/org/appspot/apprtc/UnhandledExceptionHandler.java",
60 "androidapp/src/org/appspot/apprtc/WebSocketChannelClient.java",
61 "androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java",
62 "androidapp/src/org/appspot/apprtc/util/AppRTCUtils.java",
63 "androidapp/src/org/appspot/apprtc/util/AsyncHttpURLConnection.java",
64 "androidapp/src/org/appspot/apprtc/util/LooperExecutor.java",
65 ]
66
67 deps = [
68 ":AppRTCDemo_resources",
69 "//webrtc/api:libjingle_peerconnection_java",
70 "//webrtc/base:base_java",
71 "//webrtc/examples/androidapp/third_party/autobanh:autobanh_java",
72 ]
73 }
74
75 android_resources("AppRTCDemo_resources") {
76 resource_dirs = [ "androidapp/res" ]
77 custom_package = "org.appspot.apprtc"
78 }
79
80 instrumentation_test_apk("AppRTCDemoTest") {
81 apk_name = "AppRTCDemoTest"
82 android_manifest = "androidtests/AndroidManifest.xml"
83
84 java_files = [ "androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java" ]
85
86 apk_under_test = ":AppRTCDemo"
87
88 deps = [
phoglund9a123aa2016-07-05 03:21:35 -070089 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020090 "//webrtc/api:libjingle_peerconnection_java",
91 ]
92 }
93
94 junit_binary("AppRTCDemoJUnitTest") {
95 java_files = [
96 "androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
97 "androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
98 "androidjunit/src/org/appspot/apprtc/util/LooperExecutorTest.java",
99 ]
100
101 deps = [
phoglund9a123aa2016-07-05 03:21:35 -0700102 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +0200103 "//webrtc/api:libjingle_peerconnection_java",
104 "//webrtc/api:libjingle_peerconnection_jni",
105 ]
106 }
107}
tkchin2ddfdba2016-08-07 21:37:45 -0700108
109if (is_ios || (is_mac && target_cpu != "x86")) {
110 config("warnings_config") {
111 # GN orders flags on a target before flags from configs. The default config
112 # adds these flags so to cancel them out they need to come from a config and
113 # cannot be on the target directly.
114 if (is_ios) {
115 # Suppress compiler warnings about deprecated that triggered
116 # when moving from ios_deployment_target 7.0 to 9.0.
117 # See webrtc:5549 for more details.
118 cflags = [ "-Wno-deprecated-declarations" ]
119 }
120 }
121
122 config("apprtc_common_config") {
123 include_dirs = [ "objc/AppRTCDemo/common" ]
124 }
125
126 source_set("apprtc_common") {
127 sources = [
128 "objc/AppRTCDemo/common/ARDUtilities.h",
129 "objc/AppRTCDemo/common/ARDUtilities.m",
130 ]
131 configs += [
132 "..:common_config",
133 ":warnings_config",
134 "//build/config/compiler:enable_arc",
135 ]
136 public_configs = [
137 "..:common_inherited_config",
138 ":apprtc_common_config",
139 ]
140
141 deps = [
142 "../sdk:rtc_sdk_common_objc",
143 "../system_wrappers:field_trial_default",
144 "../system_wrappers:metrics_default",
145 ]
146 }
147
148 config("apprtc_signaling_config") {
149 include_dirs = [ "objc/AppRTCDemo" ]
150
151 # GN orders flags on a target before flags from configs. The default config
152 # adds these flags so to cancel them out they need to come from a config and
153 # cannot be on the target directly.
154 cflags = [
155 "-Wno-sign-compare",
156 "-Wno-unused-variable",
157 ]
158 if (is_mac) {
159 cflags += [ "-Wno-partial-availability" ]
160 }
161 }
162
163 source_set("apprtc_signaling") {
164 sources = [
165 "objc/AppRTCDemo/ARDAppClient+Internal.h",
166 "objc/AppRTCDemo/ARDAppClient.h",
167 "objc/AppRTCDemo/ARDAppClient.m",
168 "objc/AppRTCDemo/ARDAppEngineClient.h",
169 "objc/AppRTCDemo/ARDAppEngineClient.m",
170 "objc/AppRTCDemo/ARDBitrateTracker.h",
171 "objc/AppRTCDemo/ARDBitrateTracker.m",
172 "objc/AppRTCDemo/ARDCEODTURNClient.h",
173 "objc/AppRTCDemo/ARDCEODTURNClient.m",
174 "objc/AppRTCDemo/ARDJoinResponse+Internal.h",
175 "objc/AppRTCDemo/ARDJoinResponse.h",
176 "objc/AppRTCDemo/ARDJoinResponse.m",
177 "objc/AppRTCDemo/ARDMessageResponse+Internal.h",
178 "objc/AppRTCDemo/ARDMessageResponse.h",
179 "objc/AppRTCDemo/ARDMessageResponse.m",
180 "objc/AppRTCDemo/ARDRoomServerClient.h",
181 "objc/AppRTCDemo/ARDSDPUtils.h",
182 "objc/AppRTCDemo/ARDSDPUtils.m",
183 "objc/AppRTCDemo/ARDSignalingChannel.h",
184 "objc/AppRTCDemo/ARDSignalingMessage.h",
185 "objc/AppRTCDemo/ARDSignalingMessage.m",
186 "objc/AppRTCDemo/ARDStatsBuilder.h",
187 "objc/AppRTCDemo/ARDStatsBuilder.m",
188 "objc/AppRTCDemo/ARDTURNClient.h",
189 "objc/AppRTCDemo/ARDWebSocketChannel.h",
190 "objc/AppRTCDemo/ARDWebSocketChannel.m",
191 "objc/AppRTCDemo/RTCIceCandidate+JSON.h",
192 "objc/AppRTCDemo/RTCIceCandidate+JSON.m",
193 "objc/AppRTCDemo/RTCIceServer+JSON.h",
194 "objc/AppRTCDemo/RTCIceServer+JSON.m",
195 "objc/AppRTCDemo/RTCMediaConstraints+JSON.h",
196 "objc/AppRTCDemo/RTCMediaConstraints+JSON.m",
197 "objc/AppRTCDemo/RTCSessionDescription+JSON.h",
198 "objc/AppRTCDemo/RTCSessionDescription+JSON.m",
199 ]
200 configs += [
201 "..:common_config",
202 "//build/config/compiler:enable_arc",
203 ":warnings_config",
204 ]
205 public_configs = [
206 "..:common_inherited_config",
207 ":apprtc_signaling_config",
208 ]
209 deps = [
210 ":apprtc_common",
211 ":socketrocket",
212 ]
213 public_deps = [
214 "../sdk:rtc_sdk_peerconnection_objc",
215 ]
216 libs = [ "QuartzCore.framework" ]
217 }
218
219 if (is_ios) {
220 ios_app_bundle("AppRTCDemo") {
221 sources = [
222 "objc/AppRTCDemo/ios/ARDAppDelegate.m",
223 "objc/AppRTCDemo/ios/ARDMainView.h",
224 "objc/AppRTCDemo/ios/ARDMainView.m",
225 "objc/AppRTCDemo/ios/ARDMainViewController.h",
226 "objc/AppRTCDemo/ios/ARDMainViewController.m",
227 "objc/AppRTCDemo/ios/ARDStatsView.h",
228 "objc/AppRTCDemo/ios/ARDStatsView.m",
229 "objc/AppRTCDemo/ios/ARDVideoCallView.h",
230 "objc/AppRTCDemo/ios/ARDVideoCallView.m",
231 "objc/AppRTCDemo/ios/ARDVideoCallViewController.h",
232 "objc/AppRTCDemo/ios/ARDVideoCallViewController.m",
233 "objc/AppRTCDemo/ios/AppRTCDemo-Prefix.pch",
234 "objc/AppRTCDemo/ios/UIImage+ARDUtilities.h",
235 "objc/AppRTCDemo/ios/UIImage+ARDUtilities.m",
236 "objc/AppRTCDemo/ios/main.m",
237 ]
238
239 info_plist = "objc/AppRTCDemo/ios/Info.plist"
240
241 configs += [
242 "..:common_config",
243 "//build/config/compiler:enable_arc",
244 ":warnings_config",
245 ]
246 public_configs = [ "..:common_inherited_config" ]
247
248 deps = [
249 ":AppRTCDemo_ios_bundle_data",
250 ":apprtc_common",
251 ":apprtc_signaling",
252 ]
253
254 if (target_cpu == "x86") {
255 deps += [ "//testing/iossim:iossim" ]
256 }
257 }
258
259 bundle_data("AppRTCDemo_ios_bundle_data") {
260 sources = [
261 "objc/AppRTCDemo/ios/resources/Roboto-Regular.ttf",
262 "objc/AppRTCDemo/ios/resources/iPhone5@2x.png",
263 "objc/AppRTCDemo/ios/resources/iPhone6@2x.png",
264 "objc/AppRTCDemo/ios/resources/iPhone6p@3x.png",
265 "objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp.png",
266 "objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp@2x.png",
267 "objc/AppRTCDemo/ios/resources/ic_clear_black_24dp.png",
268 "objc/AppRTCDemo/ios/resources/ic_clear_black_24dp@2x.png",
269 "objc/AppRTCDemo/ios/resources/ic_surround_sound_black_24dp.png",
270 "objc/AppRTCDemo/ios/resources/ic_surround_sound_black_24dp@2x.png",
271 "objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp.png",
272 "objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp@2x.png",
273 "objc/AppRTCDemo/ios/resources/mozart.mp3",
274 "objc/Icon.png",
275 ]
276 outputs = [
277 "{{bundle_resources_dir}}/{{source_file_part}}",
278 ]
279 }
280 }
281
282 if (is_mac) {
283 source_set("AppRTCDemo_app") {
284 sources = [
285 "objc/AppRTCDemo/mac/APPRTCAppDelegate.h",
286 "objc/AppRTCDemo/mac/APPRTCAppDelegate.m",
287 "objc/AppRTCDemo/mac/APPRTCViewController.h",
288 "objc/AppRTCDemo/mac/APPRTCViewController.m",
289 ]
290 configs += [
291 "..:common_config",
292 "..:common_objc",
293 "//build/config/compiler:enable_arc",
294 ]
295 deps = [
296 ":apprtc_common",
297 ":apprtc_signaling",
298 ]
299 }
300
301 mac_app_bundle("AppRTCDemo") {
302 output_name = "AppRTCDemo"
303
304 extra_substitutions = [ "MACOSX_DEPLOYMENT_TARGET=10.8" ]
305
306 sources = [
307 "objc/AppRTCDemo/mac/main.m",
308 ]
309
310 public_configs = [ "..:common_inherited_config" ]
311
312 info_plist = "objc/AppRTCDemo/mac/Info.plist"
313
314 libs = [ "AppKit.framework" ]
315
316 deps = [
317 ":AppRTCDemo_app",
318 ]
319 }
320 }
321
322 config("socketrocket_include_config") {
323 include_dirs = [ "objc/AppRTCDemo/third_party/SocketRocket" ]
324 }
325
326 config("socketrocket_warning_config") {
327 # GN orders flags on a target before flags from configs. The default config
328 # adds these flags so to cancel them out they need to come from a config and
329 # cannot be on the target directly.
330 cflags = [
331 "-Wno-deprecated-declarations",
332 "-Wno-nonnull",
333 "-Wno-objc-missing-property-synthesis",
334 "-Wno-semicolon-before-method-body",
335 "-Wno-unused-variable",
336 ]
337
338 # Enabled for cflags_objc in build/config/compiler/BUILD.gn.
339 cflags_objc = [ "-Wno-objc-missing-property-synthesis" ]
340
341 if (is_mac) {
342 cflags += [ "-Wno-partial-availability" ]
343 }
344 }
345
346 source_set("socketrocket") {
347 sources = [
348 "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.h",
349 "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.m",
350 ]
351 configs += [
352 "..:common_config",
353 "//build/config/compiler:enable_arc",
354 ":socketrocket_warning_config",
355 ]
356 public_configs = [
357 "..:common_inherited_config",
358 ":socketrocket_include_config",
359 ]
360
361 libs = [
362 "CFNetwork.framework",
363 "icucore",
364 ]
365 }
366}