blob: 4f194c70221de4c186317263b02a7e24e32e80f3 [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,
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070020
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090021 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070022 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090023 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080024 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000025 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090026 ],
27 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070028 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090029 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080030 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000031 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090032 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080033 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070034
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080035 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070036 android: {
37 header_libs: ["libbacktrace_headers"],
38 export_header_lib_headers: ["libbacktrace_headers"],
39 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070040 linux_bionic: {
41 enabled: true,
42 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080043 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070044 enabled: true,
45 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080046 },
47}
48
David Sehrabfb9f32018-01-17 17:07:09 -080049cc_defaults {
50 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070051 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090052 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090053 vndk: {
54 enabled: true,
55 support_system_process: true,
56 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070057 host_supported: true,
58
Elliott Hughesdc699a22018-02-16 17:58:14 -080059 cflags: [
60 "-Wall",
61 "-Werror",
62 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070063 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070064 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070065 "libutils_headers",
66 ],
67 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070068 "libutils_headers",
69 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070070
Steven Moreland1f642412017-06-26 13:52:06 -070071 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070072 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070073 "liblog",
74 ],
Steven Moreland1f642412017-06-26 13:52:06 -070075
Dan Willemsen2e1591b2016-07-12 17:20:18 -070076 arch: {
77 mips: {
78 cflags: ["-DALIGN_DOUBLE"],
79 },
80 },
81
82 target: {
83 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070084 cflags: ["-fvisibility=protected"],
85
86 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000087 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070088 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090089 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070091
92 sanitize: {
93 misc_undefined: ["integer"],
94 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070095 },
96
Jiyong Park011ee122018-05-29 16:41:30 +090097 recovery: {
98 exclude_shared_libs: ["libvndksupport"],
99 },
100
Dan Willemsenab34b472016-11-29 13:32:55 -0800101 linux_bionic: {
102 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800103 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104
105 darwin: {
106 cflags: ["-Wno-unused-parameter"],
107 },
108
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800110 cflags: [
111 // Under MinGW, ctype.h doesn't need multi-byte support
112 "-DMB_CUR_MAX=1",
113 "-Wno-unused-private-field",
114 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700115
116 enabled: true,
117 },
118 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119}
120
David Sehrabfb9f32018-01-17 17:07:09 -0800121cc_library {
122 name: "libutils",
123 defaults: ["libutils_defaults"],
124
125 srcs: [
126 "FileMap.cpp",
127 "JenkinsHash.cpp",
128 "NativeHandle.cpp",
129 "Printer.cpp",
130 "PropertyMap.cpp",
131 "RefBase.cpp",
132 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800133 "StopWatch.cpp",
134 "String8.cpp",
135 "String16.cpp",
136 "StrongPointer.cpp",
137 "SystemClock.cpp",
138 "Threads.cpp",
139 "Timers.cpp",
140 "Tokenizer.cpp",
141 "Unicode.cpp",
142 "VectorImpl.cpp",
143 "misc.cpp",
144 ],
145
146 target: {
147 android: {
148 srcs: [
149 "Trace.cpp",
150 ],
151 },
152 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800153 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800154 srcs: [
155 "Looper.cpp",
156 ],
157 },
158 },
159}
160
161cc_library {
162 name: "libutilscallstack",
163 defaults: ["libutils_defaults"],
164
165 srcs: [
166 "CallStack.cpp",
167 ],
168
169 arch: {
170 mips: {
171 cflags: ["-DALIGN_DOUBLE"],
172 },
173 },
174
Steven Morelande6132be2019-03-25 20:38:56 -0700175 shared_libs: [
176 "libutils",
177 "libbacktrace",
178 ],
179
David Sehrabfb9f32018-01-17 17:07:09 -0800180 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800181 linux: {
182 srcs: [
183 "ProcessCallStack.cpp",
184 ],
185 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700186 darwin: {
187 enabled: false,
188 },
Steven Morelande6132be2019-03-25 20:38:56 -0700189 windows: {
190 enabled: false,
191 },
David Sehrabfb9f32018-01-17 17:07:09 -0800192 },
193}
194
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700195cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800196 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700197 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800198
199 srcs: [
200 "BitSet_test.cpp",
201 "FileMap_test.cpp",
202 "LruCache_test.cpp",
203 "Mutex_test.cpp",
204 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800205 "String8_test.cpp",
206 "StrongPointer_test.cpp",
207 "Unicode_test.cpp",
208 "Vector_test.cpp",
209 ],
210
211 target: {
212 android: {
213 srcs: [
214 "SystemClock_test.cpp",
215 ],
216 shared_libs: [
217 "libz",
218 "liblog",
219 "libcutils",
220 "libutils",
221 "libbase",
222 ],
223 },
224 linux: {
225 srcs: [
226 "Looper_test.cpp",
227 "RefBase_test.cpp",
228 ],
229 },
230 host: {
231 static_libs: [
232 "libutils",
233 "liblog",
234 "libbase",
235 ],
236 },
237 },
238
Elliott Hughes01705e42019-02-07 12:41:37 -0800239 cflags: [
240 "-Wall",
241 "-Wextra",
242 "-Werror",
243 "-Wthread-safety",
244 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800245
246 test_suites: ["device-tests"],
247}
248
249// TODO: the test infrastructure isn't yet capable of running this,
250// so it's broken out into its own test so that the main libutils_tests
251// can be in presubmit even if this can't.
252
253cc_test {
254 name: "libutils_singleton_test",
255 srcs: ["Singleton_test.cpp"],
256 cflags: [
257 "-Wall",
258 "-Werror",
259 ],
260 shared_libs: ["libbase"],
261
262 required: [
263 ":libutils_test_singleton1",
264 ":libutils_test_singleton2",
265 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800266}
267
268cc_test_library {
269 name: "libutils_test_singleton1",
270 host_supported: true,
271 relative_install_path: "libutils_test",
272 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800273 cflags: [
274 "-Wall",
275 "-Werror",
276 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700277}
Elliott Hughes01705e42019-02-07 12:41:37 -0800278
279cc_test_library {
280 name: "libutils_test_singleton2",
281 host_supported: true,
282 relative_install_path: "libutils_test",
283 srcs: ["Singleton_test2.cpp"],
284 cflags: [
285 "-Wall",
286 "-Werror",
287 ],
288 shared_libs: ["libutils_test_singleton1"],
289}