Colin Cross | caaeb28 | 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 | 6f36fb0 | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 17 | cc_defaults { |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 18 | name: "libbase_cflags_defaults", |
Elliott Hughes | a72e3f6 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 19 | cflags: [ |
| 20 | "-Wall", |
| 21 | "-Werror", |
| 22 | "-Wextra", |
| 23 | ], |
Paul Crowley | d47a8d7 | 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 | 6f36fb0 | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 31 | } |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 32 | |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 33 | cc_library_headers { |
| 34 | name: "libbase_headers", |
| 35 | vendor_available: true, |
Yifan Hong | 5afe8b7 | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 36 | ramdisk_available: true, |
Jiyong Park | b51bddd | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 37 | recovery_available: true, |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 38 | host_supported: true, |
dimitry | 3b9b11e | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 39 | native_bridge_supported: true, |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 40 | export_include_dirs: ["include"], |
| 41 | |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 42 | target: { |
| 43 | linux_bionic: { |
| 44 | enabled: true, |
| 45 | }, |
| 46 | windows: { |
| 47 | enabled: true, |
| 48 | }, |
| 49 | }, |
| 50 | } |
| 51 | |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 52 | cc_defaults { |
| 53 | name: "libbase_defaults", |
| 54 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 55 | srcs: [ |
Josh Gao | e440199 | 2019-04-25 14:04:57 -0700 | [diff] [blame] | 56 | "abi_compatibility.cpp", |
Mark Salyzyn | 764a9c7 | 2018-02-05 07:41:31 -0800 | [diff] [blame] | 57 | "chrono_utils.cpp", |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 58 | "cmsg.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 59 | "file.cpp", |
Tom Cherry | 1bfa8ab | 2020-01-08 14:47:42 -0800 | [diff] [blame] | 60 | "liblog_symbols.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 61 | "logging.cpp", |
Elliott Hughes | 5114008 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 62 | "mapped_file.cpp", |
Daniel Colascione | 57fceb9 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 63 | "parsebool.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 64 | "parsenetaddress.cpp", |
Tom Cherry | 3f82dfb | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 65 | "process.cpp", |
Elliott Hughes | 083c2fe | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 66 | "properties.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 67 | "stringprintf.cpp", |
| 68 | "strings.cpp", |
Josh Gao | ef102be | 2018-03-16 14:25:42 -0700 | [diff] [blame] | 69 | "threads.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 70 | "test_utils.cpp", |
| 71 | ], |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 72 | |
Tom Cherry | 1bfa8ab | 2020-01-08 14:47:42 -0800 | [diff] [blame] | 73 | static: { |
| 74 | cflags: ["-DNO_LIBLOG_DLSYM"], |
| 75 | }, |
| 76 | |
Pirama Arumuga Nainar | 00b10a8 | 2018-09-26 23:31:00 -0700 | [diff] [blame] | 77 | cppflags: ["-Wexit-time-destructors"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 78 | shared_libs: ["liblog"], |
| 79 | target: { |
| 80 | android: { |
Elliott Hughes | 83b0097 | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 81 | sanitize: { |
| 82 | misc_undefined: ["integer"], |
| 83 | }, |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 84 | |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 85 | }, |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 86 | linux: { |
| 87 | srcs: [ |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 88 | "errors_unix.cpp", |
| 89 | ], |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 90 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 91 | darwin: { |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 92 | srcs: [ |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 93 | "errors_unix.cpp", |
| 94 | ], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 95 | }, |
Dan Willemsen | 15acb59 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 96 | linux_bionic: { |
Dan Willemsen | 15acb59 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 97 | enabled: true, |
| 98 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 99 | windows: { |
| 100 | srcs: [ |
| 101 | "errors_windows.cpp", |
| 102 | "utf8.cpp", |
| 103 | ], |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 104 | exclude_srcs: [ |
| 105 | "cmsg.cpp", |
| 106 | ], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 107 | enabled: true, |
| 108 | }, |
| 109 | }, |
| 110 | } |
| 111 | |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 112 | cc_library { |
| 113 | name: "libbase", |
| 114 | defaults: ["libbase_defaults"], |
| 115 | vendor_available: true, |
Yifan Hong | 5afe8b7 | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 116 | ramdisk_available: true, |
Jiyong Park | 9670f16 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 117 | recovery_available: true, |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 118 | host_supported: true, |
dimitry | 3b9b11e | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 119 | native_bridge_supported: true, |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 120 | vndk: { |
| 121 | enabled: true, |
| 122 | support_system_process: true, |
| 123 | }, |
| 124 | header_libs: [ |
| 125 | "libbase_headers", |
| 126 | ], |
| 127 | export_header_lib_headers: ["libbase_headers"], |
Jiyong Park | 4e223e6 | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 128 | static_libs: ["fmtlib"], |
| 129 | whole_static_libs: ["fmtlib"], |
| 130 | export_static_lib_headers: ["fmtlib"], |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | cc_library_static { |
| 134 | name: "libbase_ndk", |
| 135 | defaults: ["libbase_defaults"], |
| 136 | sdk_version: "current", |
| 137 | stl: "c++_static", |
| 138 | export_include_dirs: ["include"], |
Jiyong Park | 4e223e6 | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 139 | static_libs: ["fmtlib_ndk"], |
| 140 | whole_static_libs: ["fmtlib_ndk"], |
| 141 | export_static_lib_headers: ["fmtlib_ndk"], |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 142 | } |
| 143 | |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 144 | // Tests |
| 145 | // ------------------------------------------------------------------------------ |
| 146 | cc_test { |
| 147 | name: "libbase_test", |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 148 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 149 | host_supported: true, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 150 | srcs: [ |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 151 | "cmsg_test.cpp", |
Elliott Hughes | 08baa86 | 2017-02-24 14:02:05 -0800 | [diff] [blame] | 152 | "endian_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 153 | "errors_test.cpp", |
Jiyong Park | de84d4a | 2019-05-15 19:17:48 +0900 | [diff] [blame] | 154 | "expected_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 155 | "file_test.cpp", |
| 156 | "logging_test.cpp", |
Elliott Hughes | da37d81 | 2018-04-06 17:45:22 -0700 | [diff] [blame] | 157 | "macros_test.cpp", |
Elliott Hughes | 5114008 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 158 | "mapped_file_test.cpp", |
Josh Gao | 916ea5e | 2019-11-14 17:59:57 -0800 | [diff] [blame] | 159 | "no_destructor_test.cpp", |
Yabin Cui | ebe8eef | 2016-10-05 10:54:35 -0700 | [diff] [blame] | 160 | "parsedouble_test.cpp", |
Daniel Colascione | 57fceb9 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 161 | "parsebool_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 162 | "parseint_test.cpp", |
| 163 | "parsenetaddress_test.cpp", |
Tom Cherry | 3f82dfb | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 164 | "process_test.cpp", |
Elliott Hughes | 083c2fe | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 165 | "properties_test.cpp", |
Jiyong Park | ab7dc5a | 2019-05-31 03:43:34 +0900 | [diff] [blame] | 166 | "result_test.cpp", |
Tom Cherry | 1d27306 | 2017-04-05 14:15:31 -0700 | [diff] [blame] | 167 | "scopeguard_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 168 | "stringprintf_test.cpp", |
| 169 | "strings_test.cpp", |
| 170 | "test_main.cpp", |
Josh Gao | 8f1fa00 | 2017-04-27 19:48:44 -0700 | [diff] [blame] | 171 | "test_utils_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 172 | ], |
| 173 | target: { |
Elliott Hughes | 5a7788c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 174 | android: { |
Elliott Hughes | 83b0097 | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 175 | sanitize: { |
| 176 | misc_undefined: ["integer"], |
| 177 | }, |
Elliott Hughes | 5a7788c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 178 | }, |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 179 | linux: { |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 180 | srcs: ["chrono_utils_test.cpp"], |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 181 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 182 | windows: { |
| 183 | srcs: ["utf8_test.cpp"], |
Dan Willemsen | b80b3d5 | 2017-11-29 18:06:11 -0800 | [diff] [blame] | 184 | cflags: ["-Wno-unused-parameter"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 185 | enabled: true, |
| 186 | }, |
| 187 | }, |
| 188 | local_include_dirs: ["."], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 189 | shared_libs: ["libbase"], |
| 190 | compile_multilib: "both", |
| 191 | multilib: { |
| 192 | lib32: { |
| 193 | suffix: "32", |
| 194 | }, |
| 195 | lib64: { |
| 196 | suffix: "64", |
| 197 | }, |
| 198 | }, |
Elliott Hughes | efdeefd | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 199 | test_suites: ["device-tests"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 200 | } |
Tom Cherry | 377d1ad | 2019-06-14 14:34:54 -0700 | [diff] [blame] | 201 | |
| 202 | cc_benchmark { |
| 203 | name: "libbase_benchmark", |
| 204 | defaults: ["libbase_cflags_defaults"], |
| 205 | |
| 206 | srcs: ["format_benchmark.cpp"], |
| 207 | shared_libs: ["libbase"], |
| 208 | |
| 209 | compile_multilib: "both", |
| 210 | multilib: { |
| 211 | lib32: { |
| 212 | suffix: "32", |
| 213 | }, |
| 214 | lib64: { |
| 215 | suffix: "64", |
| 216 | }, |
| 217 | }, |
| 218 | } |