blob: 8b1f1877642d4acf2378f09e985a350aa7c4a6d7 [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}
kthelgason0727f152016-08-08 09:03:23 -070017if (is_linux || is_win) {
18 import("//webrtc/build/webrtc.gni")
19}
20if (is_linux) {
21 import("//build/config/linux/pkg_config.gni")
22}
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020023
24group("examples") {
25 deps = []
26
tkchin2ddfdba2016-08-07 21:37:45 -070027 if (is_android) {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020028 deps += [ ":AppRTCDemo" ]
29 }
kthelgason0727f152016-08-08 09:03:23 -070030 if (is_linux) {
31 deps += [
32 ":peerconnection_client",
33 ":peerconnection_server",
34 ":relayserver",
35 ":stunserver",
36 ":turnserver",
37 ]
38 }
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020039}
40
tkchin2ddfdba2016-08-07 21:37:45 -070041if (is_android) {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020042 android_apk("AppRTCDemo") {
43 apk_name = "AppRTCDemo"
44 android_manifest = "androidapp/AndroidManifest.xml"
45
46 deps = [
phoglund9a123aa2016-07-05 03:21:35 -070047 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020048 ":AppRTCDemo_resources",
49 "//base:base_java",
50 "//webrtc/base:base_java",
51 ]
52
53 shared_libraries = [ "//webrtc/api:libjingle_peerconnection_so" ]
54 }
55
phoglund9a123aa2016-07-05 03:21:35 -070056 android_library("AppRTCDemo_javalib") {
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020057 java_files = [
58 "androidapp/src/org/appspot/apprtc/AppRTCAudioManager.java",
59 "androidapp/src/org/appspot/apprtc/AppRTCClient.java",
60 "androidapp/src/org/appspot/apprtc/AppRTCProximitySensor.java",
61 "androidapp/src/org/appspot/apprtc/CallActivity.java",
62 "androidapp/src/org/appspot/apprtc/CallFragment.java",
63 "androidapp/src/org/appspot/apprtc/CaptureQualityController.java",
64 "androidapp/src/org/appspot/apprtc/ConnectActivity.java",
65 "androidapp/src/org/appspot/apprtc/CpuMonitor.java",
66 "androidapp/src/org/appspot/apprtc/DirectRTCClient.java",
67 "androidapp/src/org/appspot/apprtc/HudFragment.java",
68 "androidapp/src/org/appspot/apprtc/PeerConnectionClient.java",
69 "androidapp/src/org/appspot/apprtc/PercentFrameLayout.java",
70 "androidapp/src/org/appspot/apprtc/RoomParametersFetcher.java",
71 "androidapp/src/org/appspot/apprtc/SettingsActivity.java",
72 "androidapp/src/org/appspot/apprtc/SettingsFragment.java",
73 "androidapp/src/org/appspot/apprtc/TCPChannelClient.java",
74 "androidapp/src/org/appspot/apprtc/UnhandledExceptionHandler.java",
75 "androidapp/src/org/appspot/apprtc/WebSocketChannelClient.java",
76 "androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java",
77 "androidapp/src/org/appspot/apprtc/util/AppRTCUtils.java",
78 "androidapp/src/org/appspot/apprtc/util/AsyncHttpURLConnection.java",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +020079 ]
80
81 deps = [
82 ":AppRTCDemo_resources",
83 "//webrtc/api:libjingle_peerconnection_java",
84 "//webrtc/base:base_java",
85 "//webrtc/examples/androidapp/third_party/autobanh:autobanh_java",
86 ]
87 }
88
89 android_resources("AppRTCDemo_resources") {
90 resource_dirs = [ "androidapp/res" ]
91 custom_package = "org.appspot.apprtc"
92 }
93
94 instrumentation_test_apk("AppRTCDemoTest") {
95 apk_name = "AppRTCDemoTest"
96 android_manifest = "androidtests/AndroidManifest.xml"
97
98 java_files = [ "androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java" ]
99
100 apk_under_test = ":AppRTCDemo"
101
102 deps = [
phoglund9a123aa2016-07-05 03:21:35 -0700103 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +0200104 "//webrtc/api:libjingle_peerconnection_java",
105 ]
106 }
107
108 junit_binary("AppRTCDemoJUnitTest") {
109 java_files = [
110 "androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
111 "androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +0200112 ]
113
114 deps = [
phoglund9a123aa2016-07-05 03:21:35 -0700115 ":AppRTCDemo_javalib",
Sami Kalliomaki9c0c75b2016-06-29 14:55:00 +0200116 "//webrtc/api:libjingle_peerconnection_java",
117 "//webrtc/api:libjingle_peerconnection_jni",
118 ]
119 }
120}
tkchin2ddfdba2016-08-07 21:37:45 -0700121
122if (is_ios || (is_mac && target_cpu != "x86")) {
123 config("warnings_config") {
124 # GN orders flags on a target before flags from configs. The default config
125 # adds these flags so to cancel them out they need to come from a config and
126 # cannot be on the target directly.
127 if (is_ios) {
128 # Suppress compiler warnings about deprecated that triggered
129 # when moving from ios_deployment_target 7.0 to 9.0.
130 # See webrtc:5549 for more details.
131 cflags = [ "-Wno-deprecated-declarations" ]
132 }
133 }
134
135 config("apprtc_common_config") {
136 include_dirs = [ "objc/AppRTCDemo/common" ]
137 }
138
139 source_set("apprtc_common") {
140 sources = [
141 "objc/AppRTCDemo/common/ARDUtilities.h",
142 "objc/AppRTCDemo/common/ARDUtilities.m",
143 ]
144 configs += [
145 "..:common_config",
146 ":warnings_config",
147 "//build/config/compiler:enable_arc",
148 ]
149 public_configs = [
150 "..:common_inherited_config",
151 ":apprtc_common_config",
152 ]
153
154 deps = [
155 "../sdk:rtc_sdk_common_objc",
156 "../system_wrappers:field_trial_default",
157 "../system_wrappers:metrics_default",
158 ]
159 }
160
161 config("apprtc_signaling_config") {
162 include_dirs = [ "objc/AppRTCDemo" ]
163
164 # GN orders flags on a target before flags from configs. The default config
165 # adds these flags so to cancel them out they need to come from a config and
166 # cannot be on the target directly.
167 cflags = [
168 "-Wno-sign-compare",
169 "-Wno-unused-variable",
170 ]
171 if (is_mac) {
172 cflags += [ "-Wno-partial-availability" ]
173 }
174 }
175
176 source_set("apprtc_signaling") {
177 sources = [
178 "objc/AppRTCDemo/ARDAppClient+Internal.h",
179 "objc/AppRTCDemo/ARDAppClient.h",
180 "objc/AppRTCDemo/ARDAppClient.m",
181 "objc/AppRTCDemo/ARDAppEngineClient.h",
182 "objc/AppRTCDemo/ARDAppEngineClient.m",
183 "objc/AppRTCDemo/ARDBitrateTracker.h",
184 "objc/AppRTCDemo/ARDBitrateTracker.m",
185 "objc/AppRTCDemo/ARDCEODTURNClient.h",
186 "objc/AppRTCDemo/ARDCEODTURNClient.m",
187 "objc/AppRTCDemo/ARDJoinResponse+Internal.h",
188 "objc/AppRTCDemo/ARDJoinResponse.h",
189 "objc/AppRTCDemo/ARDJoinResponse.m",
190 "objc/AppRTCDemo/ARDMessageResponse+Internal.h",
191 "objc/AppRTCDemo/ARDMessageResponse.h",
192 "objc/AppRTCDemo/ARDMessageResponse.m",
193 "objc/AppRTCDemo/ARDRoomServerClient.h",
194 "objc/AppRTCDemo/ARDSDPUtils.h",
195 "objc/AppRTCDemo/ARDSDPUtils.m",
196 "objc/AppRTCDemo/ARDSignalingChannel.h",
197 "objc/AppRTCDemo/ARDSignalingMessage.h",
198 "objc/AppRTCDemo/ARDSignalingMessage.m",
199 "objc/AppRTCDemo/ARDStatsBuilder.h",
200 "objc/AppRTCDemo/ARDStatsBuilder.m",
201 "objc/AppRTCDemo/ARDTURNClient.h",
202 "objc/AppRTCDemo/ARDWebSocketChannel.h",
203 "objc/AppRTCDemo/ARDWebSocketChannel.m",
204 "objc/AppRTCDemo/RTCIceCandidate+JSON.h",
205 "objc/AppRTCDemo/RTCIceCandidate+JSON.m",
206 "objc/AppRTCDemo/RTCIceServer+JSON.h",
207 "objc/AppRTCDemo/RTCIceServer+JSON.m",
208 "objc/AppRTCDemo/RTCMediaConstraints+JSON.h",
209 "objc/AppRTCDemo/RTCMediaConstraints+JSON.m",
210 "objc/AppRTCDemo/RTCSessionDescription+JSON.h",
211 "objc/AppRTCDemo/RTCSessionDescription+JSON.m",
212 ]
213 configs += [
214 "..:common_config",
215 "//build/config/compiler:enable_arc",
216 ":warnings_config",
217 ]
218 public_configs = [
219 "..:common_inherited_config",
220 ":apprtc_signaling_config",
221 ]
222 deps = [
223 ":apprtc_common",
224 ":socketrocket",
225 ]
226 public_deps = [
227 "../sdk:rtc_sdk_peerconnection_objc",
228 ]
229 libs = [ "QuartzCore.framework" ]
230 }
231
232 if (is_ios) {
233 ios_app_bundle("AppRTCDemo") {
234 sources = [
235 "objc/AppRTCDemo/ios/ARDAppDelegate.m",
236 "objc/AppRTCDemo/ios/ARDMainView.h",
237 "objc/AppRTCDemo/ios/ARDMainView.m",
238 "objc/AppRTCDemo/ios/ARDMainViewController.h",
239 "objc/AppRTCDemo/ios/ARDMainViewController.m",
240 "objc/AppRTCDemo/ios/ARDStatsView.h",
241 "objc/AppRTCDemo/ios/ARDStatsView.m",
242 "objc/AppRTCDemo/ios/ARDVideoCallView.h",
243 "objc/AppRTCDemo/ios/ARDVideoCallView.m",
244 "objc/AppRTCDemo/ios/ARDVideoCallViewController.h",
245 "objc/AppRTCDemo/ios/ARDVideoCallViewController.m",
246 "objc/AppRTCDemo/ios/AppRTCDemo-Prefix.pch",
247 "objc/AppRTCDemo/ios/UIImage+ARDUtilities.h",
248 "objc/AppRTCDemo/ios/UIImage+ARDUtilities.m",
249 "objc/AppRTCDemo/ios/main.m",
250 ]
251
252 info_plist = "objc/AppRTCDemo/ios/Info.plist"
253
254 configs += [
255 "..:common_config",
256 "//build/config/compiler:enable_arc",
257 ":warnings_config",
258 ]
259 public_configs = [ "..:common_inherited_config" ]
260
261 deps = [
262 ":AppRTCDemo_ios_bundle_data",
263 ":apprtc_common",
264 ":apprtc_signaling",
265 ]
266
267 if (target_cpu == "x86") {
268 deps += [ "//testing/iossim:iossim" ]
269 }
270 }
271
272 bundle_data("AppRTCDemo_ios_bundle_data") {
273 sources = [
274 "objc/AppRTCDemo/ios/resources/Roboto-Regular.ttf",
275 "objc/AppRTCDemo/ios/resources/iPhone5@2x.png",
276 "objc/AppRTCDemo/ios/resources/iPhone6@2x.png",
277 "objc/AppRTCDemo/ios/resources/iPhone6p@3x.png",
278 "objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp.png",
279 "objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp@2x.png",
280 "objc/AppRTCDemo/ios/resources/ic_clear_black_24dp.png",
281 "objc/AppRTCDemo/ios/resources/ic_clear_black_24dp@2x.png",
282 "objc/AppRTCDemo/ios/resources/ic_surround_sound_black_24dp.png",
283 "objc/AppRTCDemo/ios/resources/ic_surround_sound_black_24dp@2x.png",
284 "objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp.png",
285 "objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp@2x.png",
286 "objc/AppRTCDemo/ios/resources/mozart.mp3",
287 "objc/Icon.png",
288 ]
289 outputs = [
290 "{{bundle_resources_dir}}/{{source_file_part}}",
291 ]
292 }
293 }
294
295 if (is_mac) {
296 source_set("AppRTCDemo_app") {
297 sources = [
298 "objc/AppRTCDemo/mac/APPRTCAppDelegate.h",
299 "objc/AppRTCDemo/mac/APPRTCAppDelegate.m",
300 "objc/AppRTCDemo/mac/APPRTCViewController.h",
301 "objc/AppRTCDemo/mac/APPRTCViewController.m",
302 ]
303 configs += [
304 "..:common_config",
305 "..:common_objc",
306 "//build/config/compiler:enable_arc",
307 ]
308 deps = [
309 ":apprtc_common",
310 ":apprtc_signaling",
311 ]
312 }
313
314 mac_app_bundle("AppRTCDemo") {
315 output_name = "AppRTCDemo"
316
317 extra_substitutions = [ "MACOSX_DEPLOYMENT_TARGET=10.8" ]
318
319 sources = [
320 "objc/AppRTCDemo/mac/main.m",
321 ]
322
323 public_configs = [ "..:common_inherited_config" ]
324
325 info_plist = "objc/AppRTCDemo/mac/Info.plist"
326
327 libs = [ "AppKit.framework" ]
328
329 deps = [
330 ":AppRTCDemo_app",
331 ]
332 }
333 }
334
335 config("socketrocket_include_config") {
336 include_dirs = [ "objc/AppRTCDemo/third_party/SocketRocket" ]
337 }
338
339 config("socketrocket_warning_config") {
340 # GN orders flags on a target before flags from configs. The default config
341 # adds these flags so to cancel them out they need to come from a config and
342 # cannot be on the target directly.
343 cflags = [
344 "-Wno-deprecated-declarations",
345 "-Wno-nonnull",
346 "-Wno-objc-missing-property-synthesis",
347 "-Wno-semicolon-before-method-body",
348 "-Wno-unused-variable",
349 ]
350
351 # Enabled for cflags_objc in build/config/compiler/BUILD.gn.
352 cflags_objc = [ "-Wno-objc-missing-property-synthesis" ]
353
354 if (is_mac) {
355 cflags += [ "-Wno-partial-availability" ]
356 }
357 }
358
359 source_set("socketrocket") {
360 sources = [
361 "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.h",
362 "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.m",
363 ]
364 configs += [
365 "..:common_config",
366 "//build/config/compiler:enable_arc",
367 ":socketrocket_warning_config",
368 ]
369 public_configs = [
370 "..:common_inherited_config",
371 ":socketrocket_include_config",
372 ]
373
374 libs = [
375 "CFNetwork.framework",
376 "icucore",
377 ]
378 }
379}
kthelgason0727f152016-08-08 09:03:23 -0700380
381if (is_linux || is_win) {
382 if (is_linux) {
383 pkg_config("gtk2_config") {
384 # Gtk requires gmodule, but it does not list it as a dependency in some
385 # misconfigured systems.
386 packages = [
387 "gmodule-2.0",
388 "gtk+-2.0",
389 "gthread-2.0",
390 ]
391 }
392 }
393
394 executable("peerconnection_client") {
395 sources = [
396 "peerconnection/client/conductor.cc",
397 "peerconnection/client/conductor.h",
398 "peerconnection/client/defaults.cc",
399 "peerconnection/client/defaults.h",
400 "peerconnection/client/peer_connection_client.cc",
401 "peerconnection/client/peer_connection_client.h",
402 ]
403 if (is_clang) {
404 # Suppress warnings from the Chromium Clang plugin.
405 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
406 configs -= [ "//build/config/clang:find_bad_constructs" ]
407 }
408 if (is_win) {
409 sources += [
410 "peerconnection/client/flagdefs.h",
411 "peerconnection/client/main.cc",
412 "peerconnection/client/main_wnd.cc",
413 "peerconnection/client/main_wnd.h",
414 ]
415 cflags = [ "/wd4245" ]
416 configs += [ "//build/config/win:windowed" ]
417 }
ehmaldonado4bc4d272016-08-25 04:15:40 -0700418 if (is_win && is_clang) {
419 cflags = [
420 # Disable warnings failing when compiling with Clang on Windows.
421 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
422 "-Wno-reorder",
423 "-Wno-unused-function",
424 ]
425 }
kthelgason0727f152016-08-08 09:03:23 -0700426 if (is_linux) {
427 sources += [
428 "peerconnection/client/linux/main.cc",
429 "peerconnection/client/linux/main_wnd.cc",
430 "peerconnection/client/linux/main_wnd.h",
431 ]
432 libs = [
433 "X11",
434 "Xcomposite",
435 "Xext",
436 "Xrender",
437 ]
438 public_configs = [ ":gtk2_config" ]
439 }
440 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700441 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700442 "//webrtc/api:libjingle_peerconnection",
443 "//webrtc/system_wrappers:field_trial_default",
444 "//webrtc/system_wrappers:metrics_default",
445 ]
446 if (rtc_build_json) {
447 deps += [ "//third_party/jsoncpp" ]
448 }
449 }
450 executable("peerconnection_server") {
451 sources = [
452 "peerconnection/server/data_socket.cc",
453 "peerconnection/server/data_socket.h",
454 "peerconnection/server/main.cc",
455 "peerconnection/server/peer_channel.cc",
456 "peerconnection/server/peer_channel.h",
457 "peerconnection/server/utils.cc",
458 "peerconnection/server/utils.h",
459 ]
460 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700461 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700462 "//webrtc:webrtc_common",
463 "//webrtc/base:rtc_base_approved",
464 "//webrtc/tools:command_line_parser",
465 ]
466 if (is_clang) {
467 # Suppress warnings from the Chromium Clang plugin.
468 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
469 configs -= [ "//build/config/clang:find_bad_constructs" ]
470 }
471 }
472 executable("relayserver") {
473 sources = [
474 "relayserver/relayserver_main.cc",
475 ]
476 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700477 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700478 "//webrtc/base:rtc_base_approved",
479 "//webrtc/pc:rtc_pc",
480 "//webrtc/system_wrappers:field_trial_default",
481 "//webrtc/system_wrappers:metrics_default",
482 ]
483 if (is_clang) {
484 # Suppress warnings from the Chromium Clang plugin.
485 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
486 configs -= [ "//build/config/clang:find_bad_constructs" ]
487 }
488 }
489 executable("turnserver") {
490 sources = [
491 "turnserver/turnserver_main.cc",
492 ]
493 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700494 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700495 "//webrtc/base:rtc_base_approved",
496 "//webrtc/pc:rtc_pc",
497 "//webrtc/system_wrappers:field_trial_default",
498 "//webrtc/system_wrappers:metrics_default",
499 ]
500 if (is_clang) {
501 # Suppress warnings from the Chromium Clang plugin.
502 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
503 configs -= [ "//build/config/clang:find_bad_constructs" ]
504 }
505 }
506 executable("stunserver") {
507 sources = [
508 "stunserver/stunserver_main.cc",
509 ]
510 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700511 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700512 "//webrtc/base:rtc_base_approved",
513 "//webrtc/pc:rtc_pc",
514 "//webrtc/system_wrappers:field_trial_default",
515 "//webrtc/system_wrappers:metrics_default",
516 ]
517 if (is_clang) {
518 # Suppress warnings from the Chromium Clang plugin.
519 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
520 configs -= [ "//build/config/clang:find_bad_constructs" ]
521 }
522 }
523}