blob: 29ee8b87de42db75f95ba895cfcd04a033099686 [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}
mbonadei9aa3f0a2017-01-24 06:58:22 -080013import("../webrtc.gni")
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000014
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_info.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010022 "include/event_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010023 "include/file_wrapper.h",
24 "include/fix_interlocked_exchange_pointer_win.h",
kjellander080a1e32016-05-25 11:37:11 -070025 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080026 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010027 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010028 "include/sleep.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010029 "include/static_instance.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010030 "include/timestamp_extrapolator.h",
31 "include/trace.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 "source/aligned_malloc.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000033 "source/atomic32_win.cc",
34 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000035 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020036 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000037 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020038 "source/event_timer_posix.cc",
39 "source/event_timer_posix.h",
40 "source/event_timer_win.cc",
41 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000042 "source/file_impl.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080043 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000044 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000045 "source/rw_lock_posix.cc",
46 "source/rw_lock_posix.h",
47 "source/rw_lock_win.cc",
48 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000049 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000050 "source/timestamp_extrapolator.cc",
51 "source/trace_impl.cc",
52 "source/trace_impl.h",
53 "source/trace_posix.cc",
54 "source/trace_posix.h",
55 "source/trace_win.cc",
56 "source/trace_win.h",
57 ]
58
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000059 defines = []
60 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020061 deps = [
62 "..:webrtc_common",
63 ]
kjellander8a116632017-04-21 05:17:08 -070064 public_deps = [
65 ":cpu_features_api",
66 ":field_trial_api",
67 ":metrics_api",
68 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000069
70 if (is_android) {
71 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010072 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000073 "source/logcat_trace_context.cc",
74 ]
75
sprange791ffd2016-01-26 01:53:20 -080076 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000077
kjellander@webrtc.org62711f82014-06-29 13:37:08 +000078 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000079
80 libs += [ "log" ]
81 }
82
83 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080084 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000085
simon.hosie953b1c12016-04-06 14:02:26 -070086 if (!build_with_chromium) {
87 deps += [ ":cpu_features_linux" ]
88 }
89
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000090 libs += [ "rt" ]
91 }
92
kjellander080a1e32016-05-25 11:37:11 -070093 if (is_linux || is_android) {
94 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000095 }
96
97 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080098 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -070099 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000100 }
101
kjellander8f4419b2016-06-02 02:09:52 -0700102 # TODO(jschuh): Bug 1348: fix this warning.
103 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
104
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000105 if (is_win) {
106 libs += [ "winmm.lib" ]
107
kjellander8f4419b2016-06-02 02:09:52 -0700108 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander8a116632017-04-21 05:17:08 -0700109
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800110 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -0700111 # webrtc/rtc_base/win32.h in source/clock.cc.
kjellander8a116632017-04-21 05:17:08 -0700112 # TODO(kjellander): Remove (bugs.webrtc.org/6828)
ehmaldonadof6a861a2017-07-19 10:40:47 -0700113 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000114 }
115
ehmaldonado3e3b6f22016-08-29 02:56:06 -0700116 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700117 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700118 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700119 }
120
ehmaldonadof6a861a2017-07-19 10:40:47 -0700121 deps += [ "../rtc_base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000122}
123
kjellander8a116632017-04-21 05:17:08 -0700124rtc_source_set("cpu_features_api") {
125 sources = [
126 "include/cpu_features_wrapper.h",
127 ]
128 deps = [
129 "..:webrtc_common",
130 ]
131}
132
mbonadeib1d6b542017-05-15 14:59:17 -0700133rtc_source_set("asm_defines") {
134 sources = [
135 "include/asm_defines.h",
136 ]
137}
138
kjellander8a116632017-04-21 05:17:08 -0700139rtc_source_set("field_trial_api") {
140 sources = [
141 "include/field_trial.h",
142 ]
143}
144
145rtc_source_set("metrics_api") {
146 sources = [
147 "include/metrics.h",
148 ]
149 deps = [
150 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700151 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700152 ]
153}
154
kjellanderb62dbbe2016-09-23 00:38:52 -0700155rtc_static_library("field_trial_default") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000156 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100157 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000158 "source/field_trial_default.cc",
159 ]
kjellander8a116632017-04-21 05:17:08 -0700160 deps = [
161 ":field_trial_api",
162 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000163}
164
kjellanderb62dbbe2016-09-23 00:38:52 -0700165rtc_static_library("metrics_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000166 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700167 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000168 "source/metrics_default.cc",
169 ]
kjellander8a116632017-04-21 05:17:08 -0700170 deps = [
171 ":metrics_api",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700172 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700173 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000174}
175
kjellanderb62dbbe2016-09-23 00:38:52 -0700176group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000177 deps = [
178 ":field_trial_default",
179 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800180 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000181 ]
182}
183
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000184if (is_android) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700185 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000186 sources = [
187 "source/cpu_features_android.c",
188 ]
189
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200190 deps = [
191 "//third_party/android_tools:cpu_features",
192 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000193 }
194}
simon.hosie953b1c12016-04-06 14:02:26 -0700195
196if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700197 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700198 sources = [
199 "source/cpu_features_linux.c",
200 ]
kjellander8a116632017-04-21 05:17:08 -0700201 deps = [
202 ":cpu_features_api",
203 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700204 }
205}
kjellanderbac04122016-06-02 02:18:48 -0700206
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200207if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700208 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200209 testonly = true
210 sources = [
211 "source/aligned_array_unittest.cc",
212 "source/aligned_malloc_unittest.cc",
213 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200214 "source/event_timer_posix_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200215 "source/metrics_default_unittest.cc",
216 "source/metrics_unittest.cc",
217 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800218 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700219 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200220 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700221
kjellandere40a7ee2016-10-16 23:56:12 -0700222 if (!build_with_chromium && is_clang) {
223 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700224 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200225 }
kjellanderbac04122016-06-02 02:18:48 -0700226
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200227 deps = [
228 ":metrics_default",
229 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700230 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700231 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800232 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200233 "//testing/gtest",
234 ]
kjellanderbac04122016-06-02 02:18:48 -0700235
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200236 if (is_android) {
237 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700238
239 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200240 }
kjellanderbac04122016-06-02 02:18:48 -0700241 }
242}