blob: 81b96db433162cb76f1a4de05507f6fefae6edb0 [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: [
45 "file.cpp",
46 "logging.cpp",
47 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070048 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070049 "stringprintf.cpp",
50 "strings.cpp",
51 "test_utils.cpp",
52 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070053
Colin Cross4eda9822017-04-18 17:42:10 -070054 header_libs: [
55 "libbase_headers",
56 "libutils_headers",
57 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070058 export_header_lib_headers: ["libbase_headers"],
59
Colin Crossfc06bd02016-07-11 14:15:31 -070060 cppflags: libbase_cppflags,
Colin Crossfc06bd02016-07-11 14:15:31 -070061 shared_libs: ["liblog"],
62 target: {
63 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070064 srcs: [
65 "errors_unix.cpp",
66 "properties.cpp",
Josh Gao0b35b182017-05-01 21:56:28 +000067 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070068 ],
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: [
Josh Gao0b35b182017-05-01 21:56:28 +000077 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070078 "errors_unix.cpp",
79 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070080 cppflags: ["-Wexit-time-destructors"],
81 },
Dan Willemsenab34b472016-11-29 13:32:55 -080082 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070083 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000084 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070085 "errors_unix.cpp",
86 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080087 cppflags: ["-Wexit-time-destructors"],
88 enabled: true,
89 },
Colin Crossfc06bd02016-07-11 14:15:31 -070090 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -070091 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000092 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070093 "errors_unix.cpp",
94 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070095 cppflags: ["-Wexit-time-destructors"],
James Hawkinse78ea772017-03-24 11:43:02 -070096 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070097 },
98 windows: {
99 srcs: [
100 "errors_windows.cpp",
101 "utf8.cpp",
102 ],
103 enabled: true,
104 },
105 },
106}
107
108// Tests
109// ------------------------------------------------------------------------------
110cc_test {
111 name: "libbase_test",
112 host_supported: true,
113 clang: true,
114 srcs: [
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800115 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700116 "errors_test.cpp",
117 "file_test.cpp",
118 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700119 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700120 "parseint_test.cpp",
121 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700122 "quick_exit_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700123 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700124 "stringprintf_test.cpp",
125 "strings_test.cpp",
126 "test_main.cpp",
127 ],
128 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700129 android: {
James Hawkinse78ea772017-03-24 11:43:02 -0700130 srcs: [
131 "chrono_utils_test.cpp",
132 "properties_test.cpp"
133 ],
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800134 sanitize: {
135 misc_undefined: ["integer"],
136 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700137 },
James Hawkinse78ea772017-03-24 11:43:02 -0700138 linux: {
139 srcs: ["chrono_utils_test.cpp"],
140 host_ldlibs: ["-lrt"],
141 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700142 windows: {
143 srcs: ["utf8_test.cpp"],
144 enabled: true,
145 },
146 },
147 local_include_dirs: ["."],
148 cppflags: libbase_cppflags,
149 shared_libs: ["libbase"],
150 compile_multilib: "both",
151 multilib: {
152 lib32: {
153 suffix: "32",
154 },
155 lib64: {
156 suffix: "64",
157 },
158 },
159}