1# Copyright (c) 2012 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{
9  'includes': [
10    '../talk/build/common.gypi',
11  ],
12  'targets': [
13    {
14      'target_name': 'relayserver',
15      'type': 'executable',
16      'dependencies': [
17        '../talk/libjingle.gyp:libjingle',
18        '../talk/libjingle.gyp:libjingle_p2p',
19      ],
20      'sources': [
21        'examples/relayserver/relayserver_main.cc',
22      ],
23    },  # target relayserver
24    {
25      'target_name': 'stunserver',
26      'type': 'executable',
27      'dependencies': [
28        '../talk/libjingle.gyp:libjingle',
29        '../talk/libjingle.gyp:libjingle_p2p',
30      ],
31      'sources': [
32        'examples/stunserver/stunserver_main.cc',
33      ],
34    },  # target stunserver
35    {
36      'target_name': 'turnserver',
37      'type': 'executable',
38      'dependencies': [
39        '../talk/libjingle.gyp:libjingle',
40        '../talk/libjingle.gyp:libjingle_p2p',
41      ],
42      'sources': [
43        'examples/turnserver/turnserver_main.cc',
44      ],
45    },  # target turnserver
46    {
47      'target_name': 'peerconnection_server',
48      'type': 'executable',
49      'sources': [
50        'examples/peerconnection/server/data_socket.cc',
51        'examples/peerconnection/server/data_socket.h',
52        'examples/peerconnection/server/main.cc',
53        'examples/peerconnection/server/peer_channel.cc',
54        'examples/peerconnection/server/peer_channel.h',
55        'examples/peerconnection/server/utils.cc',
56        'examples/peerconnection/server/utils.h',
57      ],
58      'dependencies': [
59        '<(webrtc_root)/common.gyp:webrtc_common',
60        '../talk/libjingle.gyp:libjingle',
61      ],
62      # TODO(ronghuawu): crbug.com/167187 fix size_t to int truncations.
63      'msvs_disabled_warnings': [ 4309, ],
64    }, # target peerconnection_server
65  ],
66  'conditions': [
67    ['OS=="linux" or OS=="win"', {
68      'targets': [
69        {
70          'target_name': 'peerconnection_client',
71          'type': 'executable',
72          'sources': [
73            'examples/peerconnection/client/conductor.cc',
74            'examples/peerconnection/client/conductor.h',
75            'examples/peerconnection/client/defaults.cc',
76            'examples/peerconnection/client/defaults.h',
77            'examples/peerconnection/client/peer_connection_client.cc',
78            'examples/peerconnection/client/peer_connection_client.h',
79          ],
80          'dependencies': [
81            '../talk/libjingle.gyp:libjingle_peerconnection',
82            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
83            '<@(libjingle_tests_additional_deps)',
84          ],
85          'conditions': [
86            ['build_json==1', {
87              'dependencies': [
88                '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
89              ],
90            }],
91            # TODO(ronghuawu): Move these files to a win/ directory then they
92            # can be excluded automatically.
93            ['OS=="win"', {
94              'sources': [
95                'examples/peerconnection/client/flagdefs.h',
96                'examples/peerconnection/client/main.cc',
97                'examples/peerconnection/client/main_wnd.cc',
98                'examples/peerconnection/client/main_wnd.h',
99              ],
100              'msvs_settings': {
101                'VCLinkerTool': {
102                 'SubSystem': '2',  # Windows
103                },
104              },
105            }],  # OS=="win"
106            ['OS=="win" and clang==1', {
107              'msvs_settings': {
108                'VCCLCompilerTool': {
109                  'AdditionalOptions': [
110                    # Disable warnings failing when compiling with Clang on Windows.
111                    # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
112                    '-Wno-reorder',
113                    '-Wno-unused-function',
114                  ],
115                },
116              },
117            }], # OS=="win" and clang==1
118            ['OS=="linux"', {
119              'sources': [
120                'examples/peerconnection/client/linux/main.cc',
121                'examples/peerconnection/client/linux/main_wnd.cc',
122                'examples/peerconnection/client/linux/main_wnd.h',
123              ],
124              'cflags': [
125                '<!@(pkg-config --cflags glib-2.0 gobject-2.0 gtk+-2.0)',
126              ],
127              'link_settings': {
128                'ldflags': [
129                  '<!@(pkg-config --libs-only-L --libs-only-other glib-2.0'
130                      ' gobject-2.0 gthread-2.0 gtk+-2.0)',
131                ],
132                'libraries': [
133                  '<!@(pkg-config --libs-only-l glib-2.0 gobject-2.0'
134                      ' gthread-2.0 gtk+-2.0)',
135                  '-lX11',
136                  '-lXcomposite',
137                  '-lXext',
138                  '-lXrender',
139                ],
140              },
141            }],  # OS=="linux"
142          ],  # conditions
143        },  # target peerconnection_client
144      ], # targets
145    }],  # OS=="linux" or OS=="win"
146
147    ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
148      'targets': [
149        {
150          'target_name': 'apprtc_common',
151          'type': 'static_library',
152          'dependencies': [
153            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
154            '../talk/libjingle.gyp:libjingle_peerconnection_objc',
155          ],
156          'sources': [
157            'examples/objc/AppRTCDemo/common/ARDUtilities.h',
158            'examples/objc/AppRTCDemo/common/ARDUtilities.m',
159          ],
160          'include_dirs': [
161            'examples/objc/AppRTCDemo/common',
162          ],
163          'direct_dependent_settings': {
164            'include_dirs': [
165              'examples/objc/AppRTCDemo/common',
166            ],
167          },
168          'conditions': [
169            ['OS=="mac"', {
170              'xcode_settings': {
171                'MACOSX_DEPLOYMENT_TARGET' : '10.8',
172              },
173            }],
174          ],
175          'link_settings': {
176            'xcode_settings': {
177              'OTHER_LDFLAGS': [
178                '-framework QuartzCore',
179              ],
180            },
181          },
182        },
183        {
184          'target_name': 'apprtc_signaling',
185          'type': 'static_library',
186          'dependencies': [
187            'apprtc_common',
188            '../talk/libjingle.gyp:libjingle_peerconnection_objc',
189            'socketrocket',
190          ],
191          'sources': [
192            'examples/objc/AppRTCDemo/ARDAppClient.h',
193            'examples/objc/AppRTCDemo/ARDAppClient.m',
194            'examples/objc/AppRTCDemo/ARDAppClient+Internal.h',
195            'examples/objc/AppRTCDemo/ARDAppEngineClient.h',
196            'examples/objc/AppRTCDemo/ARDAppEngineClient.m',
197            'examples/objc/AppRTCDemo/ARDBitrateTracker.h',
198            'examples/objc/AppRTCDemo/ARDBitrateTracker.m',
199            'examples/objc/AppRTCDemo/ARDCEODTURNClient.h',
200            'examples/objc/AppRTCDemo/ARDCEODTURNClient.m',
201            'examples/objc/AppRTCDemo/ARDJoinResponse.h',
202            'examples/objc/AppRTCDemo/ARDJoinResponse.m',
203            'examples/objc/AppRTCDemo/ARDJoinResponse+Internal.h',
204            'examples/objc/AppRTCDemo/ARDMessageResponse.h',
205            'examples/objc/AppRTCDemo/ARDMessageResponse.m',
206            'examples/objc/AppRTCDemo/ARDMessageResponse+Internal.h',
207            'examples/objc/AppRTCDemo/ARDRoomServerClient.h',
208            'examples/objc/AppRTCDemo/ARDSDPUtils.h',
209            'examples/objc/AppRTCDemo/ARDSDPUtils.m',
210            'examples/objc/AppRTCDemo/ARDSignalingChannel.h',
211            'examples/objc/AppRTCDemo/ARDSignalingMessage.h',
212            'examples/objc/AppRTCDemo/ARDSignalingMessage.m',
213            'examples/objc/AppRTCDemo/ARDStatsBuilder.h',
214            'examples/objc/AppRTCDemo/ARDStatsBuilder.m',
215            'examples/objc/AppRTCDemo/ARDTURNClient.h',
216            'examples/objc/AppRTCDemo/ARDWebSocketChannel.h',
217            'examples/objc/AppRTCDemo/ARDWebSocketChannel.m',
218            'examples/objc/AppRTCDemo/RTCICECandidate+JSON.h',
219            'examples/objc/AppRTCDemo/RTCICECandidate+JSON.m',
220            'examples/objc/AppRTCDemo/RTCICEServer+JSON.h',
221            'examples/objc/AppRTCDemo/RTCICEServer+JSON.m',
222            'examples/objc/AppRTCDemo/RTCMediaConstraints+JSON.h',
223            'examples/objc/AppRTCDemo/RTCMediaConstraints+JSON.m',
224            'examples/objc/AppRTCDemo/RTCSessionDescription+JSON.h',
225            'examples/objc/AppRTCDemo/RTCSessionDescription+JSON.m',
226          ],
227          'include_dirs': [
228            'examples/objc/AppRTCDemo',
229          ],
230          'direct_dependent_settings': {
231            'include_dirs': [
232              'examples/objc/AppRTCDemo',
233            ],
234          },
235          'export_dependent_settings': [
236            '../talk/libjingle.gyp:libjingle_peerconnection_objc',
237          ],
238          'conditions': [
239            ['OS=="mac"', {
240              'xcode_settings': {
241                'MACOSX_DEPLOYMENT_TARGET' : '10.8',
242              },
243            }],
244          ],
245        },
246        {
247          'target_name': 'AppRTCDemo',
248          'type': 'executable',
249          'product_name': 'AppRTCDemo',
250          'mac_bundle': 1,
251          'dependencies': [
252            'apprtc_common',
253            'apprtc_signaling',
254          ],
255          'conditions': [
256            ['OS=="ios"', {
257              'mac_bundle_resources': [
258                'examples/objc/AppRTCDemo/ios/resources/iPhone5@2x.png',
259                'examples/objc/AppRTCDemo/ios/resources/iPhone6@2x.png',
260                'examples/objc/AppRTCDemo/ios/resources/iPhone6p@3x.png',
261                'examples/objc/AppRTCDemo/ios/resources/Roboto-Regular.ttf',
262                'examples/objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp.png',
263                'examples/objc/AppRTCDemo/ios/resources/ic_call_end_black_24dp@2x.png',
264                'examples/objc/AppRTCDemo/ios/resources/ic_clear_black_24dp.png',
265                'examples/objc/AppRTCDemo/ios/resources/ic_clear_black_24dp@2x.png',
266                'examples/objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp.png',
267                'examples/objc/AppRTCDemo/ios/resources/ic_switch_video_black_24dp@2x.png',
268                'examples/objc/Icon.png',
269              ],
270              'sources': [
271                'examples/objc/AppRTCDemo/ios/ARDAppDelegate.h',
272                'examples/objc/AppRTCDemo/ios/ARDAppDelegate.m',
273                'examples/objc/AppRTCDemo/ios/ARDMainView.h',
274                'examples/objc/AppRTCDemo/ios/ARDMainView.m',
275                'examples/objc/AppRTCDemo/ios/ARDMainViewController.h',
276                'examples/objc/AppRTCDemo/ios/ARDMainViewController.m',
277                'examples/objc/AppRTCDemo/ios/ARDStatsView.h',
278                'examples/objc/AppRTCDemo/ios/ARDStatsView.m',
279                'examples/objc/AppRTCDemo/ios/ARDVideoCallView.h',
280                'examples/objc/AppRTCDemo/ios/ARDVideoCallView.m',
281                'examples/objc/AppRTCDemo/ios/ARDVideoCallViewController.h',
282                'examples/objc/AppRTCDemo/ios/ARDVideoCallViewController.m',
283                'examples/objc/AppRTCDemo/ios/AppRTCDemo-Prefix.pch',
284                'examples/objc/AppRTCDemo/ios/UIImage+ARDUtilities.h',
285                'examples/objc/AppRTCDemo/ios/UIImage+ARDUtilities.m',
286                'examples/objc/AppRTCDemo/ios/main.m',
287              ],
288              'xcode_settings': {
289                'INFOPLIST_FILE': 'examples/objc/AppRTCDemo/ios/Info.plist',
290              },
291            }],
292            ['OS=="mac"', {
293              'sources': [
294                'examples/objc/AppRTCDemo/mac/APPRTCAppDelegate.h',
295                'examples/objc/AppRTCDemo/mac/APPRTCAppDelegate.m',
296                'examples/objc/AppRTCDemo/mac/APPRTCViewController.h',
297                'examples/objc/AppRTCDemo/mac/APPRTCViewController.m',
298                'examples/objc/AppRTCDemo/mac/main.m',
299              ],
300              'xcode_settings': {
301                'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
302                'INFOPLIST_FILE': 'examples/objc/AppRTCDemo/mac/Info.plist',
303                'MACOSX_DEPLOYMENT_TARGET' : '10.8',
304                'OTHER_LDFLAGS': [
305                  '-framework AVFoundation',
306                ],
307              },
308            }],
309            ['target_arch=="ia32"', {
310              'dependencies' : [
311                '<(DEPTH)/testing/iossim/iossim.gyp:iossim#host',
312              ],
313            }],
314          ],
315        },  # target AppRTCDemo
316        {
317          # TODO(tkchin): move this into the real third party location and
318          # have it mirrored on chrome infra.
319          'target_name': 'socketrocket',
320          'type': 'static_library',
321          'sources': [
322            'examples/objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.h',
323            'examples/objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.m',
324          ],
325          'conditions': [
326            ['OS=="mac"', {
327              'xcode_settings': {
328                # SocketRocket autosynthesizes some properties. Disable the
329                # warning so we can compile successfully.
330                'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
331                'MACOSX_DEPLOYMENT_TARGET' : '10.8',
332                # SRWebSocket.m uses code with partial availability.
333                # https://code.google.com/p/webrtc/issues/detail?id=4695
334                'WARNING_CFLAGS!': ['-Wpartial-availability'],
335              },
336            }],
337          ],
338          'direct_dependent_settings': {
339            'include_dirs': [
340              'examples/objc/AppRTCDemo/third_party/SocketRocket',
341            ],
342          },
343          'xcode_settings': {
344            'CLANG_ENABLE_OBJC_ARC': 'YES',
345            'WARNING_CFLAGS': [
346              '-Wno-deprecated-declarations',
347              '-Wno-nonnull',
348            ],
349          },
350          'link_settings': {
351            'xcode_settings': {
352              'OTHER_LDFLAGS': [
353                '-framework CFNetwork',
354                '-licucore',
355              ],
356            },
357          }
358        },  # target socketrocket
359      ],  # targets
360    }],  # OS=="ios" or (OS=="mac" and target_arch!="ia32")
361
362    ['OS=="android"', {
363      'targets': [
364        {
365          'target_name': 'AppRTCDemo',
366          'type': 'none',
367          'dependencies': [
368            '../talk/libjingle.gyp:libjingle_peerconnection_java',
369          ],
370          'variables': {
371            'apk_name': 'AppRTCDemo',
372            'java_in_dir': 'examples/androidapp',
373            'has_java_resources': 1,
374            'resource_dir': 'examples/androidapp/res',
375            'R_package': 'org.appspot.apprtc',
376            'R_package_relpath': 'org/appspot/apprtc',
377            'input_jars_paths': [
378              'examples/androidapp/third_party/autobanh/autobanh.jar',
379             ],
380            'library_dexed_jars_paths': [
381              'examples/androidapp/third_party/autobanh/autobanh.jar',
382             ],
383            'native_lib_target': 'libjingle_peerconnection_so',
384            'add_to_dependents_classpaths':1,
385          },
386          'includes': [ '../build/java_apk.gypi' ],
387        },  # target AppRTCDemo
388
389        {
390          # AppRTCDemo creates a .jar as a side effect. Any java targets
391          # that need that .jar in their classpath should depend on this target,
392          # AppRTCDemo_apk. Dependents of AppRTCDemo_apk receive its
393          # jar path in the variable 'apk_output_jar_path'.
394          # This target should only be used by targets which instrument
395          # AppRTCDemo_apk.
396          'target_name': 'AppRTCDemo_apk',
397          'type': 'none',
398          'dependencies': [
399             'AppRTCDemo',
400           ],
401           'includes': [ '../build/apk_fake_jar.gypi' ],
402        },  # target AppRTCDemo_apk
403
404        {
405          'target_name': 'AppRTCDemoTest',
406          'type': 'none',
407          'dependencies': [
408            'AppRTCDemo_apk',
409           ],
410          'variables': {
411            'apk_name': 'AppRTCDemoTest',
412            'java_in_dir': 'examples/androidtests',
413            'is_test_apk': 1,
414          },
415          'includes': [ '../build/java_apk.gypi' ],
416        },
417      ],  # targets
418    }],  # OS=="android"
419  ],
420}
421