blob: 7405c9647454c75bca37e3947eb1f32f2c3ad14a [file] [log] [blame]
Dan Willemsen2e1591b2016-07-12 17:20:18 -07001// Copyright (C) 2008 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080015cc_library_headers {
16 name: "libutils_headers",
Steven Moreland91527ed2017-04-11 12:43:16 -070017 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090018 recovery_available: true,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080019 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020020 native_bridge_supported: true,
Jiyong Parka206b8c2020-03-07 16:36:09 +090021 apex_available: [
22 "//apex_available:platform",
23 "//apex_available:anyapex",
24 ],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070025
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090026 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070027 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090028 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080029 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000030 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090031 ],
32 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070033 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090034 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080035 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000036 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090037 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080038 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070039
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080040 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070041 android: {
42 header_libs: ["libbacktrace_headers"],
43 export_header_lib_headers: ["libbacktrace_headers"],
44 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070045 linux_bionic: {
46 enabled: true,
47 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080048 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070049 enabled: true,
50 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080051 },
52}
53
David Sehrabfb9f32018-01-17 17:07:09 -080054cc_defaults {
55 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070056 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090057 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090058 vndk: {
59 enabled: true,
60 support_system_process: true,
61 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070062 host_supported: true,
63
Elliott Hughesdc699a22018-02-16 17:58:14 -080064 cflags: [
65 "-Wall",
66 "-Werror",
67 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070068 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070069 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070070 "libutils_headers",
71 ],
72 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070073 "libutils_headers",
74 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070075
Steven Moreland1f642412017-06-26 13:52:06 -070076 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070077 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070078 "liblog",
79 ],
Steven Moreland1f642412017-06-26 13:52:06 -070080
Dan Willemsen2e1591b2016-07-12 17:20:18 -070081 arch: {
82 mips: {
83 cflags: ["-DALIGN_DOUBLE"],
84 },
85 },
86
87 target: {
88 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 cflags: ["-fvisibility=protected"],
90
91 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000092 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070093 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090094 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070095 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070096
97 sanitize: {
98 misc_undefined: ["integer"],
99 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100 },
101
Jiyong Park011ee122018-05-29 16:41:30 +0900102 recovery: {
103 exclude_shared_libs: ["libvndksupport"],
104 },
105
Dan Willemsenab34b472016-11-29 13:32:55 -0800106 linux_bionic: {
107 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800108 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109
110 darwin: {
111 cflags: ["-Wno-unused-parameter"],
112 },
113
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700114 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800115 cflags: [
116 // Under MinGW, ctype.h doesn't need multi-byte support
117 "-DMB_CUR_MAX=1",
118 "-Wno-unused-private-field",
119 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700120
121 enabled: true,
122 },
123 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700124}
125
David Sehrabfb9f32018-01-17 17:07:09 -0800126cc_library {
127 name: "libutils",
128 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200129 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800130
131 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800132 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800133 "FileMap.cpp",
134 "JenkinsHash.cpp",
135 "NativeHandle.cpp",
136 "Printer.cpp",
137 "PropertyMap.cpp",
138 "RefBase.cpp",
139 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800140 "StopWatch.cpp",
141 "String8.cpp",
142 "String16.cpp",
143 "StrongPointer.cpp",
144 "SystemClock.cpp",
145 "Threads.cpp",
146 "Timers.cpp",
147 "Tokenizer.cpp",
148 "Unicode.cpp",
149 "VectorImpl.cpp",
150 "misc.cpp",
151 ],
152
153 target: {
154 android: {
155 srcs: [
156 "Trace.cpp",
157 ],
158 },
159 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800160 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800161 srcs: [
162 "Looper.cpp",
163 ],
164 },
165 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800166
167 apex_available: [
168 "//apex_available:anyapex",
169 "//apex_available:platform",
170 ],
David Sehrabfb9f32018-01-17 17:07:09 -0800171}
172
173cc_library {
174 name: "libutilscallstack",
175 defaults: ["libutils_defaults"],
176
177 srcs: [
178 "CallStack.cpp",
179 ],
180
181 arch: {
182 mips: {
183 cflags: ["-DALIGN_DOUBLE"],
184 },
185 },
186
Steven Morelande6132be2019-03-25 20:38:56 -0700187 shared_libs: [
188 "libutils",
189 "libbacktrace",
190 ],
191
David Sehrabfb9f32018-01-17 17:07:09 -0800192 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800193 linux: {
194 srcs: [
195 "ProcessCallStack.cpp",
196 ],
197 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700198 darwin: {
199 enabled: false,
200 },
Steven Morelande6132be2019-03-25 20:38:56 -0700201 windows: {
202 enabled: false,
203 },
David Sehrabfb9f32018-01-17 17:07:09 -0800204 },
205}
206
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700207cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800208 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700209 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800210
211 srcs: [
212 "BitSet_test.cpp",
213 "FileMap_test.cpp",
214 "LruCache_test.cpp",
215 "Mutex_test.cpp",
216 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800217 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700218 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800219 "StrongPointer_test.cpp",
220 "Unicode_test.cpp",
221 "Vector_test.cpp",
222 ],
223
224 target: {
225 android: {
226 srcs: [
227 "SystemClock_test.cpp",
228 ],
229 shared_libs: [
230 "libz",
231 "liblog",
232 "libcutils",
233 "libutils",
234 "libbase",
235 ],
236 },
237 linux: {
238 srcs: [
239 "Looper_test.cpp",
240 "RefBase_test.cpp",
241 ],
242 },
243 host: {
244 static_libs: [
245 "libutils",
246 "liblog",
247 "libbase",
248 ],
249 },
250 },
251
Elliott Hughes01705e42019-02-07 12:41:37 -0800252 cflags: [
253 "-Wall",
254 "-Wextra",
255 "-Werror",
256 "-Wthread-safety",
257 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800258
259 test_suites: ["device-tests"],
260}
261
262// TODO: the test infrastructure isn't yet capable of running this,
263// so it's broken out into its own test so that the main libutils_tests
264// can be in presubmit even if this can't.
265
266cc_test {
267 name: "libutils_singleton_test",
268 srcs: ["Singleton_test.cpp"],
269 cflags: [
270 "-Wall",
271 "-Werror",
272 ],
273 shared_libs: ["libbase"],
274
275 required: [
276 ":libutils_test_singleton1",
277 ":libutils_test_singleton2",
278 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800279}
280
281cc_test_library {
282 name: "libutils_test_singleton1",
283 host_supported: true,
284 relative_install_path: "libutils_test",
285 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800286 cflags: [
287 "-Wall",
288 "-Werror",
289 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700290}
Elliott Hughes01705e42019-02-07 12:41:37 -0800291
292cc_test_library {
293 name: "libutils_test_singleton2",
294 host_supported: true,
295 relative_install_path: "libutils_test",
296 srcs: ["Singleton_test2.cpp"],
297 cflags: [
298 "-Wall",
299 "-Werror",
300 ],
301 shared_libs: ["libutils_test_singleton1"],
302}
Steven Morelandc732c032019-09-03 18:04:50 -0700303
304cc_benchmark {
305 name: "libutils_benchmark",
306 srcs: ["Vector_benchmark.cpp"],
307 shared_libs: ["libutils"],
308}