blob: 33117936cfd84f9d41ee9f245828b9187d7362d6 [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,
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070021
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090022 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070023 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090024 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080025 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000026 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090027 ],
28 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070029 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090030 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080031 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000032 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090033 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080034 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070035
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080036 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070037 android: {
38 header_libs: ["libbacktrace_headers"],
39 export_header_lib_headers: ["libbacktrace_headers"],
40 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070041 linux_bionic: {
42 enabled: true,
43 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080044 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070045 enabled: true,
46 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080047 },
48}
49
David Sehrabfb9f32018-01-17 17:07:09 -080050cc_defaults {
51 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070052 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090053 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090054 vndk: {
55 enabled: true,
56 support_system_process: true,
57 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070058 host_supported: true,
59
Elliott Hughesdc699a22018-02-16 17:58:14 -080060 cflags: [
61 "-Wall",
62 "-Werror",
63 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070064 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070065 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070066 "libutils_headers",
67 ],
68 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070069 "libutils_headers",
70 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070071
Steven Moreland1f642412017-06-26 13:52:06 -070072 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070073 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070074 "liblog",
75 ],
Steven Moreland1f642412017-06-26 13:52:06 -070076
Dan Willemsen2e1591b2016-07-12 17:20:18 -070077 arch: {
78 mips: {
79 cflags: ["-DALIGN_DOUBLE"],
80 },
81 },
82
83 target: {
84 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 cflags: ["-fvisibility=protected"],
86
87 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000088 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090090 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070092
93 sanitize: {
94 misc_undefined: ["integer"],
95 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 },
97
Jiyong Park011ee122018-05-29 16:41:30 +090098 recovery: {
99 exclude_shared_libs: ["libvndksupport"],
100 },
101
Dan Willemsenab34b472016-11-29 13:32:55 -0800102 linux_bionic: {
103 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800104 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105
106 darwin: {
107 cflags: ["-Wno-unused-parameter"],
108 },
109
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800111 cflags: [
112 // Under MinGW, ctype.h doesn't need multi-byte support
113 "-DMB_CUR_MAX=1",
114 "-Wno-unused-private-field",
115 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700116
117 enabled: true,
118 },
119 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700120}
121
David Sehrabfb9f32018-01-17 17:07:09 -0800122cc_library {
123 name: "libutils",
124 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200125 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800126
127 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800128 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800129 "FileMap.cpp",
130 "JenkinsHash.cpp",
131 "NativeHandle.cpp",
132 "Printer.cpp",
133 "PropertyMap.cpp",
134 "RefBase.cpp",
135 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800136 "StopWatch.cpp",
137 "String8.cpp",
138 "String16.cpp",
139 "StrongPointer.cpp",
140 "SystemClock.cpp",
141 "Threads.cpp",
142 "Timers.cpp",
143 "Tokenizer.cpp",
144 "Unicode.cpp",
145 "VectorImpl.cpp",
146 "misc.cpp",
147 ],
148
149 target: {
150 android: {
151 srcs: [
152 "Trace.cpp",
153 ],
154 },
155 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800156 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800157 srcs: [
158 "Looper.cpp",
159 ],
160 },
161 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800162
163 apex_available: [
164 "//apex_available:anyapex",
165 "//apex_available:platform",
166 ],
David Sehrabfb9f32018-01-17 17:07:09 -0800167}
168
169cc_library {
170 name: "libutilscallstack",
171 defaults: ["libutils_defaults"],
172
173 srcs: [
174 "CallStack.cpp",
175 ],
176
177 arch: {
178 mips: {
179 cflags: ["-DALIGN_DOUBLE"],
180 },
181 },
182
Steven Morelande6132be2019-03-25 20:38:56 -0700183 shared_libs: [
184 "libutils",
185 "libbacktrace",
186 ],
187
David Sehrabfb9f32018-01-17 17:07:09 -0800188 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800189 linux: {
190 srcs: [
191 "ProcessCallStack.cpp",
192 ],
193 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700194 darwin: {
195 enabled: false,
196 },
Steven Morelande6132be2019-03-25 20:38:56 -0700197 windows: {
198 enabled: false,
199 },
David Sehrabfb9f32018-01-17 17:07:09 -0800200 },
201}
202
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700203cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800204 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700205 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800206
207 srcs: [
208 "BitSet_test.cpp",
209 "FileMap_test.cpp",
210 "LruCache_test.cpp",
211 "Mutex_test.cpp",
212 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800213 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700214 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800215 "StrongPointer_test.cpp",
216 "Unicode_test.cpp",
217 "Vector_test.cpp",
218 ],
219
220 target: {
221 android: {
222 srcs: [
223 "SystemClock_test.cpp",
224 ],
225 shared_libs: [
226 "libz",
227 "liblog",
228 "libcutils",
229 "libutils",
230 "libbase",
231 ],
232 },
233 linux: {
234 srcs: [
235 "Looper_test.cpp",
236 "RefBase_test.cpp",
237 ],
238 },
239 host: {
240 static_libs: [
241 "libutils",
242 "liblog",
243 "libbase",
244 ],
245 },
246 },
247
Elliott Hughes01705e42019-02-07 12:41:37 -0800248 cflags: [
249 "-Wall",
250 "-Wextra",
251 "-Werror",
252 "-Wthread-safety",
253 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800254
255 test_suites: ["device-tests"],
256}
257
258// TODO: the test infrastructure isn't yet capable of running this,
259// so it's broken out into its own test so that the main libutils_tests
260// can be in presubmit even if this can't.
261
262cc_test {
263 name: "libutils_singleton_test",
264 srcs: ["Singleton_test.cpp"],
265 cflags: [
266 "-Wall",
267 "-Werror",
268 ],
269 shared_libs: ["libbase"],
270
271 required: [
272 ":libutils_test_singleton1",
273 ":libutils_test_singleton2",
274 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800275}
276
277cc_test_library {
278 name: "libutils_test_singleton1",
279 host_supported: true,
280 relative_install_path: "libutils_test",
281 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800282 cflags: [
283 "-Wall",
284 "-Werror",
285 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700286}
Elliott Hughes01705e42019-02-07 12:41:37 -0800287
288cc_test_library {
289 name: "libutils_test_singleton2",
290 host_supported: true,
291 relative_install_path: "libutils_test",
292 srcs: ["Singleton_test2.cpp"],
293 cflags: [
294 "-Wall",
295 "-Werror",
296 ],
297 shared_libs: ["libutils_test_singleton1"],
298}
Steven Morelandc732c032019-09-03 18:04:50 -0700299
300cc_benchmark {
301 name: "libutils_benchmark",
302 srcs: ["Vector_benchmark.cpp"],
303 shared_libs: ["libutils"],
304}