blob: b4d2bbeea7445d1d08f147fa0f249c1061c1c746 [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
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700394 config("peerconnection_client_warnings_config") {
395 if (is_win && is_clang) {
396 cflags = [
397 # Disable warnings failing when compiling with Clang on Windows.
398 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
399 "-Wno-format",
400
401 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6271
402 # for -Wno-reorder and -Wno-sign-compare
403 "-Wno-reorder",
404 "-Wno-sign-compare",
405 ]
406 }
407 }
408
kthelgason0727f152016-08-08 09:03:23 -0700409 executable("peerconnection_client") {
410 sources = [
411 "peerconnection/client/conductor.cc",
412 "peerconnection/client/conductor.h",
413 "peerconnection/client/defaults.cc",
414 "peerconnection/client/defaults.h",
415 "peerconnection/client/peer_connection_client.cc",
416 "peerconnection/client/peer_connection_client.h",
417 ]
418 if (is_clang) {
419 # Suppress warnings from the Chromium Clang plugin.
420 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
421 configs -= [ "//build/config/clang:find_bad_constructs" ]
422 }
423 if (is_win) {
424 sources += [
425 "peerconnection/client/flagdefs.h",
426 "peerconnection/client/main.cc",
427 "peerconnection/client/main_wnd.cc",
428 "peerconnection/client/main_wnd.h",
429 ]
430 cflags = [ "/wd4245" ]
431 configs += [ "//build/config/win:windowed" ]
432 }
433 if (is_linux) {
434 sources += [
435 "peerconnection/client/linux/main.cc",
436 "peerconnection/client/linux/main_wnd.cc",
437 "peerconnection/client/linux/main_wnd.h",
438 ]
439 libs = [
440 "X11",
441 "Xcomposite",
442 "Xext",
443 "Xrender",
444 ]
445 public_configs = [ ":gtk2_config" ]
446 }
447 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700448 "//build/config/sanitizers:deps",
nisse9f8e37b2016-09-01 01:06:23 -0700449 "//third_party/libyuv",
kthelgason0727f152016-08-08 09:03:23 -0700450 "//webrtc/api:libjingle_peerconnection",
451 "//webrtc/system_wrappers:field_trial_default",
452 "//webrtc/system_wrappers:metrics_default",
453 ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700454 configs += [ ":peerconnection_client_warnings_config" ]
kthelgason0727f152016-08-08 09:03:23 -0700455 if (rtc_build_json) {
456 deps += [ "//third_party/jsoncpp" ]
457 }
458 }
459 executable("peerconnection_server") {
460 sources = [
461 "peerconnection/server/data_socket.cc",
462 "peerconnection/server/data_socket.h",
463 "peerconnection/server/main.cc",
464 "peerconnection/server/peer_channel.cc",
465 "peerconnection/server/peer_channel.h",
466 "peerconnection/server/utils.cc",
467 "peerconnection/server/utils.h",
468 ]
469 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700470 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700471 "//webrtc:webrtc_common",
472 "//webrtc/base:rtc_base_approved",
473 "//webrtc/tools:command_line_parser",
474 ]
475 if (is_clang) {
476 # Suppress warnings from the Chromium Clang plugin.
477 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
478 configs -= [ "//build/config/clang:find_bad_constructs" ]
479 }
480 }
481 executable("relayserver") {
482 sources = [
483 "relayserver/relayserver_main.cc",
484 ]
485 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700486 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700487 "//webrtc/base:rtc_base_approved",
488 "//webrtc/pc:rtc_pc",
489 "//webrtc/system_wrappers:field_trial_default",
490 "//webrtc/system_wrappers:metrics_default",
491 ]
492 if (is_clang) {
493 # Suppress warnings from the Chromium Clang plugin.
494 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
495 configs -= [ "//build/config/clang:find_bad_constructs" ]
496 }
497 }
498 executable("turnserver") {
499 sources = [
500 "turnserver/turnserver_main.cc",
501 ]
502 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700503 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700504 "//webrtc/base:rtc_base_approved",
505 "//webrtc/pc:rtc_pc",
506 "//webrtc/system_wrappers:field_trial_default",
507 "//webrtc/system_wrappers:metrics_default",
508 ]
509 if (is_clang) {
510 # Suppress warnings from the Chromium Clang plugin.
511 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
512 configs -= [ "//build/config/clang:find_bad_constructs" ]
513 }
514 }
515 executable("stunserver") {
516 sources = [
517 "stunserver/stunserver_main.cc",
518 ]
519 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700520 "//build/config/sanitizers:deps",
kthelgason0727f152016-08-08 09:03:23 -0700521 "//webrtc/base:rtc_base_approved",
522 "//webrtc/pc:rtc_pc",
523 "//webrtc/system_wrappers:field_trial_default",
524 "//webrtc/system_wrappers:metrics_default",
525 ]
526 if (is_clang) {
527 # Suppress warnings from the Chromium Clang plugin.
528 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
529 configs -= [ "//build/config/clang:find_bad_constructs" ]
530 }
531 }
532}