blob: 58b6fb52636268d01780c39a7bc1ed0626da9a8f [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",
Elliott Hughesdc803122018-05-24 18:00:39 -070056 "properties.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070057 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070058 "stringprintf.cpp",
59 "strings.cpp",
Josh Gao5791e212018-03-16 14:25:42 -070060 "threads.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070061 "test_utils.cpp",
62 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070063
Pirama Arumuga Nainarca6ee832018-09-26 23:31:00 -070064 cppflags: ["-Wexit-time-destructors"],
Colin Crossfc06bd02016-07-11 14:15:31 -070065 shared_libs: ["liblog"],
66 target: {
67 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -080068 sanitize: {
69 misc_undefined: ["integer"],
70 },
James Hawkinse78ea772017-03-24 11:43:02 -070071
Colin Crossfc06bd02016-07-11 14:15:31 -070072 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070073 linux: {
74 srcs: [
Dan Willemsenbdddcab2017-10-03 14:17:31 -070075 "errors_unix.cpp",
76 ],
Dan Willemsenbdddcab2017-10-03 14:17:31 -070077 },
Colin Crossfc06bd02016-07-11 14:15:31 -070078 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070079 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070080 "errors_unix.cpp",
81 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070082 },
Dan Willemsenab34b472016-11-29 13:32:55 -080083 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080084 enabled: true,
85 },
Colin Crossfc06bd02016-07-11 14:15:31 -070086 windows: {
87 srcs: [
88 "errors_windows.cpp",
89 "utf8.cpp",
90 ],
Josh Gao14f95002019-01-07 19:16:21 -080091 exclude_srcs: [
92 "cmsg.cpp",
93 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070094 enabled: true,
95 },
96 },
97}
98
Andreas Gampeaf05f3b2018-02-15 11:40:30 -080099cc_library {
100 name: "libbase",
101 defaults: ["libbase_defaults"],
102 vendor_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900103 recovery_available: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800104 host_supported: true,
dimitrya808b112019-05-06 14:01:58 +0200105 native_bridge_supported: true,
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800106 vndk: {
107 enabled: true,
108 support_system_process: true,
109 },
110 header_libs: [
111 "libbase_headers",
112 ],
113 export_header_lib_headers: ["libbase_headers"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900114 static_libs: ["fmtlib"],
115 whole_static_libs: ["fmtlib"],
116 export_static_lib_headers: ["fmtlib"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800117}
118
119cc_library_static {
120 name: "libbase_ndk",
121 defaults: ["libbase_defaults"],
122 sdk_version: "current",
123 stl: "c++_static",
124 export_include_dirs: ["include"],
Jiyong Park20524ed2019-06-12 16:25:04 +0900125 static_libs: ["fmtlib_ndk"],
126 whole_static_libs: ["fmtlib_ndk"],
127 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800128}
129
Colin Crossfc06bd02016-07-11 14:15:31 -0700130// Tests
131// ------------------------------------------------------------------------------
132cc_test {
133 name: "libbase_test",
Andreas Gampeaf05f3b2018-02-15 11:40:30 -0800134 defaults: ["libbase_cflags_defaults"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700135 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700136 srcs: [
Josh Gao14f95002019-01-07 19:16:21 -0800137 "cmsg_test.cpp",
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800138 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700139 "errors_test.cpp",
Jiyong Park7d89fb12019-05-15 19:17:48 +0900140 "expected_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700141 "file_test.cpp",
142 "logging_test.cpp",
Elliott Hughes1b86d412018-04-06 17:45:22 -0700143 "macros_test.cpp",
Elliott Hughese8f4b142018-10-19 16:09:39 -0700144 "mapped_file_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700145 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700146 "parseint_test.cpp",
147 "parsenetaddress_test.cpp",
Elliott Hughesdc803122018-05-24 18:00:39 -0700148 "properties_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700149 "quick_exit_test.cpp",
Jiyong Park8fd64c82019-05-31 03:43:34 +0900150 "result_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700151 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700152 "stringprintf_test.cpp",
153 "strings_test.cpp",
154 "test_main.cpp",
Josh Gao30171a82017-04-27 19:48:44 -0700155 "test_utils_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700156 ],
157 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700158 android: {
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800159 sanitize: {
160 misc_undefined: ["integer"],
161 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700162 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700163 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -0700164 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700165 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700166 windows: {
167 srcs: ["utf8_test.cpp"],
Dan Willemsen528f1442017-11-29 18:06:11 -0800168 cflags: ["-Wno-unused-parameter"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700169 enabled: true,
170 },
171 },
172 local_include_dirs: ["."],
Colin Crossfc06bd02016-07-11 14:15:31 -0700173 shared_libs: ["libbase"],
174 compile_multilib: "both",
175 multilib: {
176 lib32: {
177 suffix: "32",
178 },
179 lib64: {
180 suffix: "64",
181 },
182 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700183 test_suites: ["device-tests"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700184}
Tom Cherryb90dcc02019-06-14 14:34:54 -0700185
186cc_benchmark {
187 name: "libbase_benchmark",
188 defaults: ["libbase_cflags_defaults"],
189
190 srcs: ["format_benchmark.cpp"],
191 shared_libs: ["libbase"],
192
193 compile_multilib: "both",
194 multilib: {
195 lib32: {
196 suffix: "32",
197 },
198 lib64: {
199 suffix: "64",
200 },
201 },
202}