blob: 61fbc3de06a4c997049d1c8a356daf37c0d7b459 [file] [log] [blame]
Colin Crossfc06bd02016-07-11 14:15:31 -07001//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070017cc_defaults {
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080018 name: "libbase_cflags_defaults",
Elliott Hughesdc699a22018-02-16 17:58:14 -080019 cflags: [
20 "-Wall",
21 "-Werror",
22 "-Wextra",
23 ],
Paul Crowleyb3236eb2019-09-11 15:31:55 -070024 target: {
25 android: {
26 cflags: [
27 "-D_FILE_OFFSET_BITS=64",
28 ],
29 },
30 },
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070031}
Colin Crossfc06bd02016-07-11 14:15:31 -070032
Steven Moreland3c71bbd2017-04-14 00:54:46 -070033cc_library_headers {
34 name: "libbase_headers",
35 vendor_available: true,
Yifan Hong7dd45532020-01-21 18:17:19 -080036 ramdisk_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090037 recovery_available: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070038 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +020039 native_bridge_supported: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070040 export_include_dirs: ["include"],
41
Steven Moreland3c71bbd2017-04-14 00:54:46 -070042 target: {
43 linux_bionic: {
44 enabled: true,
45 },
46 windows: {
47 enabled: true,
48 },
49 },
Jiyong Park8bf9b162020-03-07 16:36:09 +090050 apex_available: [
51 "//apex_available:anyapex",
52 "//apex_available:platform",
53 ],
Jooyung Han3851f7e2020-04-16 18:48:33 +090054 min_sdk_version: "29",
Steven Moreland3c71bbd2017-04-14 00:54:46 -070055}
56
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080057cc_defaults {
58 name: "libbase_defaults",
59 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -070060 srcs: [
Josh Gao27241a72019-04-25 14:04:57 -070061 "abi_compatibility.cpp",
Mark Salyzyn0c071c92018-02-05 07:41:31 -080062 "chrono_utils.cpp",
Josh Gao14f95002019-01-07 19:16:21 -080063 "cmsg.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070064 "file.cpp",
Tom Cherry349b0c42020-01-08 14:47:42 -080065 "liblog_symbols.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070066 "logging.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -070067 "mapped_file.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -080068 "parsebool.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070069 "parsenetaddress.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -070070 "process.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -070071 "properties.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070072 "stringprintf.cpp",
73 "strings.cpp",
Josh Gao5791e212018-03-16 14:25:42 -070074 "threads.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070075 "test_utils.cpp",
76 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070077
Pirama Arumuga Nainarca6ee832018-09-26 23:31:00 -070078 cppflags: ["-Wexit-time-destructors"],
Colin Crossfc06bd02016-07-11 14:15:31 -070079 shared_libs: ["liblog"],
80 target: {
81 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -080082 sanitize: {
83 misc_undefined: ["integer"],
84 },
James Hawkinse78ea772017-03-24 11:43:02 -070085
Colin Crossfc06bd02016-07-11 14:15:31 -070086 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070087 linux: {
88 srcs: [
Dan Willemsenbdddcab2017-10-03 14:17:31 -070089 "errors_unix.cpp",
90 ],
Dan Willemsenbdddcab2017-10-03 14:17:31 -070091 },
Colin Crossfc06bd02016-07-11 14:15:31 -070092 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070093 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070094 "errors_unix.cpp",
95 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070096 },
Dan Willemsenab34b472016-11-29 13:32:55 -080097 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080098 enabled: true,
99 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700100 windows: {
101 srcs: [
102 "errors_windows.cpp",
103 "utf8.cpp",
104 ],
Josh Gao14f95002019-01-07 19:16:21 -0800105 exclude_srcs: [
106 "cmsg.cpp",
107 ],
Colin Crossfc06bd02016-07-11 14:15:31 -0700108 enabled: true,
109 },
110 },
111}
112
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800113cc_library {
114 name: "libbase",
115 defaults: ["libbase_defaults"],
116 vendor_available: true,
Yifan Hong7dd45532020-01-21 18:17:19 -0800117 ramdisk_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900118 recovery_available: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800119 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +0200120 native_bridge_supported: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800121 vndk: {
122 enabled: true,
123 support_system_process: true,
124 },
125 header_libs: [
126 "libbase_headers",
127 ],
128 export_header_lib_headers: ["libbase_headers"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900129 static_libs: ["fmtlib"],
130 whole_static_libs: ["fmtlib"],
131 export_static_lib_headers: ["fmtlib"],
Jeffrey Huang0c0b7742020-02-14 10:27:17 -0800132 apex_available: [
133 "//apex_available:anyapex",
134 "//apex_available:platform",
135 ],
Jooyung Han3851f7e2020-04-16 18:48:33 +0900136 min_sdk_version: "29",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800137}
138
139cc_library_static {
140 name: "libbase_ndk",
141 defaults: ["libbase_defaults"],
142 sdk_version: "current",
143 stl: "c++_static",
144 export_include_dirs: ["include"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900145 static_libs: ["fmtlib_ndk"],
146 whole_static_libs: ["fmtlib_ndk"],
147 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800148}
149
Colin Crossfc06bd02016-07-11 14:15:31 -0700150// Tests
151// ------------------------------------------------------------------------------
152cc_test {
153 name: "libbase_test",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800154 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700155 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700156 srcs: [
Josh Gao14f95002019-01-07 19:16:21 -0800157 "cmsg_test.cpp",
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800158 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700159 "errors_test.cpp",
Jiyong Park7d89fb12019-05-15 19:17:48 +0900160 "expected_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700161 "file_test.cpp",
Tom Cherry36d31c52020-04-17 13:05:11 -0700162 "logging_splitters_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700163 "logging_test.cpp",
Elliott Hughes1b86d412018-04-06 17:45:22 -0700164 "macros_test.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -0700165 "mapped_file_test.cpp",
Josh Gaoefc9a632019-11-14 17:59:57 -0800166 "no_destructor_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700167 "parsedouble_test.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -0800168 "parsebool_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700169 "parseint_test.cpp",
170 "parsenetaddress_test.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -0700171 "process_test.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -0700172 "properties_test.cpp",
Jiyong Park8fd64c82019-05-31 03:43:34 +0900173 "result_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700174 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700175 "stringprintf_test.cpp",
176 "strings_test.cpp",
177 "test_main.cpp",
Josh Gao30171a82017-04-27 19:48:44 -0700178 "test_utils_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700179 ],
180 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700181 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800182 sanitize: {
183 misc_undefined: ["integer"],
184 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700185 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700186 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -0700187 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700188 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700189 windows: {
190 srcs: ["utf8_test.cpp"],
Dan Willemsen528f1442017-11-29 18:06:11 -0800191 cflags: ["-Wno-unused-parameter"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700192 enabled: true,
193 },
194 },
195 local_include_dirs: ["."],
Colin Crossfc06bd02016-07-11 14:15:31 -0700196 shared_libs: ["libbase"],
197 compile_multilib: "both",
198 multilib: {
199 lib32: {
200 suffix: "32",
201 },
202 lib64: {
203 suffix: "64",
204 },
205 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700206 test_suites: ["device-tests"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700207}
Tom Cherryb90dcc02019-06-14 14:34:54 -0700208
Josh Gaoe43893e2020-03-09 12:05:32 -0700209cc_test {
210 name: "libbase_tidy_test",
211 defaults: ["libbase_cflags_defaults"],
212 host_supported: true,
213
214 tidy: true,
215 tidy_checks_as_errors: ["bugprone-use-after-move"],
216
217 srcs: [
218 "tidy/unique_fd_test.cpp",
219 "tidy/unique_fd_test2.cpp",
220 ],
221
222 shared_libs: ["libbase"],
223 test_suites: ["device_tests"],
224}
225
Tom Cherryb90dcc02019-06-14 14:34:54 -0700226cc_benchmark {
227 name: "libbase_benchmark",
228 defaults: ["libbase_cflags_defaults"],
229
230 srcs: ["format_benchmark.cpp"],
231 shared_libs: ["libbase"],
232
233 compile_multilib: "both",
234 multilib: {
235 lib32: {
236 suffix: "32",
237 },
238 lib64: {
239 suffix: "64",
240 },
241 },
242}