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{
10  'includes': [ '../../build/common.gypi', ],
11  'targets': [
12    {
13      'target_name': 'system_wrappers',
14      'type': 'static_library',
15      'include_dirs': [
16        'spreadsortlib',
17        '../interface',
18      ],
19      'dependencies': [
20        '../../base/base.gyp:rtc_base_approved',
21      ],
22      'direct_dependent_settings': {
23        'include_dirs': [
24          '../interface',
25        ],
26      },
27      'sources': [
28        '../interface/aligned_malloc.h',
29        '../interface/atomic32.h',
30        '../interface/clock.h',
31        '../interface/compile_assert.h',
32        '../interface/condition_variable_wrapper.h',
33        '../interface/cpu_info.h',
34        '../interface/cpu_features_wrapper.h',
35        '../interface/critical_section_wrapper.h',
36        '../interface/data_log.h',
37        '../interface/data_log_c.h',
38        '../interface/data_log_impl.h',
39        '../interface/event_tracer.h',
40        '../interface/event_wrapper.h',
41        '../interface/field_trial.h',
42        '../interface/file_wrapper.h',
43        '../interface/fix_interlocked_exchange_pointer_win.h',
44        '../interface/logcat_trace_context.h',
45        '../interface/logging.h',
46        '../interface/ref_count.h',
47        '../interface/rtp_to_ntp.h',
48        '../interface/rw_lock_wrapper.h',
49        '../interface/scoped_ptr.h',
50        '../interface/scoped_refptr.h',
51        '../interface/scoped_vector.h',
52        '../interface/sleep.h',
53        '../interface/sort.h',
54        '../interface/static_instance.h',
55        '../interface/stl_util.h',
56        '../interface/stringize_macros.h',
57        '../interface/thread_wrapper.h',
58        '../interface/tick_util.h',
59        '../interface/timestamp_extrapolator.h',
60        '../interface/trace.h',
61        '../interface/trace_event.h',
62        '../interface/utf_util_win.h',
63        'aligned_malloc.cc',
64        'atomic32_mac.cc',
65        'atomic32_posix.cc',
66        'atomic32_win.cc',
67        'clock.cc',
68        'condition_variable.cc',
69        'condition_variable_posix.cc',
70        'condition_variable_posix.h',
71        'condition_variable_event_win.cc',
72        'condition_variable_event_win.h',
73        'condition_variable_native_win.cc',
74        'condition_variable_native_win.h',
75        'cpu_info.cc',
76        'cpu_features.cc',
77        'critical_section.cc',
78        'critical_section_posix.cc',
79        'critical_section_posix.h',
80        'critical_section_win.cc',
81        'critical_section_win.h',
82        'data_log.cc',
83        'data_log_c.cc',
84        'data_log_no_op.cc',
85        'event.cc',
86        'event_posix.cc',
87        'event_posix.h',
88        'event_tracer.cc',
89        'event_win.cc',
90        'event_win.h',
91        'file_impl.cc',
92        'file_impl.h',
93        'logcat_trace_context.cc',
94        'logging.cc',
95        'rtp_to_ntp.cc',
96        'rw_lock.cc',
97        'rw_lock_generic.cc',
98        'rw_lock_generic.h',
99        'rw_lock_posix.cc',
100        'rw_lock_posix.h',
101        'rw_lock_win.cc',
102        'rw_lock_win.h',
103        'set_thread_name_win.h',
104        'sleep.cc',
105        'sort.cc',
106        'tick_util.cc',
107        'thread.cc',
108        'thread_posix.cc',
109        'thread_posix.h',
110        'thread_win.cc',
111        'thread_win.h',
112        'timestamp_extrapolator.cc',
113        'trace_impl.cc',
114        'trace_impl.h',
115        'trace_posix.cc',
116        'trace_posix.h',
117        'trace_win.cc',
118        'trace_win.h',
119      ],
120      'conditions': [
121        ['enable_data_logging==1', {
122          'sources!': [ 'data_log_no_op.cc', ],
123        }, {
124          'sources!': [ 'data_log.cc', ],
125        },],
126        ['OS=="android"', {
127          'defines': [
128            'WEBRTC_THREAD_RR',
129            # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
130            # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
131            # remove it after I verify that CLOCK_MONOTONIC is fully functional
132            # with condition and event functions in system_wrappers.
133            'WEBRTC_CLOCK_TYPE_REALTIME',
134           ],
135          'dependencies': [ 'cpu_features_android', ],
136          'link_settings': {
137            'libraries': [
138              '-llog',
139            ],
140          },
141        }, {  # OS!="android"
142          'sources!': [
143            '../interface/logcat_trace_context.h',
144            'logcat_trace_context.cc',
145          ],
146        }],
147        ['OS=="linux"', {
148          'defines': [
149            'WEBRTC_THREAD_RR',
150            # TODO(andrew): can we select this automatically?
151            # Define this if the Linux system does not support CLOCK_MONOTONIC.
152            #'WEBRTC_CLOCK_TYPE_REALTIME',
153          ],
154          'link_settings': {
155            'libraries': [ '-lrt', ],
156          },
157        }],
158        ['OS=="mac"', {
159          'link_settings': {
160            'libraries': [ '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework', ],
161          },
162          'sources!': [
163            'atomic32_posix.cc',
164          ],
165        }],
166        ['OS=="ios" or OS=="mac"', {
167          'defines': [
168            'WEBRTC_THREAD_RR',
169            'WEBRTC_CLOCK_TYPE_REALTIME',
170          ],
171        }],
172        ['OS=="win"', {
173          'link_settings': {
174            'libraries': [ '-lwinmm.lib', ],
175          },
176        }],
177      ], # conditions
178      'target_conditions': [
179        # We need to do this in a target_conditions block to override the
180        # filename_rules filters.
181        ['OS=="ios"', {
182          # Pull in specific Mac files for iOS (which have been filtered out
183          # by file name rules).
184          'sources/': [
185            ['include', '^atomic32_mac\\.'],
186          ],
187          'sources!': [
188            'atomic32_posix.cc',
189          ],
190        }],
191      ],
192      # Disable warnings to enable Win64 build, issue 1323.
193      'msvs_disabled_warnings': [
194        4267,  # size_t to int truncation.
195        4334,  # Ignore warning on shift operator promotion.
196      ],
197    }, {
198      'target_name': 'field_trial_default',
199      'type': 'static_library',
200      'sources': [
201        'field_trial_default.cc',
202      ],
203      'dependencies': [
204        'system_wrappers',
205      ]
206    },
207  ], # targets
208  'conditions': [
209    ['OS=="android"', {
210      'targets': [
211        {
212          'target_name': 'cpu_features_android',
213          'type': 'static_library',
214          'sources': [
215            'cpu_features_android.c',
216          ],
217          'conditions': [
218            ['android_webview_build == 1', {
219              'libraries': [
220                'cpufeatures.a'
221              ],
222            }, {
223              'dependencies': [
224                '<(android_ndk_root)/android_tools_ndk.gyp:cpu_features',
225              ],
226            }],
227          ],
228        },
229      ],
230    }],
231  ], # conditions
232}
233
234