blob: 7b1dc8e3632ef5b92828a9f2f73b3cac978ba5b6 [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
23cc_library {
24 name: "libbase",
25 clang: true,
26 host_supported: true,
27 srcs: [
28 "file.cpp",
29 "logging.cpp",
30 "parsenetaddress.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070031 "quick_exit.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070032 "stringprintf.cpp",
33 "strings.cpp",
34 "test_utils.cpp",
35 ],
36 local_include_dirs: ["include"],
37 cppflags: libbase_cppflags,
38 export_include_dirs: ["include"],
39 shared_libs: ["liblog"],
40 target: {
41 android: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070042 srcs: [
43 "errors_unix.cpp",
44 "properties.cpp",
45 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070046 cppflags: ["-Wexit-time-destructors"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080047 sanitize: {
48 misc_undefined: ["integer"],
49 },
Colin Crossfc06bd02016-07-11 14:15:31 -070050 },
51 darwin: {
James Hawkinsc8ac0672017-02-14 19:20:20 +000052 srcs: ["errors_unix.cpp"],
Colin Crossfc06bd02016-07-11 14:15:31 -070053 cppflags: ["-Wexit-time-destructors"],
54 },
Dan Willemsenab34b472016-11-29 13:32:55 -080055 linux_bionic: {
James Hawkinsc8ac0672017-02-14 19:20:20 +000056 srcs: ["errors_unix.cpp"],
Dan Willemsenab34b472016-11-29 13:32:55 -080057 cppflags: ["-Wexit-time-destructors"],
58 enabled: true,
59 },
Colin Crossfc06bd02016-07-11 14:15:31 -070060 linux: {
James Hawkinsc8ac0672017-02-14 19:20:20 +000061 srcs: ["errors_unix.cpp"],
Colin Crossfc06bd02016-07-11 14:15:31 -070062 cppflags: ["-Wexit-time-destructors"],
63 },
64 windows: {
65 srcs: [
66 "errors_windows.cpp",
67 "utf8.cpp",
68 ],
69 enabled: true,
70 },
71 },
72}
73
74// Tests
75// ------------------------------------------------------------------------------
76cc_test {
77 name: "libbase_test",
78 host_supported: true,
79 clang: true,
80 srcs: [
Elliott Hughes1dbd9762017-02-24 14:02:05 -080081 "endian_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070082 "errors_test.cpp",
83 "file_test.cpp",
84 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -070085 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070086 "parseint_test.cpp",
87 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070088 "quick_exit_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070089 "stringprintf_test.cpp",
90 "strings_test.cpp",
91 "test_main.cpp",
92 ],
93 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070094 android: {
James Hawkinsc8ac0672017-02-14 19:20:20 +000095 srcs: ["properties_test.cpp"],
Elliott Hughesec46f4e2017-02-14 15:46:33 -080096 sanitize: {
97 misc_undefined: ["integer"],
98 },
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070099 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700100 windows: {
101 srcs: ["utf8_test.cpp"],
102 enabled: true,
103 },
104 },
105 local_include_dirs: ["."],
106 cppflags: libbase_cppflags,
107 shared_libs: ["libbase"],
108 compile_multilib: "both",
109 multilib: {
110 lib32: {
111 suffix: "32",
112 },
113 lib64: {
114 suffix: "64",
115 },
116 },
117}