blob: 7f81915ff46b2d45403a4b986ddb2eacb7201c39 [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",
James Hawkins7c92e482017-02-13 15:47:21 -080045 "chrono_utils.cpp",
Elliott Hughes1e88c8c2016-09-21 16:53:15 -070046 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070047 cppflags: ["-Wexit-time-destructors"],
48 },
49 darwin: {
James Hawkins7c92e482017-02-13 15:47:21 -080050 srcs: [
51 "chrono_utils.cpp",
52 "errors_unix.cpp",
53 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070054 cppflags: ["-Wexit-time-destructors"],
55 },
Dan Willemsenab34b472016-11-29 13:32:55 -080056 linux_bionic: {
James Hawkins7c92e482017-02-13 15:47:21 -080057 srcs: [
58 "chrono_utils.cpp",
59 "errors_unix.cpp",
60 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080061 cppflags: ["-Wexit-time-destructors"],
62 enabled: true,
63 },
Colin Crossfc06bd02016-07-11 14:15:31 -070064 linux: {
James Hawkins7c92e482017-02-13 15:47:21 -080065 srcs: [
66 "chrono_utils.cpp",
67 "errors_unix.cpp",
68 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070069 cppflags: ["-Wexit-time-destructors"],
James Hawkins7c92e482017-02-13 15:47:21 -080070 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070071 },
72 windows: {
73 srcs: [
74 "errors_windows.cpp",
75 "utf8.cpp",
76 ],
77 enabled: true,
78 },
79 },
80}
81
82// Tests
83// ------------------------------------------------------------------------------
84cc_test {
85 name: "libbase_test",
86 host_supported: true,
87 clang: true,
88 srcs: [
89 "errors_test.cpp",
90 "file_test.cpp",
91 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -070092 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070093 "parseint_test.cpp",
94 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070095 "quick_exit_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070096 "stringprintf_test.cpp",
97 "strings_test.cpp",
98 "test_main.cpp",
99 ],
100 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700101 android: {
James Hawkins7c92e482017-02-13 15:47:21 -0800102 srcs: [
103 "chrono_utils_test.cpp",
104 "properties_test.cpp"
105 ],
106 },
107 linux: {
108 srcs: ["chrono_utils_test.cpp"],
109 host_ldlibs: ["-lrt"],
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700110 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700111 windows: {
112 srcs: ["utf8_test.cpp"],
113 enabled: true,
114 },
115 },
116 local_include_dirs: ["."],
117 cppflags: libbase_cppflags,
118 shared_libs: ["libbase"],
119 compile_multilib: "both",
120 multilib: {
121 lib32: {
122 suffix: "32",
123 },
124 lib64: {
125 suffix: "64",
126 },
127 },
128}