blob: 25c74f2193e329cabd766071cd36b371691b43ba [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 },
50}
51
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080052cc_defaults {
53 name: "libbase_defaults",
54 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -070055 srcs: [
Josh Gao27241a72019-04-25 14:04:57 -070056 "abi_compatibility.cpp",
Mark Salyzyn0c071c92018-02-05 07:41:31 -080057 "chrono_utils.cpp",
Josh Gao14f95002019-01-07 19:16:21 -080058 "cmsg.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070059 "file.cpp",
Tom Cherry349b0c42020-01-08 14:47:42 -080060 "liblog_symbols.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070061 "logging.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -070062 "mapped_file.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -080063 "parsebool.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070064 "parsenetaddress.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -070065 "process.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -070066 "properties.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070067 "stringprintf.cpp",
68 "strings.cpp",
Josh Gao5791e212018-03-16 14:25:42 -070069 "threads.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070070 "test_utils.cpp",
71 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070072
Tom Cherry349b0c42020-01-08 14:47:42 -080073 static: {
74 cflags: ["-DNO_LIBLOG_DLSYM"],
75 },
76
Pirama Arumuga Nainarca6ee832018-09-26 23:31:00 -070077 cppflags: ["-Wexit-time-destructors"],
Colin Crossfc06bd02016-07-11 14:15:31 -070078 shared_libs: ["liblog"],
79 target: {
80 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -080081 sanitize: {
82 misc_undefined: ["integer"],
83 },
James Hawkinse78ea772017-03-24 11:43:02 -070084
Colin Crossfc06bd02016-07-11 14:15:31 -070085 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070086 linux: {
87 srcs: [
Dan Willemsenbdddcab2017-10-03 14:17:31 -070088 "errors_unix.cpp",
89 ],
Dan Willemsenbdddcab2017-10-03 14:17:31 -070090 },
Colin Crossfc06bd02016-07-11 14:15:31 -070091 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070092 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070093 "errors_unix.cpp",
94 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070095 },
Dan Willemsenab34b472016-11-29 13:32:55 -080096 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080097 enabled: true,
98 },
Colin Crossfc06bd02016-07-11 14:15:31 -070099 windows: {
100 srcs: [
101 "errors_windows.cpp",
102 "utf8.cpp",
103 ],
Josh Gao14f95002019-01-07 19:16:21 -0800104 exclude_srcs: [
105 "cmsg.cpp",
106 ],
Colin Crossfc06bd02016-07-11 14:15:31 -0700107 enabled: true,
108 },
109 },
110}
111
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800112cc_library {
113 name: "libbase",
114 defaults: ["libbase_defaults"],
115 vendor_available: true,
Yifan Hong7dd45532020-01-21 18:17:19 -0800116 ramdisk_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900117 recovery_available: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800118 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +0200119 native_bridge_supported: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800120 vndk: {
121 enabled: true,
122 support_system_process: true,
123 },
124 header_libs: [
125 "libbase_headers",
126 ],
127 export_header_lib_headers: ["libbase_headers"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900128 static_libs: ["fmtlib"],
129 whole_static_libs: ["fmtlib"],
130 export_static_lib_headers: ["fmtlib"],
Jeffrey Huang0c0b7742020-02-14 10:27:17 -0800131 apex_available: [
132 "//apex_available:anyapex",
133 "//apex_available:platform",
134 ],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800135}
136
137cc_library_static {
138 name: "libbase_ndk",
139 defaults: ["libbase_defaults"],
140 sdk_version: "current",
141 stl: "c++_static",
142 export_include_dirs: ["include"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900143 static_libs: ["fmtlib_ndk"],
144 whole_static_libs: ["fmtlib_ndk"],
145 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800146}
147
Colin Crossfc06bd02016-07-11 14:15:31 -0700148// Tests
149// ------------------------------------------------------------------------------
150cc_test {
151 name: "libbase_test",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800152 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700153 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700154 srcs: [
Josh Gao14f95002019-01-07 19:16:21 -0800155 "cmsg_test.cpp",
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800156 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700157 "errors_test.cpp",
Jiyong Park7d89fb12019-05-15 19:17:48 +0900158 "expected_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700159 "file_test.cpp",
160 "logging_test.cpp",
Elliott Hughes1b86d412018-04-06 17:45:22 -0700161 "macros_test.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -0700162 "mapped_file_test.cpp",
Josh Gaoefc9a632019-11-14 17:59:57 -0800163 "no_destructor_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700164 "parsedouble_test.cpp",
Daniel Colascione9e3cbb62019-11-14 00:48:36 -0800165 "parsebool_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700166 "parseint_test.cpp",
167 "parsenetaddress_test.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -0700168 "process_test.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -0700169 "properties_test.cpp",
Jiyong Park8fd64c82019-05-31 03:43:34 +0900170 "result_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700171 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700172 "stringprintf_test.cpp",
173 "strings_test.cpp",
174 "test_main.cpp",
Josh Gao30171a82017-04-27 19:48:44 -0700175 "test_utils_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700176 ],
177 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700178 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800179 sanitize: {
180 misc_undefined: ["integer"],
181 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700182 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700183 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -0700184 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700185 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700186 windows: {
187 srcs: ["utf8_test.cpp"],
Dan Willemsen528f1442017-11-29 18:06:11 -0800188 cflags: ["-Wno-unused-parameter"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700189 enabled: true,
190 },
191 },
192 local_include_dirs: ["."],
Colin Crossfc06bd02016-07-11 14:15:31 -0700193 shared_libs: ["libbase"],
194 compile_multilib: "both",
195 multilib: {
196 lib32: {
197 suffix: "32",
198 },
199 lib64: {
200 suffix: "64",
201 },
202 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700203 test_suites: ["device-tests"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700204}
Tom Cherryb90dcc02019-06-14 14:34:54 -0700205
206cc_benchmark {
207 name: "libbase_benchmark",
208 defaults: ["libbase_cflags_defaults"],
209
210 srcs: ["format_benchmark.cpp"],
211 shared_libs: ["libbase"],
212
213 compile_multilib: "both",
214 multilib: {
215 lib32: {
216 suffix: "32",
217 },
218 lib64: {
219 suffix: "64",
220 },
221 },
222}