blob: a32959bb9154436f122959bb22671896de825644 [file] [log] [blame]
Colin Crosscaaeb282016-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 Hsieh6f36fb02017-10-02 15:20:07 -070017cc_defaults {
Andreas Gampeed917072018-02-15 11:40:30 -080018 name: "libbase_cflags_defaults",
Elliott Hughesa72e3f62018-02-16 17:58:14 -080019 cflags: [
20 "-Wall",
21 "-Werror",
22 "-Wextra",
23 ],
Paul Crowleyd47a8d72019-09-11 15:31:55 -070024 target: {
25 android: {
26 cflags: [
27 "-D_FILE_OFFSET_BITS=64",
28 ],
29 },
30 },
Chih-Hung Hsieh6f36fb02017-10-02 15:20:07 -070031}
Colin Crosscaaeb282016-07-11 14:15:31 -070032
Steven Morelanda347b772017-04-14 00:54:46 -070033cc_library_headers {
34 name: "libbase_headers",
35 vendor_available: true,
Yifan Hong5afe8b72020-01-21 18:17:19 -080036 ramdisk_available: true,
Jiyong Parkb51bddd2018-04-27 21:48:43 +090037 recovery_available: true,
Steven Morelanda347b772017-04-14 00:54:46 -070038 host_supported: true,
dimitry3b9b11e2019-05-06 14:01:58 +020039 native_bridge_supported: true,
Steven Morelanda347b772017-04-14 00:54:46 -070040 export_include_dirs: ["include"],
41
Steven Morelanda347b772017-04-14 00:54:46 -070042 target: {
43 linux_bionic: {
44 enabled: true,
45 },
46 windows: {
47 enabled: true,
48 },
49 },
50}
51
Andreas Gampeed917072018-02-15 11:40:30 -080052cc_defaults {
53 name: "libbase_defaults",
54 defaults: ["libbase_cflags_defaults"],
Colin Crosscaaeb282016-07-11 14:15:31 -070055 srcs: [
Josh Gaoe4401992019-04-25 14:04:57 -070056 "abi_compatibility.cpp",
Mark Salyzyn764a9c72018-02-05 07:41:31 -080057 "chrono_utils.cpp",
Josh Gaoc50f38f2019-01-07 19:16:21 -080058 "cmsg.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070059 "file.cpp",
Tom Cherry1bfa8ab2020-01-08 14:47:42 -080060 "liblog_symbols.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070061 "logging.cpp",
Elliott Hughes51140082018-10-19 16:09:39 -070062 "mapped_file.cpp",
Daniel Colascione57fceb92019-11-14 00:48:36 -080063 "parsebool.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070064 "parsenetaddress.cpp",
Tom Cherry3f82dfb2019-06-28 11:09:33 -070065 "process.cpp",
Elliott Hughes083c2fe2018-05-24 18:00:39 -070066 "properties.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070067 "stringprintf.cpp",
68 "strings.cpp",
Josh Gaoef102be2018-03-16 14:25:42 -070069 "threads.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070070 "test_utils.cpp",
71 ],
Steven Morelanda347b772017-04-14 00:54:46 -070072
Tom Cherry1bfa8ab2020-01-08 14:47:42 -080073 static: {
74 cflags: ["-DNO_LIBLOG_DLSYM"],
75 },
76
Pirama Arumuga Nainar00b10a82018-09-26 23:31:00 -070077 cppflags: ["-Wexit-time-destructors"],
Colin Crosscaaeb282016-07-11 14:15:31 -070078 shared_libs: ["liblog"],
79 target: {
80 android: {
Elliott Hughes83b00972017-02-14 15:46:33 -080081 sanitize: {
82 misc_undefined: ["integer"],
83 },
James Hawkins99574972017-03-24 11:43:02 -070084
Colin Crosscaaeb282016-07-11 14:15:31 -070085 },
Dan Willemsen2cb672f2017-10-03 14:17:31 -070086 linux: {
87 srcs: [
Dan Willemsen2cb672f2017-10-03 14:17:31 -070088 "errors_unix.cpp",
89 ],
Dan Willemsen2cb672f2017-10-03 14:17:31 -070090 },
Colin Crosscaaeb282016-07-11 14:15:31 -070091 darwin: {
James Hawkins99574972017-03-24 11:43:02 -070092 srcs: [
James Hawkins99574972017-03-24 11:43:02 -070093 "errors_unix.cpp",
94 ],
Colin Crosscaaeb282016-07-11 14:15:31 -070095 },
Dan Willemsen15acb592016-11-29 13:32:55 -080096 linux_bionic: {
Dan Willemsen15acb592016-11-29 13:32:55 -080097 enabled: true,
98 },
Colin Crosscaaeb282016-07-11 14:15:31 -070099 windows: {
100 srcs: [
101 "errors_windows.cpp",
102 "utf8.cpp",
103 ],
Josh Gaoc50f38f2019-01-07 19:16:21 -0800104 exclude_srcs: [
105 "cmsg.cpp",
106 ],
Colin Crosscaaeb282016-07-11 14:15:31 -0700107 enabled: true,
108 },
109 },
110}
111
Andreas Gampeed917072018-02-15 11:40:30 -0800112cc_library {
113 name: "libbase",
114 defaults: ["libbase_defaults"],
115 vendor_available: true,
Yifan Hong5afe8b72020-01-21 18:17:19 -0800116 ramdisk_available: true,
Jiyong Park9670f162018-05-24 14:11:00 +0900117 recovery_available: true,
Andreas Gampeed917072018-02-15 11:40:30 -0800118 host_supported: true,
dimitry3b9b11e2019-05-06 14:01:58 +0200119 native_bridge_supported: true,
Andreas Gampeed917072018-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 Park4e223e62019-06-12 16:25:04 +0900128 static_libs: ["fmtlib"],
129 whole_static_libs: ["fmtlib"],
130 export_static_lib_headers: ["fmtlib"],
Andreas Gampeed917072018-02-15 11:40:30 -0800131}
132
133cc_library_static {
134 name: "libbase_ndk",
135 defaults: ["libbase_defaults"],
136 sdk_version: "current",
137 stl: "c++_static",
138 export_include_dirs: ["include"],
Jiyong Park4e223e62019-06-12 16:25:04 +0900139 static_libs: ["fmtlib_ndk"],
140 whole_static_libs: ["fmtlib_ndk"],
141 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeed917072018-02-15 11:40:30 -0800142}
143
Colin Crosscaaeb282016-07-11 14:15:31 -0700144// Tests
145// ------------------------------------------------------------------------------
146cc_test {
147 name: "libbase_test",
Andreas Gampeed917072018-02-15 11:40:30 -0800148 defaults: ["libbase_cflags_defaults"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700149 host_supported: true,
Colin Crosscaaeb282016-07-11 14:15:31 -0700150 srcs: [
Josh Gaoc50f38f2019-01-07 19:16:21 -0800151 "cmsg_test.cpp",
Elliott Hughes08baa862017-02-24 14:02:05 -0800152 "endian_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700153 "errors_test.cpp",
Jiyong Parkde84d4a2019-05-15 19:17:48 +0900154 "expected_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700155 "file_test.cpp",
156 "logging_test.cpp",
Elliott Hughesda37d812018-04-06 17:45:22 -0700157 "macros_test.cpp",
Elliott Hughes51140082018-10-19 16:09:39 -0700158 "mapped_file_test.cpp",
Josh Gao916ea5e2019-11-14 17:59:57 -0800159 "no_destructor_test.cpp",
Yabin Cuiebe8eef2016-10-05 10:54:35 -0700160 "parsedouble_test.cpp",
Daniel Colascione57fceb92019-11-14 00:48:36 -0800161 "parsebool_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700162 "parseint_test.cpp",
163 "parsenetaddress_test.cpp",
Tom Cherry3f82dfb2019-06-28 11:09:33 -0700164 "process_test.cpp",
Elliott Hughes083c2fe2018-05-24 18:00:39 -0700165 "properties_test.cpp",
Jiyong Parkab7dc5a2019-05-31 03:43:34 +0900166 "result_test.cpp",
Tom Cherry1d273062017-04-05 14:15:31 -0700167 "scopeguard_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700168 "stringprintf_test.cpp",
169 "strings_test.cpp",
170 "test_main.cpp",
Josh Gao8f1fa002017-04-27 19:48:44 -0700171 "test_utils_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700172 ],
173 target: {
Elliott Hughes5a7788c2016-09-21 16:53:15 -0700174 android: {
Elliott Hughes83b00972017-02-14 15:46:33 -0800175 sanitize: {
176 misc_undefined: ["integer"],
177 },
Elliott Hughes5a7788c2016-09-21 16:53:15 -0700178 },
Dan Willemsen2cb672f2017-10-03 14:17:31 -0700179 linux: {
James Hawkins99574972017-03-24 11:43:02 -0700180 srcs: ["chrono_utils_test.cpp"],
James Hawkins99574972017-03-24 11:43:02 -0700181 },
Colin Crosscaaeb282016-07-11 14:15:31 -0700182 windows: {
183 srcs: ["utf8_test.cpp"],
Dan Willemsenb80b3d52017-11-29 18:06:11 -0800184 cflags: ["-Wno-unused-parameter"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700185 enabled: true,
186 },
187 },
188 local_include_dirs: ["."],
Colin Crosscaaeb282016-07-11 14:15:31 -0700189 shared_libs: ["libbase"],
190 compile_multilib: "both",
191 multilib: {
192 lib32: {
193 suffix: "32",
194 },
195 lib64: {
196 suffix: "64",
197 },
198 },
Elliott Hughesefdeefd2018-04-27 16:12:06 -0700199 test_suites: ["device-tests"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700200}
Tom Cherry377d1ad2019-06-14 14:34:54 -0700201
202cc_benchmark {
203 name: "libbase_benchmark",
204 defaults: ["libbase_cflags_defaults"],
205
206 srcs: ["format_benchmark.cpp"],
207 shared_libs: ["libbase"],
208
209 compile_multilib: "both",
210 multilib: {
211 lib32: {
212 suffix: "32",
213 },
214 lib64: {
215 suffix: "64",
216 },
217 },
218}