blob: efa4c414d16c362e2d3dae6463afe98491573701 [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 },
162}
163
164cc_library {
165 name: "libutilscallstack",
166 defaults: ["libutils_defaults"],
167
168 srcs: [
169 "CallStack.cpp",
170 ],
171
172 arch: {
173 mips: {
174 cflags: ["-DALIGN_DOUBLE"],
175 },
176 },
177
Steven Morelande6132be2019-03-25 20:38:56 -0700178 shared_libs: [
179 "libutils",
180 "libbacktrace",
181 ],
182
David Sehrabfb9f32018-01-17 17:07:09 -0800183 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800184 linux: {
185 srcs: [
186 "ProcessCallStack.cpp",
187 ],
188 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700189 darwin: {
190 enabled: false,
191 },
Steven Morelande6132be2019-03-25 20:38:56 -0700192 windows: {
193 enabled: false,
194 },
David Sehrabfb9f32018-01-17 17:07:09 -0800195 },
196}
197
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700198cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800199 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700200 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800201
202 srcs: [
203 "BitSet_test.cpp",
204 "FileMap_test.cpp",
205 "LruCache_test.cpp",
206 "Mutex_test.cpp",
207 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800208 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700209 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800210 "StrongPointer_test.cpp",
211 "Unicode_test.cpp",
212 "Vector_test.cpp",
213 ],
214
215 target: {
216 android: {
217 srcs: [
218 "SystemClock_test.cpp",
219 ],
220 shared_libs: [
221 "libz",
222 "liblog",
223 "libcutils",
224 "libutils",
225 "libbase",
226 ],
227 },
228 linux: {
229 srcs: [
230 "Looper_test.cpp",
231 "RefBase_test.cpp",
232 ],
233 },
234 host: {
235 static_libs: [
236 "libutils",
237 "liblog",
238 "libbase",
239 ],
240 },
241 },
242
Elliott Hughes01705e42019-02-07 12:41:37 -0800243 cflags: [
244 "-Wall",
245 "-Wextra",
246 "-Werror",
247 "-Wthread-safety",
248 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800249
250 test_suites: ["device-tests"],
251}
252
253// TODO: the test infrastructure isn't yet capable of running this,
254// so it's broken out into its own test so that the main libutils_tests
255// can be in presubmit even if this can't.
256
257cc_test {
258 name: "libutils_singleton_test",
259 srcs: ["Singleton_test.cpp"],
260 cflags: [
261 "-Wall",
262 "-Werror",
263 ],
264 shared_libs: ["libbase"],
265
266 required: [
267 ":libutils_test_singleton1",
268 ":libutils_test_singleton2",
269 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800270}
271
272cc_test_library {
273 name: "libutils_test_singleton1",
274 host_supported: true,
275 relative_install_path: "libutils_test",
276 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800277 cflags: [
278 "-Wall",
279 "-Werror",
280 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700281}
Elliott Hughes01705e42019-02-07 12:41:37 -0800282
283cc_test_library {
284 name: "libutils_test_singleton2",
285 host_supported: true,
286 relative_install_path: "libutils_test",
287 srcs: ["Singleton_test2.cpp"],
288 cflags: [
289 "-Wall",
290 "-Werror",
291 ],
292 shared_libs: ["libutils_test_singleton1"],
293}
Steven Morelandc732c032019-09-03 18:04:50 -0700294
295cc_benchmark {
296 name: "libutils_benchmark",
297 srcs: ["Vector_benchmark.cpp"],
298 shared_libs: ["libutils"],
299}