blob: 14bfe36ee54bdd59b408c7b0f05648015356e34a [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,
44 srcs: [
Josh Gaoae293392017-04-28 12:39:48 -070045 "chrono_utils.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070046 "file.cpp",
47 "logging.cpp",
48 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070049 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070050 "stringprintf.cpp",
51 "strings.cpp",
52 "test_utils.cpp",
53 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070054
Colin Cross4eda9822017-04-18 17:42:10 -070055 header_libs: [
56 "libbase_headers",
57 "libutils_headers",
58 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070059 export_header_lib_headers: ["libbase_headers"],
60
Colin Crossfc06bd02016-07-11 14:15:31 -070061 cppflags: libbase_cppflags,
Colin Crossfc06bd02016-07-11 14:15:31 -070062 shared_libs: ["liblog"],
63 target: {
64 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070065 srcs: [
66 "errors_unix.cpp",
67 "properties.cpp",
68 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070069 cppflags: ["-Wexit-time-destructors"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080070 sanitize: {
71 misc_undefined: ["integer"],
72 },
James Hawkinse78ea772017-03-24 11:43:02 -070073
Colin Crossfc06bd02016-07-11 14:15:31 -070074 },
75 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070076 srcs: [
James Hawkinse78ea772017-03-24 11:43:02 -070077 "errors_unix.cpp",
78 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070079 cppflags: ["-Wexit-time-destructors"],
80 },
Dan Willemsenab34b472016-11-29 13:32:55 -080081 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070082 srcs: [
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: [
James Hawkinse78ea772017-03-24 11:43:02 -070090 "errors_unix.cpp",
91 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070092 cppflags: ["-Wexit-time-destructors"],
James Hawkinse78ea772017-03-24 11:43:02 -070093 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070094 },
95 windows: {
96 srcs: [
97 "errors_windows.cpp",
98 "utf8.cpp",
99 ],
100 enabled: true,
101 },
102 },
103}
104
105// Tests
106// ------------------------------------------------------------------------------
107cc_test {
108 name: "libbase_test",
109 host_supported: true,
110 clang: true,
111 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}