blob: a237576997bda1224395f7f866308a70c469294f [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") {
Per Kjellandera7f2d842018-01-10 15:54:53 +000016 visibility = [ "*" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000017 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010018 "include/clock.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010019 "include/cpu_info.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010020 "include/event_wrapper.h",
kjellander080a1e32016-05-25 11:37:11 -070021 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080022 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010023 "include/sleep.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000024 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000025 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020026 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000027 "source/event.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080028 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000029 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000030 ]
31
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 defines = []
33 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020034 deps = [
kjellander8a116632017-04-21 05:17:08 -070035 ":cpu_features_api",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +010036 ":runtime_enabled_features_api",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010037 "..:webrtc_common",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010038 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010039 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010040 "../rtc_base/synchronization:rw_lock_wrapper",
Niels Möllera12c42a2018-07-25 16:05:48 +020041 "../rtc_base/system:arch",
Danil Chapovalov196100e2018-06-21 10:17:24 +020042 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070043 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000044
45 if (is_android) {
sprange791ffd2016-01-26 01:53:20 -080046 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000047
Dan Minor9c686132018-01-15 10:20:00 -050048 if (build_with_mozilla) {
49 include_dirs = [
50 "/config/external/nspr",
51 "/nsprpub/lib/ds",
52 "/nsprpub/pr/include",
53 ]
54 } else {
55 deps += [ ":cpu_features_android" ]
56 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000057
58 libs += [ "log" ]
59 }
60
61 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080062 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000063
simon.hosie953b1c12016-04-06 14:02:26 -070064 if (!build_with_chromium) {
65 deps += [ ":cpu_features_linux" ]
66 }
67
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000068 libs += [ "rt" ]
69 }
70
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000071 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080072 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000073 }
74
75 if (is_win) {
76 libs += [ "winmm.lib" ]
77
Jianjun Zhu037f3e42017-08-15 21:48:37 +080078 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070079 # webrtc/rtc_base/win32.h in source/clock.cc.
ehmaldonadof6a861a2017-07-19 10:40:47 -070080 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000081 }
82
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000083 deps += [
84 "../rtc_base:rtc_base_approved",
85 "../rtc_base:rtc_numerics",
86 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000087}
88
kjellander8a116632017-04-21 05:17:08 -070089rtc_source_set("cpu_features_api") {
90 sources = [
91 "include/cpu_features_wrapper.h",
92 ]
93 deps = [
94 "..:webrtc_common",
95 ]
96}
97
Mirko Bonadei92e00382018-09-15 10:37:11 +020098rtc_source_set("field_trial") {
99 visibility = [ "*" ]
100 public = [
kjellander8a116632017-04-21 05:17:08 -0700101 "include/field_trial.h",
102 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +0200103 sources = [
104 "source/field_trial.cc",
105 ]
106 if (rtc_exclude_field_trial_default) {
107 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
108 }
109}
110
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100111rtc_source_set("runtime_enabled_features_api") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100112 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100113 sources = [
114 "include/runtime_enabled_features.h",
115 ]
116}
117
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100118rtc_source_set("runtime_enabled_features_default") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100119 visibility = [ "*" ]
Mirko Bonadei96ede162018-09-06 13:45:44 +0200120 configs += [ "..:no_global_constructors" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100121 sources = [
122 "source/runtime_enabled_features_default.cc",
123 ]
124 deps = [
125 ":runtime_enabled_features_api",
126 "../rtc_base:rtc_base_approved",
127 ]
128}
129
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200130rtc_source_set("metrics") {
131 visibility = [ "*" ]
132 public = [
133 "include/metrics.h",
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200134 ]
135 sources = [
136 "source/metrics.cc",
137 ]
138 if (rtc_exclude_metrics_default) {
139 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
140 }
141 deps = [
142 "..:webrtc_common",
143 "../rtc_base:checks",
144 "../rtc_base:rtc_base_approved",
145 ]
146}
147
kjellanderb62dbbe2016-09-23 00:38:52 -0700148group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000149 deps = [
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100150 ":runtime_enabled_features_default",
pbos12411ef2015-11-23 14:47:56 -0800151 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000152 ]
153}
154
Dan Minor9c686132018-01-15 10:20:00 -0500155if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700156 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000157 sources = [
158 "source/cpu_features_android.c",
159 ]
160
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200161 deps = [
162 "//third_party/android_tools:cpu_features",
163 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000164 }
165}
simon.hosie953b1c12016-04-06 14:02:26 -0700166
167if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700168 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700169 sources = [
170 "source/cpu_features_linux.c",
171 ]
kjellander8a116632017-04-21 05:17:08 -0700172 deps = [
173 ":cpu_features_api",
Niels Möllera12c42a2018-07-25 16:05:48 +0200174 "../rtc_base/system:arch",
kjellander8a116632017-04-21 05:17:08 -0700175 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700176 }
177}
kjellanderbac04122016-06-02 02:18:48 -0700178
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200179if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700180 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200181 testonly = true
182 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200183 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200184 "source/metrics_default_unittest.cc",
185 "source/metrics_unittest.cc",
186 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800187 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700188 ]
kjellanderbac04122016-06-02 02:18:48 -0700189
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200190 deps = [
Mirko Bonadei17f48782018-09-28 08:51:10 +0200191 ":metrics",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200192 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700193 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700194 "../rtc_base:rtc_base_approved",
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}