blob: 0fd00ea5d3e9866f8937ab0a4c0f45cfc0e31ecf [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,
Justin Yun9ca92452017-07-31 15:41:10 +090043 vndk: {
44 enabled: true,
45 support_system_process: true,
46 },
Colin Crossfc06bd02016-07-11 14:15:31 -070047 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
Colin Cross4eda9822017-04-18 17:42:10 -070057 header_libs: [
58 "libbase_headers",
Colin Cross4eda9822017-04-18 17:42:10 -070059 ],
Steven Moreland3c71bbd2017-04-14 00:54:46 -070060 export_header_lib_headers: ["libbase_headers"],
61
Colin Crossfc06bd02016-07-11 14:15:31 -070062 cppflags: libbase_cppflags,
Colin Crossfc06bd02016-07-11 14:15:31 -070063 shared_libs: ["liblog"],
64 target: {
65 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070066 srcs: [
67 "errors_unix.cpp",
68 "properties.cpp",
Josh Gao0b35b182017-05-01 21:56:28 +000069 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070070 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070071 cppflags: ["-Wexit-time-destructors"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080072 sanitize: {
73 misc_undefined: ["integer"],
74 },
James Hawkinse78ea772017-03-24 11:43:02 -070075
Colin Crossfc06bd02016-07-11 14:15:31 -070076 },
77 darwin: {
James Hawkinse78ea772017-03-24 11:43:02 -070078 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000079 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070080 "errors_unix.cpp",
81 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070082 cppflags: ["-Wexit-time-destructors"],
83 },
Dan Willemsenab34b472016-11-29 13:32:55 -080084 linux_bionic: {
James Hawkinse78ea772017-03-24 11:43:02 -070085 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000086 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070087 "errors_unix.cpp",
88 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080089 cppflags: ["-Wexit-time-destructors"],
90 enabled: true,
91 },
Dan Willemsen48529332017-10-02 10:38:16 -070092 linux_glibc: {
James Hawkinse78ea772017-03-24 11:43:02 -070093 srcs: [
Josh Gao0b35b182017-05-01 21:56:28 +000094 "chrono_utils.cpp",
James Hawkinse78ea772017-03-24 11:43:02 -070095 "errors_unix.cpp",
96 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070097 cppflags: ["-Wexit-time-destructors"],
98 },
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,
Colin Crossfc06bd02016-07-11 14:15:31 -0700114 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 },
Dan Willemsen48529332017-10-02 10:38:16 -0700138 linux_glibc: {
James Hawkinse78ea772017-03-24 11:43:02 -0700139 srcs: ["chrono_utils_test.cpp"],
James Hawkinse78ea772017-03-24 11:43:02 -0700140 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700141 windows: {
142 srcs: ["utf8_test.cpp"],
143 enabled: true,
144 },
145 },
146 local_include_dirs: ["."],
147 cppflags: libbase_cppflags,
148 shared_libs: ["libbase"],
149 compile_multilib: "both",
150 multilib: {
151 lib32: {
152 suffix: "32",
153 },
154 lib64: {
155 suffix: "64",
156 },
157 },
158}