blob: 8be4dd0883d8e1ba2f33bc12362c25fe813cdd3b [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: [
128 "FileMap.cpp",
129 "JenkinsHash.cpp",
130 "NativeHandle.cpp",
131 "Printer.cpp",
132 "PropertyMap.cpp",
133 "RefBase.cpp",
134 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800135 "StopWatch.cpp",
136 "String8.cpp",
137 "String16.cpp",
138 "StrongPointer.cpp",
139 "SystemClock.cpp",
140 "Threads.cpp",
141 "Timers.cpp",
142 "Tokenizer.cpp",
143 "Unicode.cpp",
144 "VectorImpl.cpp",
145 "misc.cpp",
146 ],
147
148 target: {
149 android: {
150 srcs: [
151 "Trace.cpp",
152 ],
153 },
154 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800155 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800156 srcs: [
157 "Looper.cpp",
158 ],
159 },
160 },
161}
162
163cc_library {
164 name: "libutilscallstack",
165 defaults: ["libutils_defaults"],
166
167 srcs: [
168 "CallStack.cpp",
169 ],
170
171 arch: {
172 mips: {
173 cflags: ["-DALIGN_DOUBLE"],
174 },
175 },
176
Steven Morelande6132be2019-03-25 20:38:56 -0700177 shared_libs: [
178 "libutils",
179 "libbacktrace",
180 ],
181
David Sehrabfb9f32018-01-17 17:07:09 -0800182 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800183 linux: {
184 srcs: [
185 "ProcessCallStack.cpp",
186 ],
187 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700188 darwin: {
189 enabled: false,
190 },
Steven Morelande6132be2019-03-25 20:38:56 -0700191 windows: {
192 enabled: false,
193 },
David Sehrabfb9f32018-01-17 17:07:09 -0800194 },
195}
196
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700197cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800198 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700199 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800200
201 srcs: [
202 "BitSet_test.cpp",
203 "FileMap_test.cpp",
204 "LruCache_test.cpp",
205 "Mutex_test.cpp",
206 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800207 "String8_test.cpp",
208 "StrongPointer_test.cpp",
209 "Unicode_test.cpp",
210 "Vector_test.cpp",
211 ],
212
213 target: {
214 android: {
215 srcs: [
216 "SystemClock_test.cpp",
217 ],
218 shared_libs: [
219 "libz",
220 "liblog",
221 "libcutils",
222 "libutils",
223 "libbase",
224 ],
225 },
226 linux: {
227 srcs: [
228 "Looper_test.cpp",
229 "RefBase_test.cpp",
230 ],
231 },
232 host: {
233 static_libs: [
234 "libutils",
235 "liblog",
236 "libbase",
237 ],
238 },
239 },
240
Elliott Hughes01705e42019-02-07 12:41:37 -0800241 cflags: [
242 "-Wall",
243 "-Wextra",
244 "-Werror",
245 "-Wthread-safety",
246 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800247
248 test_suites: ["device-tests"],
249}
250
251// TODO: the test infrastructure isn't yet capable of running this,
252// so it's broken out into its own test so that the main libutils_tests
253// can be in presubmit even if this can't.
254
255cc_test {
256 name: "libutils_singleton_test",
257 srcs: ["Singleton_test.cpp"],
258 cflags: [
259 "-Wall",
260 "-Werror",
261 ],
262 shared_libs: ["libbase"],
263
264 required: [
265 ":libutils_test_singleton1",
266 ":libutils_test_singleton2",
267 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800268}
269
270cc_test_library {
271 name: "libutils_test_singleton1",
272 host_supported: true,
273 relative_install_path: "libutils_test",
274 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800275 cflags: [
276 "-Wall",
277 "-Werror",
278 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700279}
Elliott Hughes01705e42019-02-07 12:41:37 -0800280
281cc_test_library {
282 name: "libutils_test_singleton2",
283 host_supported: true,
284 relative_install_path: "libutils_test",
285 srcs: ["Singleton_test2.cpp"],
286 cflags: [
287 "-Wall",
288 "-Werror",
289 ],
290 shared_libs: ["libutils_test_singleton1"],
291}