blob: 6c3a593a767f11eebd8c460b39a5779e783387e2 [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
17libbase_cppflags = [
18 "-Wall",
19 "-Wextra",
20 "-Werror",
21]
22
Steven Moreland3c71bbd2017-04-14 00:54:46 -070023cc_library_headers {
24 name: "libbase_headers",
25 vendor_available: true,
26 host_supported: true,
27 export_include_dirs: ["include"],
28
Steven Moreland3c71bbd2017-04-14 00:54:46 -070029 target: {
30 linux_bionic: {
31 enabled: true,
32 },
33 windows: {
34 enabled: true,
35 },
36 },
37}
38
Colin Crossfc06bd02016-07-11 14:15:31 -070039cc_library {
40 name: "libbase",
Steven Morelandd10a0232017-04-13 15:13:57 -070041 vendor_available: true,
Colin Crossfc06bd02016-07-11 14:15:31 -070042 clang: true,
43 host_supported: true,
Justin Yunaeb68e82017-07-31 15:41:10 +090044 vndk: {
45 enabled: true,
46 support_system_process: true,
47 },
Colin Crossfc06bd02016-07-11 14:15:31 -070048 srcs: [
49 "file.cpp",
50 "logging.cpp",
51 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070052 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070053 "stringprintf.cpp",
54 "strings.cpp",
55 "test_utils.cpp",
56 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070057
Colin Cross4eda9822017-04-18 17:42:10 -070058 header_libs: [
59 "libbase_headers",
Colin Cross4eda9822017-04-18 17:42:10 -070060 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070061 export_header_lib_headers: ["libbase_headers"],
62
Colin Crossfc06bd02016-07-11 14:15:31 -070063 cppflags: libbase_cppflags,
Colin Crossfc06bd02016-07-11 14:15:31 -070064 shared_libs: ["liblog"],
65 target: {
66 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070067 srcs: [
68 "errors_unix.cpp",
69 "properties.cpp",
Josh Gao0b35b182017-05-01 21:56:28 +000070 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070071 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070072 cppflags: ["-Wexit-time-destructors"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080073 sanitize: {
74 misc_undefined: ["integer"],
75 },
James Hawkinse78ea772017-03-24 11:43:02 -070076
Colin Crossfc06bd02016-07-11 14:15:31 -070077 },
78 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070079 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000080 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070081 "errors_unix.cpp",
82 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070083 cppflags: ["-Wexit-time-destructors"],
84 },
Dan Willemsenab34b472016-11-29 13:32:55 -080085 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070086 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000087 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070088 "errors_unix.cpp",
89 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080090 cppflags: ["-Wexit-time-destructors"],
91 enabled: true,
92 },
Colin Crossfc06bd02016-07-11 14:15:31 -070093 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -070094 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000095 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070096 "errors_unix.cpp",
97 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070098 cppflags: ["-Wexit-time-destructors"],
James Hawkinse78ea772017-03-24 11:43:02 -070099 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -0700100 },
101 windows: {
102 srcs: [
103 "errors_windows.cpp",
104 "utf8.cpp",
105 ],
106 enabled: true,
107 },
108 },
109}
110
111// Tests
112// ------------------------------------------------------------------------------
113cc_test {
114 name: "libbase_test",
115 host_supported: true,
116 clang: true,
117 srcs: [
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800118 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700119 "errors_test.cpp",
120 "file_test.cpp",
121 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700122 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700123 "parseint_test.cpp",
124 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700125 "quick_exit_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700126 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700127 "stringprintf_test.cpp",
128 "strings_test.cpp",
129 "test_main.cpp",
130 ],
131 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700132 android: {
James Hawkinse78ea772017-03-24 11:43:02 -0700133 srcs: [
134 "chrono_utils_test.cpp",
135 "properties_test.cpp"
136 ],
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800137 sanitize: {
138 misc_undefined: ["integer"],
139 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700140 },
James Hawkinse78ea772017-03-24 11:43:02 -0700141 linux: {
142 srcs: ["chrono_utils_test.cpp"],
143 host_ldlibs: ["-lrt"],
144 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700145 windows: {
146 srcs: ["utf8_test.cpp"],
147 enabled: true,
148 },
149 },
150 local_include_dirs: ["."],
151 cppflags: libbase_cppflags,
152 shared_libs: ["libbase"],
153 compile_multilib: "both",
154 multilib: {
155 lib32: {
156 suffix: "32",
157 },
158 lib64: {
159 suffix: "64",
160 },
161 },
162}