Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 1 | // |
| 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 | |
Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 17 | cc_defaults { |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 18 | name: "libbase_cflags_defaults", |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 19 | cflags: [ |
| 20 | "-Wall", |
| 21 | "-Werror", |
| 22 | "-Wextra", |
| 23 | ], |
Paul Crowley | b3236eb | 2019-09-11 15:31:55 -0700 | [diff] [blame] | 24 | target: { |
| 25 | android: { |
| 26 | cflags: [ |
| 27 | "-D_FILE_OFFSET_BITS=64", |
| 28 | ], |
| 29 | }, |
| 30 | }, |
Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 31 | } |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 32 | |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 33 | cc_library_headers { |
| 34 | name: "libbase_headers", |
| 35 | vendor_available: true, |
Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 36 | recovery_available: true, |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 37 | host_supported: true, |
dimitry | a808b11 | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 38 | native_bridge_supported: true, |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 39 | export_include_dirs: ["include"], |
| 40 | |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 41 | target: { |
| 42 | linux_bionic: { |
| 43 | enabled: true, |
| 44 | }, |
| 45 | windows: { |
| 46 | enabled: true, |
| 47 | }, |
| 48 | }, |
| 49 | } |
| 50 | |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 51 | cc_defaults { |
| 52 | name: "libbase_defaults", |
| 53 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 54 | srcs: [ |
Josh Gao | 27241a7 | 2019-04-25 14:04:57 -0700 | [diff] [blame] | 55 | "abi_compatibility.cpp", |
Mark Salyzyn | 0c071c9 | 2018-02-05 07:41:31 -0800 | [diff] [blame] | 56 | "chrono_utils.cpp", |
Josh Gao | 14f9500 | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 57 | "cmsg.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 58 | "file.cpp", |
Tom Cherry | 349b0c4 | 2020-01-08 14:47:42 -0800 | [diff] [blame] | 59 | "liblog_symbols.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 60 | "logging.cpp", |
Elliott Hughes | e8f4b14 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 61 | "mapped_file.cpp", |
Daniel Colascione | 9e3cbb6 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 62 | "parsebool.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 63 | "parsenetaddress.cpp", |
Tom Cherry | 13b1f34 | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 64 | "process.cpp", |
Elliott Hughes | dc80312 | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 65 | "properties.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 66 | "stringprintf.cpp", |
| 67 | "strings.cpp", |
Josh Gao | 5791e21 | 2018-03-16 14:25:42 -0700 | [diff] [blame] | 68 | "threads.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 69 | "test_utils.cpp", |
| 70 | ], |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 71 | |
Tom Cherry | 349b0c4 | 2020-01-08 14:47:42 -0800 | [diff] [blame] | 72 | static: { |
| 73 | cflags: ["-DNO_LIBLOG_DLSYM"], |
| 74 | }, |
| 75 | |
Pirama Arumuga Nainar | ca6ee83 | 2018-09-26 23:31:00 -0700 | [diff] [blame] | 76 | cppflags: ["-Wexit-time-destructors"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 77 | shared_libs: ["liblog"], |
| 78 | target: { |
| 79 | android: { |
Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 80 | sanitize: { |
| 81 | misc_undefined: ["integer"], |
| 82 | }, |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 83 | |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 84 | }, |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 85 | linux: { |
| 86 | srcs: [ |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 87 | "errors_unix.cpp", |
| 88 | ], |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 89 | }, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 90 | darwin: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 91 | srcs: [ |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 92 | "errors_unix.cpp", |
| 93 | ], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 94 | }, |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 95 | linux_bionic: { |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 96 | enabled: true, |
| 97 | }, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 98 | windows: { |
| 99 | srcs: [ |
| 100 | "errors_windows.cpp", |
| 101 | "utf8.cpp", |
| 102 | ], |
Josh Gao | 14f9500 | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 103 | exclude_srcs: [ |
| 104 | "cmsg.cpp", |
| 105 | ], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 106 | enabled: true, |
| 107 | }, |
| 108 | }, |
| 109 | } |
| 110 | |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 111 | cc_library { |
| 112 | name: "libbase", |
| 113 | defaults: ["libbase_defaults"], |
| 114 | vendor_available: true, |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 115 | recovery_available: true, |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 116 | host_supported: true, |
dimitry | a808b11 | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 117 | native_bridge_supported: true, |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 118 | vndk: { |
| 119 | enabled: true, |
| 120 | support_system_process: true, |
| 121 | }, |
| 122 | header_libs: [ |
| 123 | "libbase_headers", |
| 124 | ], |
| 125 | export_header_lib_headers: ["libbase_headers"], |
Jiyong Park | 20524ed | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 126 | static_libs: ["fmtlib"], |
| 127 | whole_static_libs: ["fmtlib"], |
| 128 | export_static_lib_headers: ["fmtlib"], |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | cc_library_static { |
| 132 | name: "libbase_ndk", |
| 133 | defaults: ["libbase_defaults"], |
| 134 | sdk_version: "current", |
| 135 | stl: "c++_static", |
| 136 | export_include_dirs: ["include"], |
Jiyong Park | 20524ed | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 137 | static_libs: ["fmtlib_ndk"], |
| 138 | whole_static_libs: ["fmtlib_ndk"], |
| 139 | export_static_lib_headers: ["fmtlib_ndk"], |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 140 | } |
| 141 | |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 142 | // Tests |
| 143 | // ------------------------------------------------------------------------------ |
| 144 | cc_test { |
| 145 | name: "libbase_test", |
Andreas Gampe | af05f3b | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 146 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 147 | host_supported: true, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 148 | srcs: [ |
Josh Gao | 14f9500 | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 149 | "cmsg_test.cpp", |
Elliott Hughes | 1dbd976 | 2017-02-24 14:02:05 -0800 | [diff] [blame] | 150 | "endian_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 151 | "errors_test.cpp", |
Jiyong Park | 7d89fb1 | 2019-05-15 19:17:48 +0900 | [diff] [blame] | 152 | "expected_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 153 | "file_test.cpp", |
| 154 | "logging_test.cpp", |
Elliott Hughes | 1b86d41 | 2018-04-06 17:45:22 -0700 | [diff] [blame] | 155 | "macros_test.cpp", |
Elliott Hughes | e8f4b14 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 156 | "mapped_file_test.cpp", |
Josh Gao | efc9a63 | 2019-11-14 17:59:57 -0800 | [diff] [blame] | 157 | "no_destructor_test.cpp", |
Yabin Cui | 997cba4 | 2016-10-05 10:54:35 -0700 | [diff] [blame] | 158 | "parsedouble_test.cpp", |
Daniel Colascione | 9e3cbb6 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 159 | "parsebool_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 160 | "parseint_test.cpp", |
| 161 | "parsenetaddress_test.cpp", |
Tom Cherry | 13b1f34 | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 162 | "process_test.cpp", |
Elliott Hughes | dc80312 | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 163 | "properties_test.cpp", |
Jiyong Park | 8fd64c8 | 2019-05-31 03:43:34 +0900 | [diff] [blame] | 164 | "result_test.cpp", |
Tom Cherry | c996a8e | 2017-04-05 14:15:31 -0700 | [diff] [blame] | 165 | "scopeguard_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 166 | "stringprintf_test.cpp", |
| 167 | "strings_test.cpp", |
| 168 | "test_main.cpp", |
Josh Gao | 30171a8 | 2017-04-27 19:48:44 -0700 | [diff] [blame] | 169 | "test_utils_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 170 | ], |
| 171 | target: { |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 172 | android: { |
Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 173 | sanitize: { |
| 174 | misc_undefined: ["integer"], |
| 175 | }, |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 176 | }, |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 177 | linux: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 178 | srcs: ["chrono_utils_test.cpp"], |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 179 | }, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 180 | windows: { |
| 181 | srcs: ["utf8_test.cpp"], |
Dan Willemsen | 528f144 | 2017-11-29 18:06:11 -0800 | [diff] [blame] | 182 | cflags: ["-Wno-unused-parameter"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 183 | enabled: true, |
| 184 | }, |
| 185 | }, |
| 186 | local_include_dirs: ["."], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 187 | shared_libs: ["libbase"], |
| 188 | compile_multilib: "both", |
| 189 | multilib: { |
| 190 | lib32: { |
| 191 | suffix: "32", |
| 192 | }, |
| 193 | lib64: { |
| 194 | suffix: "64", |
| 195 | }, |
| 196 | }, |
Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 197 | test_suites: ["device-tests"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 198 | } |
Tom Cherry | b90dcc0 | 2019-06-14 14:34:54 -0700 | [diff] [blame] | 199 | |
| 200 | cc_benchmark { |
| 201 | name: "libbase_benchmark", |
| 202 | defaults: ["libbase_cflags_defaults"], |
| 203 | |
| 204 | srcs: ["format_benchmark.cpp"], |
| 205 | shared_libs: ["libbase"], |
| 206 | |
| 207 | compile_multilib: "both", |
| 208 | multilib: { |
| 209 | lib32: { |
| 210 | suffix: "32", |
| 211 | }, |
| 212 | lib64: { |
| 213 | suffix: "64", |
| 214 | }, |
| 215 | }, |
| 216 | } |