blob: 357ce01e7c96eba16e552c149b58df85b90d992f [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",
Elliott Hughes9082e7a2018-12-19 12:55:17 -080023 "-D_FILE_OFFSET_BITS=64",
Elliott Hughesdc699a22018-02-16 17:58:14 -080024 ],
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070025}
Colin Crossfc06bd02016-07-11 14:15:31 -070026
Steven Moreland3c71bbd2017-04-14 00:54:46 -070027cc_library_headers {
28 name: "libbase_headers",
29 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090030 recovery_available: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070031 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +020032 native_bridge_supported: true,
Steven Moreland3c71bbd2017-04-14 00:54:46 -070033 export_include_dirs: ["include"],
34
Steven Moreland3c71bbd2017-04-14 00:54:46 -070035 target: {
36 linux_bionic: {
37 enabled: true,
38 },
39 windows: {
40 enabled: true,
41 },
42 },
43}
44
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080045cc_defaults {
46 name: "libbase_defaults",
47 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -070048 srcs: [
Josh Gao27241a72019-04-25 14:04:57 -070049 "abi_compatibility.cpp",
Mark Salyzyn0c071c92018-02-05 07:41:31 -080050 "chrono_utils.cpp",
Josh Gao14f95002019-01-07 19:16:21 -080051 "cmsg.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070052 "file.cpp",
53 "logging.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -070054 "mapped_file.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070055 "parsenetaddress.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -070056 "process.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -070057 "properties.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070058 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070059 "stringprintf.cpp",
60 "strings.cpp",
Josh Gao5791e212018-03-16 14:25:42 -070061 "threads.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070062 "test_utils.cpp",
63 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070064
Pirama Arumuga Nainarca6ee832018-09-26 23:31:00 -070065 cppflags: ["-Wexit-time-destructors"],
Colin Crossfc06bd02016-07-11 14:15:31 -070066 shared_libs: ["liblog"],
67 target: {
68 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -080069 sanitize: {
70 misc_undefined: ["integer"],
71 },
James Hawkinse78ea772017-03-24 11:43:02 -070072
Colin Crossfc06bd02016-07-11 14:15:31 -070073 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070074 linux: {
75 srcs: [
Dan Willemsenbdddcab2017-10-03 14:17:31 -070076 "errors_unix.cpp",
77 ],
Dan Willemsenbdddcab2017-10-03 14:17:31 -070078 },
Colin Crossfc06bd02016-07-11 14:15:31 -070079 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070080 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070081 "errors_unix.cpp",
82 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070083 },
Dan Willemsenab34b472016-11-29 13:32:55 -080084 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080085 enabled: true,
86 },
Colin Crossfc06bd02016-07-11 14:15:31 -070087 windows: {
88 srcs: [
89 "errors_windows.cpp",
90 "utf8.cpp",
91 ],
Josh Gao14f95002019-01-07 19:16:21 -080092 exclude_srcs: [
93 "cmsg.cpp",
94 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070095 enabled: true,
96 },
97 },
98}
99
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800100cc_library {
101 name: "libbase",
102 defaults: ["libbase_defaults"],
103 vendor_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900104 recovery_available: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800105 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +0200106 native_bridge_supported: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800107 vndk: {
108 enabled: true,
109 support_system_process: true,
110 },
111 header_libs: [
112 "libbase_headers",
113 ],
114 export_header_lib_headers: ["libbase_headers"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900115 static_libs: ["fmtlib"],
116 whole_static_libs: ["fmtlib"],
117 export_static_lib_headers: ["fmtlib"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800118}
119
120cc_library_static {
121 name: "libbase_ndk",
122 defaults: ["libbase_defaults"],
123 sdk_version: "current",
124 stl: "c++_static",
125 export_include_dirs: ["include"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900126 static_libs: ["fmtlib_ndk"],
127 whole_static_libs: ["fmtlib_ndk"],
128 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800129}
130
Colin Crossfc06bd02016-07-11 14:15:31 -0700131// Tests
132// ------------------------------------------------------------------------------
133cc_test {
134 name: "libbase_test",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800135 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700136 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700137 srcs: [
Josh Gao14f95002019-01-07 19:16:21 -0800138 "cmsg_test.cpp",
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800139 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700140 "errors_test.cpp",
Jiyong Park7d89fb12019-05-15 19:17:48 +0900141 "expected_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700142 "file_test.cpp",
143 "logging_test.cpp",
Elliott Hughes1b86d412018-04-06 17:45:22 -0700144 "macros_test.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -0700145 "mapped_file_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700146 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700147 "parseint_test.cpp",
148 "parsenetaddress_test.cpp",
Tom Cherry13b1f342019-06-28 11:09:33 -0700149 "process_test.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -0700150 "properties_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700151 "quick_exit_test.cpp",
Jiyong Park8fd64c82019-05-31 03:43:34 +0900152 "result_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700153 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700154 "stringprintf_test.cpp",
155 "strings_test.cpp",
156 "test_main.cpp",
Josh Gao30171a82017-04-27 19:48:44 -0700157 "test_utils_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700158 ],
159 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700160 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800161 sanitize: {
162 misc_undefined: ["integer"],
163 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700164 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700165 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -0700166 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700167 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700168 windows: {
169 srcs: ["utf8_test.cpp"],
Dan Willemsen528f1442017-11-29 18:06:11 -0800170 cflags: ["-Wno-unused-parameter"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700171 enabled: true,
172 },
173 },
174 local_include_dirs: ["."],
Colin Crossfc06bd02016-07-11 14:15:31 -0700175 shared_libs: ["libbase"],
176 compile_multilib: "both",
177 multilib: {
178 lib32: {
179 suffix: "32",
180 },
181 lib64: {
182 suffix: "64",
183 },
184 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700185 test_suites: ["device-tests"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700186}
Tom Cherryb90dcc02019-06-14 14:34:54 -0700187
188cc_benchmark {
189 name: "libbase_benchmark",
190 defaults: ["libbase_cflags_defaults"],
191
192 srcs: ["format_benchmark.cpp"],
193 shared_libs: ["libbase"],
194
195 compile_multilib: "both",
196 multilib: {
197 lib32: {
198 suffix: "32",
199 },
200 lib64: {
201 suffix: "64",
202 },
203 },
204}