blob: 515b063f9d5ede620486dce5eac95fe1443756a0 [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 Hawkins26f40c02017-02-06 10:46:54 -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 Hawkins26f40c02017-02-06 10:46:54 -080050 srcs: [
51 "errors_unix.cpp",
52 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070053 cppflags: ["-Wexit-time-destructors"],
54 },
Dan Willemsenab34b472016-11-29 13:32:55 -080055 linux_bionic: {
James Hawkins26f40c02017-02-06 10:46:54 -080056 srcs: [
57 "chrono_utils.cpp",
58 "errors_unix.cpp",
59 ],
Dan Willemsenab34b472016-11-29 13:32:55 -080060 cppflags: ["-Wexit-time-destructors"],
61 enabled: true,
62 },
Colin Crossfc06bd02016-07-11 14:15:31 -070063 linux: {
James Hawkins26f40c02017-02-06 10:46:54 -080064 srcs: [
65 "chrono_utils.cpp",
66 "errors_unix.cpp",
67 ],
Colin Crossfc06bd02016-07-11 14:15:31 -070068 cppflags: ["-Wexit-time-destructors"],
James Hawkins26f40c02017-02-06 10:46:54 -080069 host_ldlibs: ["-lrt"],
Colin Crossfc06bd02016-07-11 14:15:31 -070070 },
71 windows: {
72 srcs: [
73 "errors_windows.cpp",
74 "utf8.cpp",
75 ],
76 enabled: true,
77 },
78 },
79}
80
81// Tests
82// ------------------------------------------------------------------------------
83cc_test {
84 name: "libbase_test",
85 host_supported: true,
86 clang: true,
87 srcs: [
88 "errors_test.cpp",
89 "file_test.cpp",
90 "logging_test.cpp",
Yabin Cui997cba42016-10-05 10:54:35 -070091 "parsedouble_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070092 "parseint_test.cpp",
93 "parsenetaddress_test.cpp",
Josh Gao0c442562016-09-13 14:50:57 -070094 "quick_exit_test.cpp",
Colin Crossfc06bd02016-07-11 14:15:31 -070095 "stringprintf_test.cpp",
96 "strings_test.cpp",
97 "test_main.cpp",
98 ],
99 target: {
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700100 android: {
James Hawkins26f40c02017-02-06 10:46:54 -0800101 srcs: [
102 "chrono_utils_test.cpp",
103 "properties_test.cpp"
104 ],
105 },
106 linux: {
107 srcs: ["chrono_utils_test.cpp"],
108 host_ldlibs: ["-lrt"],
Elliott Hughes1e88c8c2016-09-21 16:53:15 -0700109 },
Colin Crossfc06bd02016-07-11 14:15:31 -0700110 windows: {
111 srcs: ["utf8_test.cpp"],
112 enabled: true,
113 },
114 },
115 local_include_dirs: ["."],
116 cppflags: libbase_cppflags,
117 shared_libs: ["libbase"],
118 compile_multilib: "both",
119 multilib: {
120 lib32: {
121 suffix: "32",
122 },
123 lib64: {
124 suffix: "64",
125 },
126 },
127}