blob: f32cafe6d00c73d62e1e4601528b869162341248 [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
Mirko Bonadei86d053c2019-10-17 21:32:04 +020015rtc_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",
kjellander080a1e32016-05-25 11:37:11 -070020 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080021 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010022 "include/sleep.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000023 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000024 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020025 "source/cpu_info.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080026 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000027 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000028 ]
29
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000030 defines = []
31 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020032 deps = [
kjellander8a116632017-04-21 05:17:08 -070033 ":cpu_features_api",
Ilya Nikolaevskiyf1cc3a22018-11-12 15:03:51 +010034 "../api:array_view",
Sebastian Jansson4de31152019-06-11 08:52:11 +020035 "../api/units:timestamp",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010036 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010037 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010038 "../rtc_base/synchronization:rw_lock_wrapper",
Niels Möllera12c42a2018-07-25 16:05:48 +020039 "../rtc_base/system:arch",
Danil Chapovalov196100e2018-06-21 10:17:24 +020040 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070041 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000042
43 if (is_android) {
Dan Minor9c686132018-01-15 10:20:00 -050044 if (build_with_mozilla) {
45 include_dirs = [
46 "/config/external/nspr",
47 "/nsprpub/lib/ds",
48 "/nsprpub/pr/include",
49 ]
50 } else {
51 deps += [ ":cpu_features_android" ]
52 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000053
54 libs += [ "log" ]
55 }
56
57 if (is_linux) {
simon.hosie953b1c12016-04-06 14:02:26 -070058 if (!build_with_chromium) {
59 deps += [ ":cpu_features_linux" ]
60 }
61
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000062 libs += [ "rt" ]
63 }
64
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000065 if (is_win) {
66 libs += [ "winmm.lib" ]
67
Artem Titov94b57c02019-03-21 13:35:10 +010068 # Windows needs ../rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070069 # webrtc/rtc_base/win32.h in source/clock.cc.
Artem Titov94b57c02019-03-21 13:35:10 +010070 deps += [ "../rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000071 }
72
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000073 deps += [
74 "../rtc_base:rtc_base_approved",
75 "../rtc_base:rtc_numerics",
76 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000077}
78
kjellander8a116632017-04-21 05:17:08 -070079rtc_source_set("cpu_features_api") {
80 sources = [
81 "include/cpu_features_wrapper.h",
82 ]
kjellander8a116632017-04-21 05:17:08 -070083}
84
Mirko Bonadei86d053c2019-10-17 21:32:04 +020085rtc_library("field_trial") {
Mirko Bonadei92e00382018-09-15 10:37:11 +020086 visibility = [ "*" ]
87 public = [
kjellander8a116632017-04-21 05:17:08 -070088 "include/field_trial.h",
89 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +020090 sources = [
91 "source/field_trial.cc",
92 ]
93 if (rtc_exclude_field_trial_default) {
94 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
95 }
Jonas Olsson5b2eda42019-06-11 14:29:40 +020096 deps = [
97 "../rtc_base:checks",
98 "../rtc_base:logging",
99 "//third_party/abseil-cpp/absl/strings",
100 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +0200101}
102
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200103rtc_library("event_wrapper") {
Niels Möllere8fd57c2019-03-28 15:10:17 +0100104 visibility = [
Niels Möllerfe407b72019-09-10 10:48:48 +0200105 "../modules/video_coding:video_coding_legacy",
Niels Möllere8fd57c2019-03-28 15:10:17 +0100106 "../modules/video_coding:video_coding_unittests",
107 ]
108 sources = [
109 "include/event_wrapper.h",
110 "source/event.cc",
111 ]
112 deps = [
113 "../rtc_base:rtc_event",
114 ]
115}
116
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200117rtc_library("metrics") {
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200118 visibility = [ "*" ]
119 public = [
120 "include/metrics.h",
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200121 ]
122 sources = [
123 "source/metrics.cc",
124 ]
125 if (rtc_exclude_metrics_default) {
126 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
127 }
128 deps = [
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200129 "../rtc_base:checks",
130 "../rtc_base:rtc_base_approved",
131 ]
132}
133
Dan Minor9c686132018-01-15 10:20:00 -0500134if (is_android && !build_with_mozilla) {
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200135 rtc_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000136 sources = [
137 "source/cpu_features_android.c",
138 ]
139
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200140 deps = [
Peter Wenc90e81e2019-03-28 12:23:34 -0400141 "//third_party/android_sdk:cpu_features",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200142 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000143 }
144}
simon.hosie953b1c12016-04-06 14:02:26 -0700145
146if (is_linux) {
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200147 rtc_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700148 sources = [
149 "source/cpu_features_linux.c",
150 ]
kjellander8a116632017-04-21 05:17:08 -0700151 deps = [
152 ":cpu_features_api",
Niels Möllera12c42a2018-07-25 16:05:48 +0200153 "../rtc_base/system:arch",
kjellander8a116632017-04-21 05:17:08 -0700154 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700155 }
156}
kjellanderbac04122016-06-02 02:18:48 -0700157
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200158if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700159 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200160 testonly = true
161 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200162 "source/clock_unittest.cc",
Jonas Olsson5b2eda42019-06-11 14:29:40 +0200163 "source/field_trial_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200164 "source/metrics_default_unittest.cc",
165 "source/metrics_unittest.cc",
166 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800167 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700168 ]
kjellanderbac04122016-06-02 02:18:48 -0700169
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200170 deps = [
Jonas Olsson5b2eda42019-06-11 14:29:40 +0200171 ":field_trial",
Mirko Bonadei17f48782018-09-28 08:51:10 +0200172 ":metrics",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200173 ":system_wrappers",
Yves Gerey3e707812018-11-28 16:47:49 +0100174 "../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700175 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800176 "../test:test_main",
Yves Gerey21cddff2018-10-30 21:12:42 +0100177 "../test:test_support",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200178 "//testing/gtest",
Jonas Olsson5b2eda42019-06-11 14:29:40 +0200179 "//third_party/abseil-cpp/absl/strings",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200180 ]
kjellanderbac04122016-06-02 02:18:48 -0700181
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200182 if (is_android) {
183 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700184
185 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200186 }
kjellanderbac04122016-06-02 02:18:48 -0700187 }
188}