• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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
9import("../webrtc.gni")
10
11if (is_android) {
12  import("//build/config/android/config.gni")
13  import("//build/config/android/rules.gni")
14} else if (is_mac) {
15  import("//build/config/mac/rules.gni")
16} else if (is_ios) {
17  import("//build/config/ios/rules.gni")
18} else if (is_linux || is_chromeos) {
19  import("//build/config/linux/pkg_config.gni")
20}
21
22group("examples") {
23  # This target shall build all targets in examples.
24  testonly = true
25  deps = []
26
27  if (is_android) {
28    deps += [
29      ":AppRTCMobile",
30      ":AppRTCMobile_test_apk",
31      ":libwebrtc_unity",
32      "androidvoip",
33    ]
34
35    # TODO(sakal): We include some code from the tests. Remove this dependency
36    # and remove this if-clause.
37    if (rtc_include_tests) {
38      deps += [ "androidnativeapi" ]
39    }
40  }
41
42  if (!build_with_chromium) {
43    deps += [ ":stun_prober" ]
44  }
45
46  if (is_ios || (is_mac && target_cpu != "x86")) {
47    deps += [ ":AppRTCMobile" ]
48  }
49
50  if (is_linux || is_chromeos || is_win) {
51    deps += [
52      ":peerconnection_server",
53      ":stunserver",
54      ":turnserver",
55    ]
56    if (current_os != "winuwp") {
57      deps += [ ":peerconnection_client" ]
58    }
59  }
60
61  if (is_android || is_win) {
62    deps += [ ":webrtc_unity_plugin" ]
63  }
64}
65
66rtc_library("read_auth_file") {
67  testonly = true
68  sources = [
69    "turnserver/read_auth_file.cc",
70    "turnserver/read_auth_file.h",
71  ]
72  deps = [
73    "../api:array_view",
74    "../rtc_base",
75    "../rtc_base:stringutils",
76  ]
77  absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]
78}
79
80if (rtc_include_tests) {
81  rtc_test("examples_unittests") {
82    testonly = true
83    sources = [ "turnserver/read_auth_file_unittest.cc" ]
84    deps = [
85      ":read_auth_file",
86      "../test:test_main",
87      "//test:test_support",
88      "//testing/gtest",
89    ]
90  }
91}
92
93if (is_android) {
94  rtc_android_apk("AppRTCMobile") {
95    testonly = true
96    apk_name = "AppRTCMobile"
97    android_manifest = "androidapp/AndroidManifest.xml"
98    min_sdk_version = 21
99    target_sdk_version = 31
100
101    deps = [
102      ":AppRTCMobile_javalib",
103      ":AppRTCMobile_resources",
104      "../rtc_base:base_java",
105    ]
106
107    shared_libraries = [ "../sdk/android:libjingle_peerconnection_so" ]
108  }
109
110  rtc_android_library("AppRTCMobile_javalib") {
111    testonly = true
112    android_manifest = "androidapp/AndroidManifest.xml"
113
114    sources = [
115      "androidapp/src/org/appspot/apprtc/AppRTCAudioManager.java",
116      "androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java",
117      "androidapp/src/org/appspot/apprtc/AppRTCClient.java",
118      "androidapp/src/org/appspot/apprtc/AppRTCProximitySensor.java",
119      "androidapp/src/org/appspot/apprtc/CallActivity.java",
120      "androidapp/src/org/appspot/apprtc/CallFragment.java",
121      "androidapp/src/org/appspot/apprtc/CaptureQualityController.java",
122      "androidapp/src/org/appspot/apprtc/ConnectActivity.java",
123      "androidapp/src/org/appspot/apprtc/CpuMonitor.java",
124      "androidapp/src/org/appspot/apprtc/DirectRTCClient.java",
125      "androidapp/src/org/appspot/apprtc/HudFragment.java",
126      "androidapp/src/org/appspot/apprtc/PeerConnectionClient.java",
127      "androidapp/src/org/appspot/apprtc/RecordedAudioToFileController.java",
128      "androidapp/src/org/appspot/apprtc/RoomParametersFetcher.java",
129      "androidapp/src/org/appspot/apprtc/RtcEventLog.java",
130      "androidapp/src/org/appspot/apprtc/SettingsActivity.java",
131      "androidapp/src/org/appspot/apprtc/SettingsFragment.java",
132      "androidapp/src/org/appspot/apprtc/TCPChannelClient.java",
133      "androidapp/src/org/appspot/apprtc/UnhandledExceptionHandler.java",
134      "androidapp/src/org/appspot/apprtc/WebSocketChannelClient.java",
135      "androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java",
136      "androidapp/src/org/appspot/apprtc/util/AppRTCUtils.java",
137      "androidapp/src/org/appspot/apprtc/util/AsyncHttpURLConnection.java",
138    ]
139
140    resources_package = "org.appspot.apprtc"
141    deps = [
142      ":AppRTCMobile_resources",
143      "../rtc_base:base_java",
144      "../sdk/android:audio_api_java",
145      "../sdk/android:base_java",
146      "../sdk/android:camera_java",
147      "../sdk/android:default_video_codec_factory_java",
148      "../sdk/android:filevideo_java",
149      "../sdk/android:hwcodecs_java",
150      "../sdk/android:java_audio_device_module_java",
151      "../sdk/android:libjingle_peerconnection_java",
152      "../sdk/android:libjingle_peerconnection_metrics_default_java",
153      "../sdk/android:peerconnection_java",
154      "../sdk/android:screencapturer_java",
155      "../sdk/android:surfaceviewrenderer_java",
156      "../sdk/android:swcodecs_java",
157      "../sdk/android:video_api_java",
158      "../sdk/android:video_java",
159      "androidapp/third_party/autobanh:autobanh_java",
160      "//third_party/androidx:androidx_annotation_annotation_java",
161    ]
162  }
163
164  android_resources("AppRTCMobile_resources") {
165    testonly = true
166    sources = [
167      "androidapp/res/drawable-hdpi/disconnect.png",
168      "androidapp/res/drawable-hdpi/ic_action_full_screen.png",
169      "androidapp/res/drawable-hdpi/ic_action_return_from_full_screen.png",
170      "androidapp/res/drawable-hdpi/ic_launcher.png",
171      "androidapp/res/drawable-hdpi/ic_loopback_call.png",
172      "androidapp/res/drawable-ldpi/disconnect.png",
173      "androidapp/res/drawable-ldpi/ic_action_full_screen.png",
174      "androidapp/res/drawable-ldpi/ic_action_return_from_full_screen.png",
175      "androidapp/res/drawable-ldpi/ic_launcher.png",
176      "androidapp/res/drawable-ldpi/ic_loopback_call.png",
177      "androidapp/res/drawable-mdpi/disconnect.png",
178      "androidapp/res/drawable-mdpi/ic_action_full_screen.png",
179      "androidapp/res/drawable-mdpi/ic_action_return_from_full_screen.png",
180      "androidapp/res/drawable-mdpi/ic_launcher.png",
181      "androidapp/res/drawable-mdpi/ic_loopback_call.png",
182      "androidapp/res/drawable-xhdpi/disconnect.png",
183      "androidapp/res/drawable-xhdpi/ic_action_full_screen.png",
184      "androidapp/res/drawable-xhdpi/ic_action_return_from_full_screen.png",
185      "androidapp/res/drawable-xhdpi/ic_launcher.png",
186      "androidapp/res/drawable-xhdpi/ic_loopback_call.png",
187      "androidapp/res/layout/activity_call.xml",
188      "androidapp/res/layout/activity_connect.xml",
189      "androidapp/res/layout/fragment_call.xml",
190      "androidapp/res/layout/fragment_hud.xml",
191      "androidapp/res/menu/connect_menu.xml",
192      "androidapp/res/values-v17/styles.xml",
193      "androidapp/res/values-v21/styles.xml",
194      "androidapp/res/values/arrays.xml",
195      "androidapp/res/values/strings.xml",
196      "androidapp/res/xml/preferences.xml",
197    ]
198
199    # Needed for Bazel converter.
200    custom_package = "org.appspot.apprtc"
201    resource_dirs = [ "androidapp/res" ]
202    assert(resource_dirs != [])  # Mark as used.
203  }
204
205  rtc_instrumentation_test_apk("AppRTCMobile_test_apk") {
206    apk_name = "AppRTCMobileTest"
207    android_manifest = "androidtests/AndroidManifest.xml"
208    min_sdk_version = 21
209    target_sdk_version = 31
210
211    sources = [
212      "androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java",
213    ]
214
215    apk_under_test = ":AppRTCMobile"
216
217    deps = [
218      ":AppRTCMobile_javalib",
219      "../sdk/android:base_java",
220      "../sdk/android:camera_java",
221      "../sdk/android:libjingle_peerconnection_java",
222      "../sdk/android:peerconnection_java",
223      "../sdk/android:video_api_java",
224      "../sdk/android:video_java",
225      "//third_party/android_support_test_runner:runner_java",
226      "//third_party/androidx:androidx_test_runner_java",
227      "//third_party/junit",
228    ]
229  }
230}
231
232if (is_ios || (is_mac && target_cpu != "x86")) {
233  config("apprtc_common_config") {
234    include_dirs = [ "objc/AppRTCMobile/common" ]
235  }
236
237  rtc_library("apprtc_common") {
238    testonly = true
239    sources = [
240      "objc/AppRTCMobile/common/ARDUtilities.h",
241      "objc/AppRTCMobile/common/ARDUtilities.m",
242    ]
243    public_configs = [ ":apprtc_common_config" ]
244    deps = [ "../sdk:base_objc" ]
245  }
246
247  config("apprtc_signaling_config") {
248    include_dirs = [ "objc/AppRTCMobile" ]
249  }
250
251  rtc_library("apprtc_signaling") {
252    testonly = true
253    sources = [
254      "objc/AppRTCMobile/ARDAppClient+Internal.h",
255      "objc/AppRTCMobile/ARDAppClient.h",
256      "objc/AppRTCMobile/ARDAppClient.m",
257      "objc/AppRTCMobile/ARDAppEngineClient.h",
258      "objc/AppRTCMobile/ARDAppEngineClient.m",
259      "objc/AppRTCMobile/ARDCaptureController.h",
260      "objc/AppRTCMobile/ARDCaptureController.m",
261      "objc/AppRTCMobile/ARDExternalSampleCapturer.h",
262      "objc/AppRTCMobile/ARDExternalSampleCapturer.m",
263      "objc/AppRTCMobile/ARDJoinResponse+Internal.h",
264      "objc/AppRTCMobile/ARDJoinResponse.h",
265      "objc/AppRTCMobile/ARDJoinResponse.m",
266      "objc/AppRTCMobile/ARDMessageResponse+Internal.h",
267      "objc/AppRTCMobile/ARDMessageResponse.h",
268      "objc/AppRTCMobile/ARDMessageResponse.m",
269      "objc/AppRTCMobile/ARDRoomServerClient.h",
270      "objc/AppRTCMobile/ARDSettingsModel+Private.h",
271      "objc/AppRTCMobile/ARDSettingsModel.h",
272      "objc/AppRTCMobile/ARDSettingsModel.m",
273      "objc/AppRTCMobile/ARDSettingsStore.h",
274      "objc/AppRTCMobile/ARDSettingsStore.m",
275      "objc/AppRTCMobile/ARDSignalingChannel.h",
276      "objc/AppRTCMobile/ARDSignalingMessage.h",
277      "objc/AppRTCMobile/ARDSignalingMessage.m",
278      "objc/AppRTCMobile/ARDStatsBuilder.h",
279      "objc/AppRTCMobile/ARDStatsBuilder.m",
280      "objc/AppRTCMobile/ARDTURNClient+Internal.h",
281      "objc/AppRTCMobile/ARDTURNClient.h",
282      "objc/AppRTCMobile/ARDTURNClient.m",
283      "objc/AppRTCMobile/ARDWebSocketChannel.h",
284      "objc/AppRTCMobile/ARDWebSocketChannel.m",
285      "objc/AppRTCMobile/RTCIceCandidate+JSON.h",
286      "objc/AppRTCMobile/RTCIceCandidate+JSON.m",
287      "objc/AppRTCMobile/RTCIceServer+JSON.h",
288      "objc/AppRTCMobile/RTCIceServer+JSON.m",
289      "objc/AppRTCMobile/RTCSessionDescription+JSON.h",
290      "objc/AppRTCMobile/RTCSessionDescription+JSON.m",
291    ]
292    public_configs = [ ":apprtc_signaling_config" ]
293    deps = [
294      ":apprtc_common",
295      ":socketrocket",
296      "../sdk:base_objc",
297      "../sdk:default_codec_factory_objc",
298      "../sdk:file_logger_objc",
299      "../sdk:helpers_objc",
300      "../sdk:mediaconstraints_objc",
301      "../sdk:peerconnectionfactory_base_objc",
302      "../sdk:videocapture_objc",
303      "../sdk:videoframebuffer_objc",
304      "../sdk:videosource_objc",
305    ]
306    frameworks = [
307      "CoreMedia.framework",
308      "QuartzCore.framework",
309    ]
310  }
311
312  if (is_ios) {
313    rtc_library("AppRTCMobile_lib") {
314      # iOS must use WebRTC.framework which is dynamically linked.
315      testonly = true
316      sources = [
317        "objc/AppRTCMobile/ios/ARDAppDelegate.h",
318        "objc/AppRTCMobile/ios/ARDAppDelegate.m",
319        "objc/AppRTCMobile/ios/ARDFileCaptureController.h",
320        "objc/AppRTCMobile/ios/ARDFileCaptureController.m",
321        "objc/AppRTCMobile/ios/ARDMainView.h",
322        "objc/AppRTCMobile/ios/ARDMainView.m",
323        "objc/AppRTCMobile/ios/ARDMainViewController.h",
324        "objc/AppRTCMobile/ios/ARDMainViewController.m",
325        "objc/AppRTCMobile/ios/ARDSettingsViewController.h",
326        "objc/AppRTCMobile/ios/ARDSettingsViewController.m",
327        "objc/AppRTCMobile/ios/ARDStatsView.h",
328        "objc/AppRTCMobile/ios/ARDStatsView.m",
329        "objc/AppRTCMobile/ios/ARDVideoCallView.h",
330        "objc/AppRTCMobile/ios/ARDVideoCallView.m",
331        "objc/AppRTCMobile/ios/ARDVideoCallViewController.h",
332        "objc/AppRTCMobile/ios/ARDVideoCallViewController.m",
333        "objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.h",
334        "objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.m",
335        "objc/AppRTCMobile/ios/UIImage+ARDUtilities.h",
336        "objc/AppRTCMobile/ios/UIImage+ARDUtilities.m",
337      ]
338
339      configs += [ "..:common_objc" ]
340
341      deps = [
342        ":apprtc_common",
343        ":apprtc_signaling",
344        "../sdk:audio_session_objc",
345        "../sdk:base_objc",
346        "../sdk:helpers_objc",
347        "../sdk:mediaconstraints_objc",
348        "../sdk:metal_objc",
349        "../sdk:peerconnectionfactory_base_objc",
350        "../sdk:peerconnectionfactory_base_objc",
351        "../sdk:videocapture_objc",
352        "../sdk:videocodec_objc",
353      ]
354      if (rtc_ios_macos_use_opengl_rendering) {
355        deps += [ "../sdk:opengl_ui_objc" ]
356      }
357
358      frameworks = [ "AVFoundation.framework" ]
359    }
360
361    ios_app_bundle("AppRTCMobile") {
362      testonly = true
363      sources = [ "objc/AppRTCMobile/ios/main.m" ]
364
365      info_plist = "objc/AppRTCMobile/ios/Info.plist"
366
367      configs += [ "..:common_config" ]
368      public_configs = [ "..:common_inherited_config" ]
369
370      deps = [
371        ":AppRTCMobile_ios_bundle_data",
372        ":AppRTCMobile_lib",
373        "../sdk:framework_objc",
374        "../sdk:ios_framework_bundle",
375      ]
376
377      if (rtc_apprtcmobile_broadcast_extension) {
378        deps += [
379          ":AppRTCMobileBroadcastSetupUI_extension_bundle",
380          ":AppRTCMobileBroadcastUpload_extension_bundle",
381        ]
382      }
383
384      if (target_cpu == "x86") {
385        deps += [ "//testing/iossim" ]
386      }
387    }
388
389    if (rtc_apprtcmobile_broadcast_extension) {
390      bundle_data("AppRTCMobileBroadcastUpload_extension_bundle") {
391        testonly = true
392        public_deps = [  # no-presubmit-check TODO(webrtc:8603)
393          ":AppRTCMobileBroadcastUpload",  # prevent code format
394        ]
395        sources = [ "$root_out_dir/AppRTCMobileBroadcastUpload.appex" ]
396        outputs = [ "{{bundle_contents_dir}}/Plugins/{{source_file_part}}" ]
397      }
398
399      bundle_data("AppRTCMobileBroadcastSetupUI_extension_bundle") {
400        testonly = true
401        public_deps = [  # no-presubmit-check TODO(webrtc:8603)
402          ":AppRTCMobileBroadcastSetupUI",  # prevent code format
403        ]
404        sources = [ "$root_out_dir/AppRTCMobileBroadcastSetupUI.appex" ]
405        outputs = [ "{{bundle_contents_dir}}/Plugins/{{source_file_part}}" ]
406      }
407
408      rtc_library("AppRTCMobileBroadcastUpload_lib") {
409        testonly = true
410        sources = [
411          "objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h",
412          "objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.m",
413        ]
414
415        deps = [
416          ":apprtc_signaling",
417          "../sdk:framework_objc+link",
418          "../sdk:ios_framework_bundle",
419        ]
420
421        frameworks = [ "ReplayKit.framework" ]
422      }
423
424      ios_appex_bundle("AppRTCMobileBroadcastUpload") {
425        testonly = true
426        configs += [ "..:common_config" ]
427        public_configs = [ "..:common_inherited_config" ]
428
429        info_plist = "objc/AppRTCMobile/ios/broadcast_extension/BroadcastUploadInfo.plist"
430
431        deps = [
432          ":AppRTCMobileBroadcastUpload_lib",
433          "../sdk:framework_objc",
434        ]
435      }
436
437      ios_appex_bundle("AppRTCMobileBroadcastSetupUI") {
438        sources = [
439          "objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSetupViewController.h",
440          "objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSetupViewController.m",
441        ]
442
443        info_plist = "objc/AppRTCMobile/ios/broadcast_extension/BroadcastSetupUIInfo.plist"
444
445        frameworks = [ "ReplayKit.framework" ]
446
447        deps = [ ":AppRTCMobile_ios_bundle_data" ]
448      }
449    }
450
451    bundle_data("AppRTCMobile_ios_bundle_data") {
452      sources = [
453        "objc/AppRTCMobile/ios/resources/Roboto-Regular.ttf",
454
455        # Sample video taken from https://media.xiph.org/video/derf/
456        "objc/AppRTCMobile/ios/resources/foreman.mp4",
457        "objc/AppRTCMobile/ios/resources/iPhone5@2x.png",
458        "objc/AppRTCMobile/ios/resources/iPhone6@2x.png",
459        "objc/AppRTCMobile/ios/resources/iPhone6p@3x.png",
460        "objc/AppRTCMobile/ios/resources/ic_call_end_black_24dp.png",
461        "objc/AppRTCMobile/ios/resources/ic_call_end_black_24dp@2x.png",
462        "objc/AppRTCMobile/ios/resources/ic_clear_black_24dp.png",
463        "objc/AppRTCMobile/ios/resources/ic_clear_black_24dp@2x.png",
464        "objc/AppRTCMobile/ios/resources/ic_settings_black_24dp.png",
465        "objc/AppRTCMobile/ios/resources/ic_settings_black_24dp@2x.png",
466        "objc/AppRTCMobile/ios/resources/ic_surround_sound_black_24dp.png",
467        "objc/AppRTCMobile/ios/resources/ic_surround_sound_black_24dp@2x.png",
468        "objc/AppRTCMobile/ios/resources/ic_switch_video_black_24dp.png",
469        "objc/AppRTCMobile/ios/resources/ic_switch_video_black_24dp@2x.png",
470        "objc/AppRTCMobile/ios/resources/mozart.mp3",
471        "objc/Icon-120.png",
472        "objc/Icon-180.png",
473        "objc/Icon.png",
474      ]
475      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
476    }
477
478    rtc_library("ObjCNativeAPIDemo_lib") {
479      testonly = true
480      sources = [
481        "objcnativeapi/objc/NADAppDelegate.h",
482        "objcnativeapi/objc/NADAppDelegate.m",
483        "objcnativeapi/objc/NADViewController.h",
484        "objcnativeapi/objc/NADViewController.mm",
485        "objcnativeapi/objc/objc_call_client.h",
486        "objcnativeapi/objc/objc_call_client.mm",
487      ]
488
489      deps = [
490        "../api:libjingle_peerconnection_api",
491        "../api:scoped_refptr",
492        "../api:sequence_checker",
493        "../api/audio_codecs:builtin_audio_decoder_factory",
494        "../api/audio_codecs:builtin_audio_encoder_factory",
495        "../api/rtc_event_log:rtc_event_log_factory",
496        "../api/task_queue:default_task_queue_factory",
497        "../media:rtc_audio_video",
498        "../modules/audio_processing",
499        "../modules/audio_processing:api",
500        "../pc:libjingle_peerconnection",
501        "../rtc_base",
502        "../rtc_base/synchronization:mutex",
503        "../sdk:base_objc",
504        "../sdk:default_codec_factory_objc",
505        "../sdk:helpers_objc",
506        "../sdk:metal_objc",
507        "../sdk:native_api",
508        "../sdk:videocapture_objc",
509        "../sdk:videotoolbox_objc",
510      ]
511
512      if (rtc_ios_macos_use_opengl_rendering) {
513        deps += [ "../sdk:opengl_ui_objc" ]
514      }
515    }
516
517    ios_app_bundle("ObjCNativeAPIDemo") {
518      testonly = true
519      sources = [ "objcnativeapi/objc/main.m" ]
520
521      info_plist = "objcnativeapi/Info.plist"
522
523      configs += [ "..:common_config" ]
524      public_configs = [ "..:common_inherited_config" ]
525
526      deps = [ ":ObjCNativeAPIDemo_lib" ]
527
528      if (target_cpu == "x86") {
529        deps += [ "//testing/iossim" ]
530      }
531    }
532  }
533
534  if (is_mac) {
535    rtc_library("AppRTCMobile_lib") {
536      testonly = true
537      sources = [
538        "objc/AppRTCMobile/mac/APPRTCAppDelegate.h",
539        "objc/AppRTCMobile/mac/APPRTCAppDelegate.m",
540        "objc/AppRTCMobile/mac/APPRTCViewController.h",
541        "objc/AppRTCMobile/mac/APPRTCViewController.m",
542      ]
543      configs += [ "..:common_objc" ]
544      deps = [
545        ":apprtc_common",
546        ":apprtc_signaling",
547        "../sdk:base_objc",
548        "../sdk:helpers_objc",
549        "../sdk:mediaconstraints_objc",
550        "../sdk:metal_objc",
551        "../sdk:opengl_ui_objc",
552        "../sdk:peerconnectionfactory_base_objc",
553        "../sdk:peerconnectionfactory_base_objc",
554        "../sdk:videocapture_objc",
555        "../sdk:videocodec_objc",
556      ]
557    }
558
559    mac_app_bundle("AppRTCMobile") {
560      testonly = true
561      output_name = "AppRTCMobile"
562
563      sources = [ "objc/AppRTCMobile/mac/main.m" ]
564
565      public_configs = [ "..:common_inherited_config" ]
566
567      info_plist = "objc/AppRTCMobile/mac/Info.plist"
568
569      frameworks = [ "AppKit.framework" ]
570
571      ldflags = [
572        "-rpath",
573        "@executable_path/../Frameworks",
574      ]
575
576      deps = [
577        ":AppRTCMobile_lib",
578        "../sdk:mac_framework_bundle",
579        "../sdk:mac_framework_objc+link",
580      ]
581    }
582  }
583
584  config("socketrocket_include_config") {
585    include_dirs = [ "objc/AppRTCMobile/third_party/SocketRocket" ]
586  }
587
588  config("socketrocket_warning_config") {
589    # GN orders flags on a target before flags from configs. The default config
590    # adds these flags so to cancel them out they need to come from a config and
591    # cannot be on the target directly.
592    cflags = [
593      "-Wno-deprecated-declarations",
594      "-Wno-nonnull",
595      "-Wno-semicolon-before-method-body",
596      "-Wno-unused-variable",
597    ]
598
599    cflags_objc = [
600      # Enabled for cflags_objc in build/config/compiler/BUILD.gn.
601      "-Wno-objc-missing-property-synthesis",
602    ]
603  }
604
605  rtc_library("socketrocket") {
606    testonly = true
607    sources = [
608      "objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.h",
609      "objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m",
610    ]
611    configs += [ ":socketrocket_warning_config" ]
612    public_configs = [ ":socketrocket_include_config" ]
613
614    libs = [ "icucore" ]
615    frameworks = [
616      "CFNetwork.framework",
617      "Security.framework",
618    ]
619  }
620
621  if (rtc_include_tests) {
622    # TODO(kthelgason): compile xctests on mac when chromium supports it.
623    if (is_ios) {
624      rtc_library("apprtcmobile_test_sources") {
625        # iOS must use WebRTC.framework which is dynamically linked.
626        testonly = true
627        include_dirs = [
628          "objc/AppRTCMobile",
629          "objc/AppRTCMobile/ios",
630        ]
631        sources = [
632          "objc/AppRTCMobile/tests/ARDAppClient_xctest.mm",
633          "objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm",
634          "objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm",
635        ]
636        deps = [
637          ":AppRTCMobile_lib",
638          ":apprtc_signaling",
639          "../rtc_base",
640          "../sdk:mediaconstraints_objc",
641          "../sdk:peerconnectionfactory_base_objc",
642          "../sdk:videocapture_objc",
643          "//build/config/ios:xctest",
644          "//third_party/ocmock",
645        ]
646      }
647
648      rtc_test("apprtcmobile_tests") {
649        is_xctest = true
650        info_plist = "objc/AppRTCMobile/ios/Info.plist"
651        sources = [ "objc/AppRTCMobile/tests/main.mm" ]
652        deps = [
653          ":AppRTCMobile_lib",
654          ":apprtcmobile_test_sources",
655          "../sdk:framework_objc",
656          "//test:test_support",
657        ]
658        ldflags = [ "-all_load" ]
659      }
660    }
661  }
662}
663
664if (is_linux || is_chromeos || is_win) {
665  if (is_linux || is_chromeos) {
666    pkg_config("gtk_config") {
667      packages = [
668        # Gtk requires gmodule, but it does not list it as a dependency in some
669        # misconfigured systems.
670        "gmodule-2.0",
671        "gthread-2.0",
672        "gtk+-3.0",
673      ]
674    }
675  }
676
677  rtc_executable("peerconnection_client") {
678    testonly = true
679    sources = [
680      "peerconnection/client/conductor.cc",
681      "peerconnection/client/conductor.h",
682      "peerconnection/client/defaults.cc",
683      "peerconnection/client/defaults.h",
684      "peerconnection/client/peer_connection_client.cc",
685      "peerconnection/client/peer_connection_client.h",
686    ]
687
688    deps = [
689      "../api:audio_options_api",
690      "../api:create_peerconnection_factory",
691      "../api:libjingle_peerconnection_api",
692      "../api:media_stream_interface",
693      "../api:rtp_sender_interface",
694      "../api:scoped_refptr",
695      "../api/audio:audio_mixer_api",
696      "../api/audio_codecs:audio_codecs_api",
697      "../api/task_queue:pending_task_safety_flag",
698      "../api/units:time_delta",
699      "../api/video:video_frame",
700      "../api/video:video_rtp_headers",
701      "../api/video_codecs:video_codecs_api",
702      "../media:rtc_media_base",
703      "../p2p:rtc_p2p",
704      "../pc:video_track_source",
705      "../rtc_base:checks",
706      "../rtc_base:logging",
707      "../rtc_base:macromagic",
708      "../rtc_base:net_helpers",
709      "../rtc_base:refcount",
710      "../rtc_base:stringutils",
711      "../rtc_base:threading",
712      "../rtc_base/third_party/sigslot",
713      "../system_wrappers:field_trial",
714      "../test:field_trial",
715      "../test:platform_video_capturer",
716      "../test:rtp_test_utils",
717      "//third_party/abseil-cpp/absl/memory",
718      "//third_party/abseil-cpp/absl/types:optional",
719    ]
720    if (is_win) {
721      sources += [
722        "peerconnection/client/flag_defs.h",
723        "peerconnection/client/main.cc",
724        "peerconnection/client/main_wnd.cc",
725        "peerconnection/client/main_wnd.h",
726      ]
727      configs += [ "//build/config/win:windowed" ]
728      deps += [
729        "../media:rtc_media_base",
730        "../rtc_base:win32",
731      ]
732    }
733    if (is_linux || is_chromeos) {
734      sources += [
735        "peerconnection/client/linux/main.cc",
736        "peerconnection/client/linux/main_wnd.cc",
737        "peerconnection/client/linux/main_wnd.h",
738      ]
739      cflags = [ "-Wno-deprecated-declarations" ]
740      libs = [
741        "X11",
742        "Xcomposite",
743        "Xext",
744        "Xrender",
745      ]
746      configs += [ ":gtk_config" ]
747    }
748
749    deps += [
750      "../api:libjingle_peerconnection_api",
751      "../api/audio_codecs:builtin_audio_decoder_factory",
752      "../api/audio_codecs:builtin_audio_encoder_factory",
753      "../api/video:video_frame",
754      "../api/video:video_rtp_headers",
755      "../api/video_codecs:builtin_video_decoder_factory",
756      "../api/video_codecs:builtin_video_encoder_factory",
757      "../media:rtc_audio_video",
758      "../modules/audio_device",
759      "../modules/audio_processing",
760      "../modules/audio_processing:api",
761      "../modules/video_capture:video_capture_module",
762      "../pc:libjingle_peerconnection",
763      "../rtc_base",
764      "../rtc_base:rtc_json",
765      "../test:video_test_common",
766      "//third_party/abseil-cpp/absl/flags:flag",
767      "//third_party/abseil-cpp/absl/flags:parse",
768      "//third_party/libyuv",
769    ]
770  }
771
772  rtc_executable("peerconnection_server") {
773    testonly = true
774    sources = [
775      "peerconnection/server/data_socket.cc",
776      "peerconnection/server/data_socket.h",
777      "peerconnection/server/main.cc",
778      "peerconnection/server/peer_channel.cc",
779      "peerconnection/server/peer_channel.h",
780      "peerconnection/server/utils.cc",
781      "peerconnection/server/utils.h",
782    ]
783    deps = [
784      "../rtc_base:checks",
785      "../rtc_base:stringutils",
786      "../system_wrappers:field_trial",
787      "../test:field_trial",
788      "//third_party/abseil-cpp/absl/flags:flag",
789      "//third_party/abseil-cpp/absl/flags:parse",
790      "//third_party/abseil-cpp/absl/flags:usage",
791    ]
792  }
793  rtc_executable("turnserver") {
794    testonly = true
795    sources = [ "turnserver/turnserver_main.cc" ]
796    deps = [
797      ":read_auth_file",
798      "../p2p:p2p_server_utils",
799      "../p2p:rtc_p2p",
800      "../pc:rtc_pc",
801      "../rtc_base",
802      "../rtc_base:ip_address",
803      "../rtc_base:socket_address",
804      "../rtc_base:socket_server",
805      "../rtc_base:threading",
806      "//third_party/abseil-cpp/absl/strings:strings",
807    ]
808  }
809  rtc_executable("stunserver") {
810    testonly = true
811    sources = [ "stunserver/stunserver_main.cc" ]
812    deps = [
813      "../p2p:p2p_server_utils",
814      "../p2p:rtc_p2p",
815      "../pc:rtc_pc",
816      "../rtc_base",
817      "../rtc_base:socket_address",
818      "../rtc_base:socket_server",
819      "../rtc_base:threading",
820    ]
821  }
822}
823
824if (is_win || is_android) {
825  rtc_shared_library("webrtc_unity_plugin") {
826    testonly = true
827    sources = [
828      "unityplugin/simple_peer_connection.cc",
829      "unityplugin/simple_peer_connection.h",
830      "unityplugin/unity_plugin_apis.cc",
831      "unityplugin/unity_plugin_apis.h",
832      "unityplugin/video_observer.cc",
833      "unityplugin/video_observer.h",
834    ]
835
836    if (is_android) {
837      sources += [
838        "unityplugin/class_reference_holder.cc",
839        "unityplugin/class_reference_holder.h",
840        "unityplugin/jni_onload.cc",
841      ]
842      suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
843    }
844
845    if (is_win) {
846      configs += [ "//build/config/win:windowed" ]
847    }
848    deps = [
849      "../api:create_peerconnection_factory",
850      "../api:libjingle_peerconnection_api",
851      "../api:media_stream_interface",
852      "../api/audio_codecs:builtin_audio_decoder_factory",
853      "../api/audio_codecs:builtin_audio_encoder_factory",
854      "../api/video:video_frame",
855      "../api/video:video_rtp_headers",
856      "../media:rtc_audio_video",
857      "../media:rtc_internal_video_codecs",
858      "../media:rtc_media",
859      "../media:rtc_media_base",
860      "../modules/audio_device",
861      "../modules/audio_processing",
862      "../modules/audio_processing:api",
863      "../modules/video_capture:video_capture_module",
864      "../pc:libjingle_peerconnection",
865      "../pc:video_track_source",
866      "../rtc_base",
867      "../test:platform_video_capturer",
868      "../test:video_test_common",
869      "//third_party/abseil-cpp/absl/memory",
870    ]
871    if (is_android) {
872      deps += [
873        "../modules/utility",
874        "../sdk/android:libjingle_peerconnection_jni",
875        "../sdk/android:native_api_jni",
876      ]
877    }
878  }
879}
880
881if (is_android) {
882  rtc_android_library("webrtc_unity_java") {
883    sources = [ "unityplugin/java/src/org/webrtc/UnityUtility.java" ]
884    deps = [
885      "../rtc_base:base_java",
886      "../sdk/android:camera_java",
887      "../sdk/android:libjingle_peerconnection_java",
888      "../sdk/android:peerconnection_java",
889      "../sdk/android:video_api_java",
890      "../sdk/android:video_java",
891      "//third_party/androidx:androidx_annotation_annotation_java",
892    ]
893  }
894
895  dist_jar("libwebrtc_unity") {
896    _target_dir_name = get_label_info(":$target_name", "dir")
897    output = "${root_out_dir}/lib.java${_target_dir_name}/${target_name}.jar"
898    direct_deps_only = false
899    use_interface_jars = false
900    use_unprocessed_jars = false
901    requires_android = true
902    deps = [
903      ":webrtc_unity_java",
904      "../rtc_base:base_java",
905      "../sdk/android:libjingle_peerconnection_java",
906      "../sdk/android:libjingle_peerconnection_metrics_default_java",
907      "//third_party/androidx:androidx_annotation_annotation_java",
908    ]
909  }
910
911  robolectric_binary("android_examples_junit_tests") {
912    sources = [
913      "androidjunit/src/org/appspot/apprtc/BluetoothManagerTest.java",
914      "androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
915      "androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
916    ]
917
918    deps = [
919      ":AppRTCMobile_javalib",
920      "../sdk/android:peerconnection_java",
921      "//third_party/androidx:androidx_test_core_java",
922      "//third_party/google-truth:google_truth_java",
923    ]
924
925    additional_jar_files = [ [
926          "../sdk/android/tests/resources/robolectric.properties",
927          "robolectric.properties",
928        ] ]
929  }
930}
931
932if (!build_with_chromium) {
933  # Doesn't build within Chrome on Win.
934  rtc_executable("stun_prober") {
935    testonly = true
936    sources = [ "stunprober/main.cc" ]
937    deps = [
938      "../p2p:libstunprober",
939      "../p2p:rtc_p2p",
940      "../rtc_base",
941      "../rtc_base:checks",
942      "../rtc_base:logging",
943      "../rtc_base:socket_address",
944      "../rtc_base:threading",
945      "../rtc_base:timeutils",
946      "../test:scoped_key_value_config",
947      "//third_party/abseil-cpp/absl/flags:flag",
948      "//third_party/abseil-cpp/absl/flags:parse",
949    ]
950  }
951}
952