blob: 13957560fb3161ef9dc6603a6ad2dbb9501d4b67 [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 host_supported: true,
43 srcs: [
44 "file.cpp",
45 "logging.cpp",
46 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070047 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070048 "stringprintf.cpp",
49 "strings.cpp",
50 "test_utils.cpp",
51 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070052
Colin Cross4eda9822017-04-18 17:42:10 -070053 header_libs: [
54 "libbase_headers",
Colin Cross4eda9822017-04-18 17:42:10 -070055 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070056 export_header_lib_headers: ["libbase_headers"],
57
Colin Crossfc06bd02016-07-11 14:15:31 -070058 cppflags: libbase_cppflags,
Colin Crossfc06bd02016-07-11 14:15:31 -070059 shared_libs: ["liblog"],
60 target: {
61 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070062 srcs: [
63 "errors_unix.cpp",
64 "properties.cpp",
Josh Gao0b35b182017-05-01 21:56:28 +000065 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070066 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070067 cppflags: ["-Wexit-time-destructors"],
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 },
73 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070074 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000075 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070076 "errors_unix.cpp",
77 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070078 cppflags: ["-Wexit-time-destructors"],
79 },
Dan Willemsenab34b472016-11-29 13:32:55 -080080 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070081 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000082 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070083 "errors_unix.cpp",
84 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080085 cppflags: ["-Wexit-time-destructors"],
86 enabled: true,
87 },
Colin Crossfc06bd02016-07-11 14:15:31 -070088 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -070089 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000090 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070091 "errors_unix.cpp",
92 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070093 cppflags: ["-Wexit-time-destructors"],
James Hawkinse78ea772017-03-24 11:43:02 -070094 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070095 },
96 windows: {
97 srcs: [
98 "errors_windows.cpp",
99 "utf8.cpp",
100 ],
101 enabled: true,
102 },
103 },
104}
105
106// Tests
107// ------------------------------------------------------------------------------
108cc_test {
109 name: "libbase_test",
110 host_supported: true,
Colin Crossfc06bd02016-07-11 14:15:31 -0700111 srcs: [
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800112 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700113 "errors_test.cpp",
114 "file_test.cpp",
115 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700116 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700117 "parseint_test.cpp",
118 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700119 "quick_exit_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700120 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700121 "stringprintf_test.cpp",
122 "strings_test.cpp",
123 "test_main.cpp",
124 ],
125 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700126 android: {
James Hawkinse78ea772017-03-24 11:43:02 -0700127 srcs: [
128 "chrono_utils_test.cpp",
129 "properties_test.cpp"
130 ],
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800131 sanitize: {
132 misc_undefined: ["integer"],
133 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700134 },
James Hawkinse78ea772017-03-24 11:43:02 -0700135 linux: {
136 srcs: ["chrono_utils_test.cpp"],
137 host_ldlibs: ["-lrt"],
138 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700139 windows: {
140 srcs: ["utf8_test.cpp"],
141 enabled: true,
142 },
143 },
144 local_include_dirs: ["."],
145 cppflags: libbase_cppflags,
146 shared_libs: ["libbase"],
147 compile_multilib: "both",
148 multilib: {
149 lib32: {
150 suffix: "32",
151 },
152 lib64: {
153 suffix: "64",
154 },
155 },
156}