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