blob: 7f56fd8dcb9fb1feb6f0a617ab6cd12f2dd65cc3 [file] [log] [blame]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +00001# Copyright (c) 2014 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
kjellanderbac04122016-06-02 02:18:48 -07009if (is_android) {
10 import("//build/config/android/config.gni")
11 import("//build/config/android/rules.gni")
12}
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000013import("../build/webrtc.gni")
14
kjellanderb62dbbe2016-09-23 00:38:52 -070015rtc_static_library("system_wrappers") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000016 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010017 "include/aligned_array.h",
18 "include/aligned_malloc.h",
19 "include/atomic32.h",
20 "include/clock.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010021 "include/cpu_features_wrapper.h",
22 "include/cpu_info.h",
23 "include/critical_section_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010024 "include/event_wrapper.h",
25 "include/field_trial.h",
26 "include/file_wrapper.h",
27 "include/fix_interlocked_exchange_pointer_win.h",
28 "include/logging.h",
29 "include/metrics.h",
kjellander080a1e32016-05-25 11:37:11 -070030 "include/ntp_time.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010031 "include/rtp_to_ntp.h",
32 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010033 "include/sleep.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010034 "include/static_instance.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010035 "include/stringize_macros.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010036 "include/timestamp_extrapolator.h",
37 "include/trace.h",
38 "include/utf_util_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000039 "source/aligned_malloc.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000040 "source/atomic32_win.cc",
41 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000042 "source/condition_variable_event_win.cc",
43 "source/condition_variable_event_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000044 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020045 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000046 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020047 "source/event_timer_posix.cc",
48 "source/event_timer_posix.h",
49 "source/event_timer_win.cc",
50 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000051 "source/file_impl.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000052 "source/logging.cc",
53 "source/rtp_to_ntp.cc",
54 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000055 "source/rw_lock_posix.cc",
56 "source/rw_lock_posix.h",
57 "source/rw_lock_win.cc",
58 "source/rw_lock_win.h",
tommi61046eb2016-01-19 02:59:56 -080059 "source/rw_lock_winxp_win.cc",
60 "source/rw_lock_winxp_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000061 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000062 "source/timestamp_extrapolator.cc",
63 "source/trace_impl.cc",
64 "source/trace_impl.h",
65 "source/trace_posix.cc",
66 "source/trace_posix.h",
67 "source/trace_win.cc",
68 "source/trace_win.h",
69 ]
70
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000071 defines = []
72 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020073 deps = [
74 "..:webrtc_common",
75 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000076
77 if (is_android) {
78 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010079 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000080 "source/logcat_trace_context.cc",
81 ]
82
sprange791ffd2016-01-26 01:53:20 -080083 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000084
kjellander@webrtc.org62711f82014-06-29 13:37:08 +000085 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000086
87 libs += [ "log" ]
88 }
89
90 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080091 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000092
simon.hosie953b1c12016-04-06 14:02:26 -070093 if (!build_with_chromium) {
94 deps += [ ":cpu_features_linux" ]
95 }
96
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000097 libs += [ "rt" ]
98 }
99
kjellander080a1e32016-05-25 11:37:11 -0700100 if (is_linux || is_android) {
101 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000102 }
103
104 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -0800105 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -0700106 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000107 }
108
kjellander8f4419b2016-06-02 02:09:52 -0700109 # TODO(jschuh): Bug 1348: fix this warning.
110 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
111
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000112 if (is_win) {
113 libs += [ "winmm.lib" ]
114
kjellander8f4419b2016-06-02 02:09:52 -0700115 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000116 }
117
ehmaldonado3e3b6f22016-08-29 02:56:06 -0700118 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700119 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700120 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700121 }
122
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200123 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000124}
125
kjellanderb62dbbe2016-09-23 00:38:52 -0700126rtc_static_library("field_trial_default") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000127 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100128 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000129 "source/field_trial_default.cc",
130 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000131}
132
kjellanderb62dbbe2016-09-23 00:38:52 -0700133rtc_static_library("metrics_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000134 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700135 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000136 "source/metrics_default.cc",
137 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000138}
139
kjellanderb62dbbe2016-09-23 00:38:52 -0700140group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000141 deps = [
142 ":field_trial_default",
143 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800144 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000145 ]
146}
147
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000148if (is_android) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700149 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000150 sources = [
151 "source/cpu_features_android.c",
152 ]
153
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200154 deps = [
155 "//third_party/android_tools:cpu_features",
156 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000157 }
158}
simon.hosie953b1c12016-04-06 14:02:26 -0700159
160if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700161 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700162 sources = [
163 "source/cpu_features_linux.c",
164 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700165 }
166}
kjellanderbac04122016-06-02 02:18:48 -0700167
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200168if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700169 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200170 testonly = true
171 sources = [
172 "source/aligned_array_unittest.cc",
173 "source/aligned_malloc_unittest.cc",
174 "source/clock_unittest.cc",
175 "source/condition_variable_unittest.cc",
176 "source/critical_section_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200177 "source/event_timer_posix_unittest.cc",
178 "source/logging_unittest.cc",
179 "source/metrics_default_unittest.cc",
180 "source/metrics_unittest.cc",
181 "source/ntp_time_unittest.cc",
182 "source/rtp_to_ntp_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200183 "source/stringize_macros_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700184 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200185 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700186
kjellandere40a7ee2016-10-16 23:56:12 -0700187 if (!build_with_chromium && is_clang) {
188 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700189 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200190 }
kjellanderbac04122016-06-02 02:18:48 -0700191
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200192 deps = [
193 ":metrics_default",
194 ":system_wrappers",
ehmaldonado26bddb92016-11-30 06:12:01 -0800195 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200196 "//testing/gtest",
197 ]
kjellanderbac04122016-06-02 02:18:48 -0700198
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200199 if (is_android) {
200 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700201
202 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200203 }
kjellanderbac04122016-06-02 02:18:48 -0700204 }
205}