blob: b25d0df9579698cafeb115f7b09e412688ef074c [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,
Jiyong Park612210c2018-04-27 21:48:43 +090036 recovery_available: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070037 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +020038 native_bridge_supported: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070039 export_include_dirs: ["include"],
40
Steven Moreland3c71bbd2017-04-14 00:54:46 -070041 target: {
42 linux_bionic: {
43 enabled: true,
44 },
45 windows: {
46 enabled: true,
47 },
48 },
49}
50
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080051cc_defaults {
52 name: "libbase_defaults",
53 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -070054 srcs: [
Josh Gao27241a72019-04-25 14:04:57 -070055 "abi_compatibility.cpp",
Mark Salyzyn0c071c92018-02-05 07:41:31 -080056 "chrono_utils.cpp",
Josh Gao14f95002019-01-07 19:16:21 -080057 "cmsg.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070058 "file.cpp",
Tom Cherry349b0c42020-01-08 14:47:42 -080059 "liblog_symbols.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070060 "logging.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -070061 "mapped_file.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -080062 "parsebool.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070063 "parsenetaddress.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -070064 "process.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -070065 "properties.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070066 "stringprintf.cpp",
67 "strings.cpp",
Josh Gao5791e212018-03-16 14:25:42 -070068 "threads.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070069 "test_utils.cpp",
70 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070071
Tom Cherry349b0c42020-01-08 14:47:42 -080072 static: {
73 cflags: ["-DNO_LIBLOG_DLSYM"],
74 },
75
Pirama Arumuga Nainarca6ee832018-09-26 23:31:00 -070076 cppflags: ["-Wexit-time-destructors"],
Colin Crossfc06bd02016-07-11 14:15:31 -070077 shared_libs: ["liblog"],
78 target: {
79 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -080080 sanitize: {
81 misc_undefined: ["integer"],
82 },
James Hawkinse78ea772017-03-24 11:43:02 -070083
Colin Crossfc06bd02016-07-11 14:15:31 -070084 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070085 linux: {
86 srcs: [
Dan Willemsenbdddcab2017-10-03 14:17:31 -070087 "errors_unix.cpp",
88 ],
Dan Willemsenbdddcab2017-10-03 14:17:31 -070089 },
Colin Crossfc06bd02016-07-11 14:15:31 -070090 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070091 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070092 "errors_unix.cpp",
93 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070094 },
Dan Willemsenab34b472016-11-29 13:32:55 -080095 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080096 enabled: true,
97 },
Colin Crossfc06bd02016-07-11 14:15:31 -070098 windows: {
99 srcs: [
100 "errors_windows.cpp",
101 "utf8.cpp",
102 ],
Josh Gao14f95002019-01-07 19:16:21 -0800103 exclude_srcs: [
104 "cmsg.cpp",
105 ],
Colin Crossfc06bd02016-07-11 14:15:31 -0700106 enabled: true,
107 },
108 },
109}
110
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800111cc_library {
112 name: "libbase",
113 defaults: ["libbase_defaults"],
114 vendor_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900115 recovery_available: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800116 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +0200117 native_bridge_supported: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800118 vndk: {
119 enabled: true,
120 support_system_process: true,
121 },
122 header_libs: [
123 "libbase_headers",
124 ],
125 export_header_lib_headers: ["libbase_headers"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900126 static_libs: ["fmtlib"],
127 whole_static_libs: ["fmtlib"],
128 export_static_lib_headers: ["fmtlib"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800129}
130
131cc_library_static {
132 name: "libbase_ndk",
133 defaults: ["libbase_defaults"],
134 sdk_version: "current",
135 stl: "c++_static",
136 export_include_dirs: ["include"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900137 static_libs: ["fmtlib_ndk"],
138 whole_static_libs: ["fmtlib_ndk"],
139 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800140}
141
Colin Crossfc06bd02016-07-11 14:15:31 -0700142// Tests
143// ------------------------------------------------------------------------------
144cc_test {
145 name: "libbase_test",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800146 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700147 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700148 srcs: [
Josh Gao14f95002019-01-07 19:16:21 -0800149 "cmsg_test.cpp",
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800150 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700151 "errors_test.cpp",
Jiyong Park7d89fb12019-05-15 19:17:48 +0900152 "expected_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700153 "file_test.cpp",
154 "logging_test.cpp",
Elliott Hughes1b86d412018-04-06 17:45:22 -0700155 "macros_test.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -0700156 "mapped_file_test.cpp",
Josh Gaoefc9a632019-11-14 17:59:57 -0800157 "no_destructor_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700158 "parsedouble_test.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -0800159 "parsebool_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700160 "parseint_test.cpp",
161 "parsenetaddress_test.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -0700162 "process_test.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -0700163 "properties_test.cpp",
Jiyong Park8fd64c82019-05-31 03:43:34 +0900164 "result_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700165 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700166 "stringprintf_test.cpp",
167 "strings_test.cpp",
168 "test_main.cpp",
Josh Gao30171a82017-04-27 19:48:44 -0700169 "test_utils_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700170 ],
171 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700172 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800173 sanitize: {
174 misc_undefined: ["integer"],
175 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700176 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700177 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -0700178 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700179 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700180 windows: {
181 srcs: ["utf8_test.cpp"],
Dan Willemsen528f1442017-11-29 18:06:11 -0800182 cflags: ["-Wno-unused-parameter"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700183 enabled: true,
184 },
185 },
186 local_include_dirs: ["."],
Colin Crossfc06bd02016-07-11 14:15:31 -0700187 shared_libs: ["libbase"],
188 compile_multilib: "both",
189 multilib: {
190 lib32: {
191 suffix: "32",
192 },
193 lib64: {
194 suffix: "64",
195 },
196 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700197 test_suites: ["device-tests"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700198}
Tom Cherryb90dcc02019-06-14 14:34:54 -0700199
200cc_benchmark {
201 name: "libbase_benchmark",
202 defaults: ["libbase_cflags_defaults"],
203
204 srcs: ["format_benchmark.cpp"],
205 shared_libs: ["libbase"],
206
207 compile_multilib: "both",
208 multilib: {
209 lib32: {
210 suffix: "32",
211 },
212 lib64: {
213 suffix: "64",
214 },
215 },
216}