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 17cc_defaults { 18 name: "libbase_cflags_defaults", 19 cflags: [ 20 "-Wall", 21 "-Werror", 22 "-Wextra", 23 ], 24 target: { 25 android: { 26 cflags: [ 27 "-D_FILE_OFFSET_BITS=64", 28 ], 29 }, 30 }, 31} 32 33cc_library_headers { 34 name: "libbase_headers", 35 vendor_available: true, 36 ramdisk_available: true, 37 recovery_available: true, 38 host_supported: true, 39 native_bridge_supported: true, 40 export_include_dirs: ["include"], 41 42 target: { 43 linux_bionic: { 44 enabled: true, 45 }, 46 windows: { 47 enabled: true, 48 }, 49 }, 50 apex_available: [ 51 "//apex_available:anyapex", 52 "//apex_available:platform", 53 ], 54 min_sdk_version: "29", 55} 56 57cc_defaults { 58 name: "libbase_defaults", 59 defaults: ["libbase_cflags_defaults"], 60 srcs: [ 61 "abi_compatibility.cpp", 62 "chrono_utils.cpp", 63 "cmsg.cpp", 64 "file.cpp", 65 "liblog_symbols.cpp", 66 "logging.cpp", 67 "mapped_file.cpp", 68 "parsebool.cpp", 69 "parsenetaddress.cpp", 70 "process.cpp", 71 "properties.cpp", 72 "stringprintf.cpp", 73 "strings.cpp", 74 "threads.cpp", 75 "test_utils.cpp", 76 ], 77 78 cppflags: ["-Wexit-time-destructors"], 79 shared_libs: ["liblog"], 80 target: { 81 android: { 82 sanitize: { 83 misc_undefined: ["integer"], 84 }, 85 86 }, 87 linux: { 88 srcs: [ 89 "errors_unix.cpp", 90 ], 91 }, 92 darwin: { 93 srcs: [ 94 "errors_unix.cpp", 95 ], 96 }, 97 linux_bionic: { 98 enabled: true, 99 }, 100 windows: { 101 srcs: [ 102 "errors_windows.cpp", 103 "utf8.cpp", 104 ], 105 exclude_srcs: [ 106 "cmsg.cpp", 107 ], 108 enabled: true, 109 }, 110 }, 111} 112 113cc_library { 114 name: "libbase", 115 defaults: ["libbase_defaults"], 116 vendor_available: true, 117 ramdisk_available: true, 118 recovery_available: true, 119 host_supported: true, 120 native_bridge_supported: true, 121 vndk: { 122 enabled: true, 123 support_system_process: true, 124 }, 125 header_libs: [ 126 "libbase_headers", 127 ], 128 export_header_lib_headers: ["libbase_headers"], 129 static_libs: ["fmtlib"], 130 whole_static_libs: ["fmtlib"], 131 export_static_lib_headers: ["fmtlib"], 132 apex_available: [ 133 "//apex_available:anyapex", 134 "//apex_available:platform", 135 ], 136 min_sdk_version: "29", 137} 138 139cc_library_static { 140 name: "libbase_ndk", 141 defaults: ["libbase_defaults"], 142 sdk_version: "current", 143 stl: "c++_static", 144 export_include_dirs: ["include"], 145 static_libs: ["fmtlib_ndk"], 146 whole_static_libs: ["fmtlib_ndk"], 147 export_static_lib_headers: ["fmtlib_ndk"], 148} 149 150// Tests 151// ------------------------------------------------------------------------------ 152cc_test { 153 name: "libbase_test", 154 defaults: ["libbase_cflags_defaults"], 155 host_supported: true, 156 srcs: [ 157 "cmsg_test.cpp", 158 "endian_test.cpp", 159 "errors_test.cpp", 160 "expected_test.cpp", 161 "file_test.cpp", 162 "logging_splitters_test.cpp", 163 "logging_test.cpp", 164 "macros_test.cpp", 165 "mapped_file_test.cpp", 166 "no_destructor_test.cpp", 167 "parsedouble_test.cpp", 168 "parsebool_test.cpp", 169 "parseint_test.cpp", 170 "parsenetaddress_test.cpp", 171 "process_test.cpp", 172 "properties_test.cpp", 173 "result_test.cpp", 174 "scopeguard_test.cpp", 175 "stringprintf_test.cpp", 176 "strings_test.cpp", 177 "test_main.cpp", 178 "test_utils_test.cpp", 179 ], 180 target: { 181 android: { 182 sanitize: { 183 misc_undefined: ["integer"], 184 }, 185 }, 186 linux: { 187 srcs: ["chrono_utils_test.cpp"], 188 }, 189 windows: { 190 srcs: ["utf8_test.cpp"], 191 cflags: ["-Wno-unused-parameter"], 192 enabled: true, 193 }, 194 }, 195 local_include_dirs: ["."], 196 shared_libs: ["libbase"], 197 compile_multilib: "both", 198 multilib: { 199 lib32: { 200 suffix: "32", 201 }, 202 lib64: { 203 suffix: "64", 204 }, 205 }, 206 test_suites: ["device-tests"], 207} 208 209cc_benchmark { 210 name: "libbase_benchmark", 211 defaults: ["libbase_cflags_defaults"], 212 213 srcs: ["format_benchmark.cpp"], 214 shared_libs: ["libbase"], 215 216 compile_multilib: "both", 217 multilib: { 218 lib32: { 219 suffix: "32", 220 }, 221 lib64: { 222 suffix: "64", 223 }, 224 }, 225} 226