blob: c67ff8fab1dee71cca9de404654ddd4caa98930e [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: [
72 "liblog",
73 ],
Steven Moreland1f642412017-06-26 13:52:06 -070074
Dan Willemsen2e1591b2016-07-12 17:20:18 -070075 arch: {
76 mips: {
77 cflags: ["-DALIGN_DOUBLE"],
78 },
79 },
80
81 target: {
82 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070083 cflags: ["-fvisibility=protected"],
84
85 shared_libs: [
Dan Willemsen2e1591b2016-07-12 17:20:18 -070086 "libcutils",
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 Willemsen2e1591b2016-07-12 17:20:18 -0700101 host: {
102 cflags: ["-DLIBUTILS_NATIVE=1"],
103
104 shared: {
105 enabled: false,
106 },
107 },
108
Dan Willemsenab34b472016-11-29 13:32:55 -0800109 linux_bionic: {
110 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800111 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700112
113 darwin: {
114 cflags: ["-Wno-unused-parameter"],
115 },
116
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700117 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800118 cflags: [
119 // Under MinGW, ctype.h doesn't need multi-byte support
120 "-DMB_CUR_MAX=1",
121 "-Wno-unused-private-field",
122 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700123
124 enabled: true,
125 },
126 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700127}
128
David Sehrabfb9f32018-01-17 17:07:09 -0800129cc_library {
130 name: "libutils",
131 defaults: ["libutils_defaults"],
132
133 srcs: [
134 "FileMap.cpp",
135 "JenkinsHash.cpp",
136 "NativeHandle.cpp",
137 "Printer.cpp",
138 "PropertyMap.cpp",
139 "RefBase.cpp",
140 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800141 "StopWatch.cpp",
142 "String8.cpp",
143 "String16.cpp",
144 "StrongPointer.cpp",
145 "SystemClock.cpp",
146 "Threads.cpp",
147 "Timers.cpp",
148 "Tokenizer.cpp",
149 "Unicode.cpp",
150 "VectorImpl.cpp",
151 "misc.cpp",
152 ],
153
154 target: {
155 android: {
156 srcs: [
157 "Trace.cpp",
158 ],
159 },
160 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800161 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800162 srcs: [
163 "Looper.cpp",
164 ],
165 },
166 },
167}
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
183 target: {
184 android: {
185 shared_libs: [
186 "libutils",
187 "libbacktrace",
188 ],
189 },
190 linux: {
191 srcs: [
192 "ProcessCallStack.cpp",
193 ],
194 },
195 },
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",
209 "StrongPointer_test.cpp",
210 "Unicode_test.cpp",
211 "Vector_test.cpp",
212 ],
213
214 target: {
215 android: {
216 srcs: [
217 "SystemClock_test.cpp",
218 ],
219 shared_libs: [
220 "libz",
221 "liblog",
222 "libcutils",
223 "libutils",
224 "libbase",
225 ],
226 },
227 linux: {
228 srcs: [
229 "Looper_test.cpp",
230 "RefBase_test.cpp",
231 ],
232 },
233 host: {
234 static_libs: [
235 "libutils",
236 "liblog",
237 "libbase",
238 ],
239 },
240 },
241
Elliott Hughes01705e42019-02-07 12:41:37 -0800242 cflags: [
243 "-Wall",
244 "-Wextra",
245 "-Werror",
246 "-Wthread-safety",
247 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800248
249 test_suites: ["device-tests"],
250}
251
252// TODO: the test infrastructure isn't yet capable of running this,
253// so it's broken out into its own test so that the main libutils_tests
254// can be in presubmit even if this can't.
255
256cc_test {
257 name: "libutils_singleton_test",
258 srcs: ["Singleton_test.cpp"],
259 cflags: [
260 "-Wall",
261 "-Werror",
262 ],
263 shared_libs: ["libbase"],
264
265 required: [
266 ":libutils_test_singleton1",
267 ":libutils_test_singleton2",
268 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800269}
270
271cc_test_library {
272 name: "libutils_test_singleton1",
273 host_supported: true,
274 relative_install_path: "libutils_test",
275 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800276 cflags: [
277 "-Wall",
278 "-Werror",
279 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700280}
Elliott Hughes01705e42019-02-07 12:41:37 -0800281
282cc_test_library {
283 name: "libutils_test_singleton2",
284 host_supported: true,
285 relative_install_path: "libutils_test",
286 srcs: ["Singleton_test2.cpp"],
287 cflags: [
288 "-Wall",
289 "-Werror",
290 ],
291 shared_libs: ["libutils_test_singleton1"],
292}