1// 2// Copyright (C) 2014 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 17package { 18 default_applicable_licenses: ["external_libcxx_license"], 19} 20 21// Added automatically by a large-scale-change that took the approach of 22// 'apply every license found to every target'. While this makes sure we respect 23// every license restriction, it may not be entirely correct. 24// 25// e.g. GPL in an MIT project might only apply to the contrib/ directory. 26// 27// Please consider splitting the single license below into multiple licenses, 28// taking care not to lose any license_kind information, and overriding the 29// default license using the 'licenses: [...]' property on targets as needed. 30// 31// For unused files, consider creating a 'fileGroup' with "//visibility:private" 32// to attach the license to, and including a comment whether the files may be 33// used in the current project. 34// See: http://go/android-license-faq 35license { 36 name: "external_libcxx_license", 37 visibility: [":__subpackages__"], 38 license_kinds: [ 39 "SPDX-license-identifier-Apache-2.0", 40 "SPDX-license-identifier-BSD", 41 "SPDX-license-identifier-MIT", 42 "SPDX-license-identifier-NCSA", 43 ], 44 license_text: [ 45 "LICENSE.TXT", 46 ], 47} 48 49cc_defaults { 50 name: "libc++ defaults", 51 host_supported: true, 52 local_include_dirs: ["include"], 53 export_include_dirs: ["include"], 54 cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"], 55 cppflags: [ 56 "-std=c++14", 57 "-fexceptions", 58 "-DLIBCXX_BUILDING_LIBCXXABI", 59 "-D_LIBCPP_BUILDING_LIBRARY", 60 ], 61 rtti: true, 62 stl: "none", 63 target: { 64 linux_bionic: { 65 enabled: true, 66 }, 67 windows: { 68 enabled: true, 69 cflags: [ 70 "-D_LIBCPP_HAS_THREAD_API_WIN32", 71 "-D_LIBCXXABI_BUILDING_LIBRARY", 72 "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", 73 "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", 74 "-UWIN32_LEAN_AND_MEAN", 75 ], 76 }, 77 }, 78} 79 80// host + device static lib 81cc_library_static { 82 name: "libc++_static", 83 defaults: ["libc++ defaults"], 84 vendor_available: true, 85 product_available: true, 86 ramdisk_available: true, 87 vendor_ramdisk_available: true, 88 recovery_available: true, 89 apex_available: [ 90 "//apex_available:platform", 91 "//apex_available:anyapex", 92 ], 93 // being part of updatable apexes, this should work on older releases 94 min_sdk_version: "apex_inherit", 95 native_bridge_supported: true, 96 srcs: [ 97 "src/algorithm.cpp", 98 "src/any.cpp", 99 "src/bind.cpp", 100 "src/charconv.cpp", 101 "src/chrono.cpp", 102 "src/condition_variable.cpp", 103 "src/debug.cpp", 104 "src/exception.cpp", 105 "src/future.cpp", 106 "src/hash.cpp", 107 "src/ios.cpp", 108 "src/iostream.cpp", 109 "src/locale.cpp", 110 "src/memory.cpp", 111 "src/mutex.cpp", 112 "src/new.cpp", 113 "src/optional.cpp", 114 "src/random.cpp", 115 "src/regex.cpp", 116 "src/shared_mutex.cpp", 117 "src/stdexcept.cpp", 118 "src/string.cpp", 119 "src/strstream.cpp", 120 "src/system_error.cpp", 121 "src/thread.cpp", 122 "src/typeinfo.cpp", 123 "src/utility.cpp", 124 "src/valarray.cpp", 125 "src/variant.cpp", 126 "src/vector.cpp", 127 ], 128 whole_static_libs: [ 129 "libc++abi", 130 ], 131 target: { 132 windows: { 133 srcs: [ 134 "src/support/win32/*.cpp", 135 ] 136 }, 137 }, 138} 139 140// host + device dynamic lib 141cc_library_shared { 142 name: "libc++", 143 host_supported: true, 144 vendor_available: true, 145 product_available: true, 146 native_bridge_supported: true, 147 vndk: { 148 enabled: true, 149 support_system_process: true, 150 }, 151 ramdisk_available: true, 152 vendor_ramdisk_available: true, 153 recovery_available: true, 154 apex_available: [ 155 "//apex_available:platform", 156 "//apex_available:anyapex", 157 ], 158 // being part of updatable apexes, this should work on older releases 159 min_sdk_version: "apex_inherit", 160 whole_static_libs: ["libc++_static"], 161 stl: "none", 162 163 pgo: { 164 sampling: true, 165 }, 166 167 target: { 168 android: { 169 pgo: { 170 profile_file: "libc++/libc++.profdata", 171 }, 172 }, 173 darwin: { 174 unexported_symbols_list: "lib/libc++unexp.exp", 175 force_symbols_not_weak_list: "lib/notweak.exp", 176 force_symbols_weak_list: "lib/weak.exp", 177 ldflags: [ 178 "-Wl,-undefined,dynamic_lookup", 179 ], 180 }, 181 182 linux_bionic: { 183 enabled: true, 184 }, 185 }, 186} 187 188cc_library_static { 189 name: "libc++experimental", 190 defaults: ["libc++ defaults"], 191 srcs: [ 192 "src/experimental/memory_resource.cpp", 193 ], 194} 195 196// Not available to vendor modules until libc++ is updated and this library is 197// merged into libc++ proper. 198// https://issuetracker.google.com/147469372 199cc_library_static { 200 name: "libc++fs", 201 recovery_available: true, 202 defaults: ["libc++ defaults"], 203 srcs: [ 204 "src/filesystem/directory_iterator.cpp", 205 "src/filesystem/operations.cpp", 206 ], 207 multilib: { 208 lib32: { 209 // off_t usage is constrained to within the libc++ source (not the 210 // headers), so we can build the filesystem library with a 64-bit 211 // off_t on LP32 to get large file support without needing all users 212 // of the library to match. 213 cflags: ["-D_FILE_OFFSET_BITS=64"], 214 }, 215 }, 216 target: { 217 windows: { 218 enabled: false, 219 }, 220 }, 221} 222 223// This target is used to extract the build commands for a test executable. 224// See run_tests.py. 225cc_binary { 226 name: "libcxx_test_template", 227 srcs: [ 228 "libcxx_test_template.cpp", 229 ], 230 cppflags: [ 231 "-fsized-deallocation", 232 "-fexceptions", 233 "-fcoroutines-ts", 234 "-Wno-format-zero-length", 235 "-Wno-implicit-fallthrough", 236 "-Wno-non-virtual-dtor", 237 "-Wno-return-stack-address", 238 "-Wno-unused-local-typedef", 239 240 "-UNDEBUG", 241 242 // Optimization is causing relocation for nothrow new to be thrown away. 243 // http://llvm.org/bugs/show_bug.cgi?id=21421 244 "-O0", 245 ], 246 static_libs: [ 247 "libc++experimental", 248 "libc++fs", 249 ], 250 rtti: true, 251 local_include_dirs: [ 252 "test/support", 253 ], 254 multilib: { 255 lib32: { 256 suffix: "32", 257 }, 258 lib64: { 259 suffix: "64", 260 }, 261 }, 262 compile_multilib: "both", 263 host_supported: true, 264 target: { 265 linux: { 266 ldflags: [ 267 // This makes the tests run a little faster. 268 "-Wl,--strip-all", 269 ], 270 }, 271 }, 272 gnu_extensions: false, 273 cpp_std: "c++17", 274} 275 276python_test { 277 name: "filesystem_dynamic_test_helper.py", 278 main: "test/support/filesystem_dynamic_test_helper.py", 279 srcs: [ 280 "test/support/filesystem_dynamic_test_helper.py", 281 ], 282 version: { 283 py2: { 284 enabled: true, 285 embedded_launcher: true, 286 }, 287 py3: { 288 enabled: false, 289 }, 290 }, 291} 292