blob: c1c0bf83fa2c9bec65ec9162fb3199838bdf1e86 [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
29 header_libs: ["libutils_headers"],
30 export_header_lib_headers: ["libutils_headers"],
31
32 target: {
33 linux_bionic: {
34 enabled: true,
35 },
36 windows: {
37 enabled: true,
38 },
39 },
40}
41
Colin Crossfc06bd02016-07-11 14:15:31 -070042cc_library {
43 name: "libbase",
Steven Morelandd10a0232017-04-13 15:13:57 -070044 vendor_available: true,
Colin Crossfc06bd02016-07-11 14:15:31 -070045 clang: true,
46 host_supported: true,
47 srcs: [
48 "file.cpp",
49 "logging.cpp",
50 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070051 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070052 "stringprintf.cpp",
53 "strings.cpp",
54 "test_utils.cpp",
55 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070056
57 header_libs: ["libbase_headers"],
58 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"],
Steven Morelandd10a0232017-04-13 15:13:57 -070062 header_libs: ["libutils_headers"],
Colin Crossfc06bd02016-07-11 14:15:31 -070063 target: {
64 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070065 srcs: [
66 "errors_unix.cpp",
67 "properties.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070068 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070069 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070070 cppflags: ["-Wexit-time-destructors"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080071 sanitize: {
72 misc_undefined: ["integer"],
73 },
James Hawkinse78ea772017-03-24 11:43:02 -070074
Colin Crossfc06bd02016-07-11 14:15:31 -070075 },
76 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070077 srcs: [
78 "chrono_utils.cpp",
79 "errors_unix.cpp",
80 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070081 cppflags: ["-Wexit-time-destructors"],
82 },
Dan Willemsenab34b472016-11-29 13:32:55 -080083 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070084 srcs: [
85 "chrono_utils.cpp",
86 "errors_unix.cpp",
87 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080088 cppflags: ["-Wexit-time-destructors"],
89 enabled: true,
90 },
Colin Crossfc06bd02016-07-11 14:15:31 -070091 linux: {
James Hawkinse78ea772017-03-24 11:43:02 -070092 srcs: [
93 "chrono_utils.cpp",
94 "errors_unix.cpp",
95 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070096 cppflags: ["-Wexit-time-destructors"],
James Hawkinse78ea772017-03-24 11:43:02 -070097 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070098 },
99 windows: {
100 srcs: [
101 "errors_windows.cpp",
102 "utf8.cpp",
103 ],
104 enabled: true,
105 },
106 },
107}
108
109// Tests
110// ------------------------------------------------------------------------------
111cc_test {
112 name: "libbase_test",
113 host_supported: true,
114 clang: true,
115 srcs: [
Elliott Hughes1dbd9762017-02-24 14:02:05 -0800116 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700117 "errors_test.cpp",
118 "file_test.cpp",
119 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -0700120 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700121 "parseint_test.cpp",
122 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -0700123 "quick_exit_test.cpp",
Tom Cherryc996a8e2017-04-05 14:15:31 -0700124 "scopeguard_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -0700125 "stringprintf_test.cpp",
126 "strings_test.cpp",
127 "test_main.cpp",
128 ],
129 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700130 android: {
James Hawkinse78ea772017-03-24 11:43:02 -0700131 srcs: [
132 "chrono_utils_test.cpp",
133 "properties_test.cpp"
134 ],
Elliott Hughesec46f4e2017-02-14 15:46:33 -0800135 sanitize: {
136 misc_undefined: ["integer"],
137 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700138 },
James Hawkinse78ea772017-03-24 11:43:02 -0700139 linux: {
140 srcs: ["chrono_utils_test.cpp"],
141 host_ldlibs: ["-lrt"],
142 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700143 windows: {
144 srcs: ["utf8_test.cpp"],
145 enabled: true,
146 },
147 },
148 local_include_dirs: ["."],
149 cppflags: libbase_cppflags,
150 shared_libs: ["libbase"],
151 compile_multilib: "both",
152 multilib: {
153 lib32: {
154 suffix: "32",
155 },
156 lib64: {
157 suffix: "64",
158 },
159 },
160}