Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 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 | |
Dan Albert | 911760b | 2021-08-20 13:52:55 -0700 | [diff] [blame] | 17 | // NOTE: This project is out of date. See http://b/175635923 for details. Until |
| 18 | // that is resolved it is not possible for us to update or expand access to |
| 19 | // std::filesystem. |
| 20 | |
Bob Badour | e120486 | 2021-02-12 21:15:54 -0800 | [diff] [blame] | 21 | package { |
| 22 | default_applicable_licenses: ["external_libcxx_license"], |
| 23 | } |
| 24 | |
| 25 | // Added automatically by a large-scale-change that took the approach of |
| 26 | // 'apply every license found to every target'. While this makes sure we respect |
| 27 | // every license restriction, it may not be entirely correct. |
| 28 | // |
| 29 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 30 | // |
| 31 | // Please consider splitting the single license below into multiple licenses, |
| 32 | // taking care not to lose any license_kind information, and overriding the |
| 33 | // default license using the 'licenses: [...]' property on targets as needed. |
| 34 | // |
| 35 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 36 | // to attach the license to, and including a comment whether the files may be |
| 37 | // used in the current project. |
| 38 | // See: http://go/android-license-faq |
| 39 | license { |
| 40 | name: "external_libcxx_license", |
| 41 | visibility: [":__subpackages__"], |
| 42 | license_kinds: [ |
| 43 | "SPDX-license-identifier-Apache-2.0", |
| 44 | "SPDX-license-identifier-BSD", |
| 45 | "SPDX-license-identifier-MIT", |
| 46 | "SPDX-license-identifier-NCSA", |
| 47 | ], |
| 48 | license_text: [ |
| 49 | "LICENSE.TXT", |
| 50 | ], |
| 51 | } |
| 52 | |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 53 | cc_defaults { |
| 54 | name: "libc++ defaults", |
| 55 | host_supported: true, |
| 56 | local_include_dirs: ["include"], |
| 57 | export_include_dirs: ["include"], |
| 58 | cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"], |
| 59 | cppflags: [ |
| 60 | "-std=c++14", |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 61 | "-fexceptions", |
| 62 | "-DLIBCXX_BUILDING_LIBCXXABI", |
| 63 | "-D_LIBCPP_BUILDING_LIBRARY", |
| 64 | ], |
| 65 | rtti: true, |
| 66 | stl: "none", |
| 67 | target: { |
| 68 | linux_bionic: { |
| 69 | enabled: true, |
| 70 | }, |
| 71 | windows: { |
| 72 | enabled: true, |
| 73 | cflags: [ |
| 74 | "-D_LIBCPP_HAS_THREAD_API_WIN32", |
| 75 | "-D_LIBCXXABI_BUILDING_LIBRARY", |
| 76 | "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", |
| 77 | "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", |
| 78 | "-UWIN32_LEAN_AND_MEAN", |
| 79 | ], |
| 80 | }, |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 81 | }, |
| 82 | } |
| 83 | |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 84 | // host + device static lib |
| 85 | cc_library_static { |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 86 | name: "libc++_static", |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 87 | defaults: ["libc++ defaults"], |
Dan Willemsen | 4cef24e | 2017-04-07 14:12:18 -0700 | [diff] [blame] | 88 | vendor_available: true, |
Justin Yun | 8b6fee8 | 2020-11-11 16:25:19 +0900 | [diff] [blame] | 89 | product_available: true, |
Yifan Hong | 5488d3c | 2020-01-21 16:44:28 -0800 | [diff] [blame] | 90 | ramdisk_available: true, |
Yifan Hong | 6086566 | 2020-10-21 18:42:18 -0700 | [diff] [blame] | 91 | vendor_ramdisk_available: true, |
Jiyong Park | bfb1424 | 2018-04-27 21:47:53 +0900 | [diff] [blame] | 92 | recovery_available: true, |
Jiyong Park | 2d6d9ab | 2020-03-07 16:40:05 +0900 | [diff] [blame] | 93 | apex_available: [ |
| 94 | "//apex_available:platform", |
| 95 | "//apex_available:anyapex", |
| 96 | ], |
Jooyung Han | f65f67c | 2020-04-16 18:48:28 +0900 | [diff] [blame] | 97 | // being part of updatable apexes, this should work on older releases |
| 98 | min_sdk_version: "apex_inherit", |
dimitry | a44472d | 2019-05-06 12:37:14 +0200 | [diff] [blame] | 99 | native_bridge_supported: true, |
Colin Cross | 286a75e | 2015-11-19 14:23:11 -0800 | [diff] [blame] | 100 | srcs: [ |
| 101 | "src/algorithm.cpp", |
| 102 | "src/any.cpp", |
| 103 | "src/bind.cpp", |
Dan Albert | 91714f9 | 2018-12-05 16:06:16 -0800 | [diff] [blame] | 104 | "src/charconv.cpp", |
Colin Cross | 286a75e | 2015-11-19 14:23:11 -0800 | [diff] [blame] | 105 | "src/chrono.cpp", |
| 106 | "src/condition_variable.cpp", |
| 107 | "src/debug.cpp", |
| 108 | "src/exception.cpp", |
| 109 | "src/future.cpp", |
| 110 | "src/hash.cpp", |
| 111 | "src/ios.cpp", |
| 112 | "src/iostream.cpp", |
| 113 | "src/locale.cpp", |
| 114 | "src/memory.cpp", |
| 115 | "src/mutex.cpp", |
| 116 | "src/new.cpp", |
| 117 | "src/optional.cpp", |
| 118 | "src/random.cpp", |
| 119 | "src/regex.cpp", |
| 120 | "src/shared_mutex.cpp", |
| 121 | "src/stdexcept.cpp", |
| 122 | "src/string.cpp", |
| 123 | "src/strstream.cpp", |
| 124 | "src/system_error.cpp", |
| 125 | "src/thread.cpp", |
| 126 | "src/typeinfo.cpp", |
| 127 | "src/utility.cpp", |
| 128 | "src/valarray.cpp", |
Dan Albert | c0ecf33 | 2017-01-26 18:48:00 -0800 | [diff] [blame] | 129 | "src/variant.cpp", |
Dan Albert | 80bd2e4 | 2018-02-07 15:05:22 -0800 | [diff] [blame] | 130 | "src/vector.cpp", |
Colin Cross | 286a75e | 2015-11-19 14:23:11 -0800 | [diff] [blame] | 131 | ], |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 132 | whole_static_libs: [ |
| 133 | "libc++abi", |
| 134 | ], |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 135 | target: { |
Pirama Arumuga Nainar | 5383d2f | 2018-08-08 10:31:09 -0700 | [diff] [blame] | 136 | windows: { |
Pirama Arumuga Nainar | 5383d2f | 2018-08-08 10:31:09 -0700 | [diff] [blame] | 137 | srcs: [ |
| 138 | "src/support/win32/*.cpp", |
| 139 | ] |
| 140 | }, |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 141 | }, |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | // host + device dynamic lib |
| 145 | cc_library_shared { |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 146 | name: "libc++", |
Dan Willemsen | 4cef24e | 2017-04-07 14:12:18 -0700 | [diff] [blame] | 147 | host_supported: true, |
| 148 | vendor_available: true, |
Justin Yun | 8b6fee8 | 2020-11-11 16:25:19 +0900 | [diff] [blame] | 149 | product_available: true, |
dimitry | a44472d | 2019-05-06 12:37:14 +0200 | [diff] [blame] | 150 | native_bridge_supported: true, |
Justin Yun | 6e22fc8 | 2017-07-24 15:19:44 +0900 | [diff] [blame] | 151 | vndk: { |
| 152 | enabled: true, |
| 153 | support_system_process: true, |
| 154 | }, |
Yifan Hong | 5488d3c | 2020-01-21 16:44:28 -0800 | [diff] [blame] | 155 | ramdisk_available: true, |
Yifan Hong | 6086566 | 2020-10-21 18:42:18 -0700 | [diff] [blame] | 156 | vendor_ramdisk_available: true, |
Jiyong Park | bfb1424 | 2018-04-27 21:47:53 +0900 | [diff] [blame] | 157 | recovery_available: true, |
Jiyong Park | 2d6d9ab | 2020-03-07 16:40:05 +0900 | [diff] [blame] | 158 | apex_available: [ |
| 159 | "//apex_available:platform", |
| 160 | "//apex_available:anyapex", |
| 161 | ], |
Jooyung Han | f65f67c | 2020-04-16 18:48:28 +0900 | [diff] [blame] | 162 | // being part of updatable apexes, this should work on older releases |
| 163 | min_sdk_version: "apex_inherit", |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 164 | whole_static_libs: ["libc++_static"], |
| 165 | stl: "none", |
| 166 | |
Yi Kong | df8cb36 | 2022-01-06 16:04:07 +0800 | [diff] [blame] | 167 | afdo: true, |
Yi Kong | c74f1b6 | 2021-02-23 20:00:37 +0800 | [diff] [blame] | 168 | |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 169 | target: { |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 170 | darwin: { |
Dan Willemsen | e368a1f | 2015-12-04 15:50:00 -0800 | [diff] [blame] | 171 | unexported_symbols_list: "lib/libc++unexp.exp", |
| 172 | force_symbols_not_weak_list: "lib/notweak.exp", |
| 173 | force_symbols_weak_list: "lib/weak.exp", |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 174 | ldflags: [ |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 175 | "-Wl,-undefined,dynamic_lookup", |
| 176 | ], |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 177 | }, |
| 178 | |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 179 | linux_bionic: { |
| 180 | enabled: true, |
Dan Willemsen | eab4a7b | 2016-11-04 12:26:27 -0700 | [diff] [blame] | 181 | }, |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 182 | }, |
Hsin-Yi Chen | ddcf30d | 2022-05-26 12:27:56 +0800 | [diff] [blame] | 183 | |
| 184 | header_abi_checker: { |
| 185 | diff_flags: ["-allow-adding-removing-weak-symbols"], |
| 186 | }, |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 189 | cc_library_static { |
| 190 | name: "libc++experimental", |
| 191 | defaults: ["libc++ defaults"], |
| 192 | srcs: [ |
| 193 | "src/experimental/memory_resource.cpp", |
| 194 | ], |
| 195 | } |
| 196 | |
Dan Albert | eda4e91 | 2020-04-13 12:08:37 -0700 | [diff] [blame] | 197 | // Not available to vendor modules until libc++ is updated and this library is |
| 198 | // merged into libc++ proper. |
Elliott Hughes | bb48d64 | 2021-08-11 11:53:45 -0700 | [diff] [blame] | 199 | // Follow http://b/175635923 for progress. |
Dan Albert | 4d4d6a8 | 2018-12-12 13:45:05 -0800 | [diff] [blame] | 200 | cc_library_static { |
| 201 | name: "libc++fs", |
Inseob Kim | e8660a0 | 2021-06-14 11:55:25 +0900 | [diff] [blame] | 202 | ramdisk_available: true, |
Bowgo Tsai | 9c713b6 | 2019-04-16 16:07:53 +0800 | [diff] [blame] | 203 | recovery_available: true, |
Jiakai Zhang | 978cfa2 | 2021-11-12 16:53:21 +0000 | [diff] [blame] | 204 | apex_available: [ |
| 205 | "//apex_available:platform", |
| 206 | "com.android.art", |
| 207 | "com.android.art.debug", |
William Escande | b27c782 | 2022-06-16 17:26:10 -0700 | [diff] [blame] | 208 | "com.android.bluetooth", |
Jiakai Zhang | 978cfa2 | 2021-11-12 16:53:21 +0000 | [diff] [blame] | 209 | ], |
| 210 | // being part of updatable apexes, this should work on older releases |
| 211 | min_sdk_version: "apex_inherit", |
Dan Albert | 4d4d6a8 | 2018-12-12 13:45:05 -0800 | [diff] [blame] | 212 | defaults: ["libc++ defaults"], |
| 213 | srcs: [ |
| 214 | "src/filesystem/directory_iterator.cpp", |
| 215 | "src/filesystem/operations.cpp", |
| 216 | ], |
| 217 | multilib: { |
| 218 | lib32: { |
| 219 | // off_t usage is constrained to within the libc++ source (not the |
| 220 | // headers), so we can build the filesystem library with a 64-bit |
| 221 | // off_t on LP32 to get large file support without needing all users |
| 222 | // of the library to match. |
| 223 | cflags: ["-D_FILE_OFFSET_BITS=64"], |
| 224 | }, |
| 225 | }, |
| 226 | target: { |
| 227 | windows: { |
| 228 | enabled: false, |
| 229 | }, |
| 230 | }, |
| 231 | } |
| 232 | |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 233 | // This target is used to extract the build commands for a test executable. |
| 234 | // See run_tests.py. |
| 235 | cc_binary { |
| 236 | name: "libcxx_test_template", |
| 237 | srcs: [ |
| 238 | "libcxx_test_template.cpp", |
| 239 | ], |
| 240 | cppflags: [ |
| 241 | "-fsized-deallocation", |
| 242 | "-fexceptions", |
Dan Albert | fd86c1f | 2019-02-28 15:11:47 -0800 | [diff] [blame] | 243 | "-fcoroutines-ts", |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 244 | "-Wno-format-zero-length", |
| 245 | "-Wno-implicit-fallthrough", |
| 246 | "-Wno-non-virtual-dtor", |
| 247 | "-Wno-return-stack-address", |
| 248 | "-Wno-unused-local-typedef", |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 249 | |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 250 | "-UNDEBUG", |
Dan Willemsen | 00e6a4f | 2015-09-11 13:07:33 -0700 | [diff] [blame] | 251 | |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 252 | // Optimization is causing relocation for nothrow new to be thrown away. |
| 253 | // http://llvm.org/bugs/show_bug.cgi?id=21421 |
| 254 | "-O0", |
| 255 | ], |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 256 | static_libs: [ |
| 257 | "libc++experimental", |
Dan Albert | 4d4d6a8 | 2018-12-12 13:45:05 -0800 | [diff] [blame] | 258 | "libc++fs", |
Dan Albert | fc8f268 | 2018-12-06 13:57:32 -0800 | [diff] [blame] | 259 | ], |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 260 | rtti: true, |
| 261 | local_include_dirs: [ |
| 262 | "test/support", |
| 263 | ], |
| 264 | multilib: { |
| 265 | lib32: { |
| 266 | suffix: "32", |
| 267 | }, |
| 268 | lib64: { |
| 269 | suffix: "64", |
| 270 | }, |
| 271 | }, |
| 272 | compile_multilib: "both", |
| 273 | host_supported: true, |
Elliott Hughes | 58fffb4 | 2018-12-12 09:16:09 -0800 | [diff] [blame] | 274 | target: { |
| 275 | linux: { |
| 276 | ldflags: [ |
| 277 | // This makes the tests run a little faster. |
| 278 | "-Wl,--strip-all", |
| 279 | ], |
| 280 | }, |
| 281 | }, |
Peter Collingbourne | 26cd9b8 | 2018-11-30 20:29:22 -0800 | [diff] [blame] | 282 | gnu_extensions: false, |
| 283 | cpp_std: "c++17", |
| 284 | } |
Dan Albert | 4d4d6a8 | 2018-12-12 13:45:05 -0800 | [diff] [blame] | 285 | |
| 286 | python_test { |
| 287 | name: "filesystem_dynamic_test_helper.py", |
| 288 | main: "test/support/filesystem_dynamic_test_helper.py", |
| 289 | srcs: [ |
| 290 | "test/support/filesystem_dynamic_test_helper.py", |
| 291 | ], |
| 292 | version: { |
| 293 | py2: { |
| 294 | enabled: true, |
| 295 | embedded_launcher: true, |
| 296 | }, |
| 297 | py3: { |
| 298 | enabled: false, |
| 299 | }, |
| 300 | }, |
| 301 | } |
Colin Cross | bdf5fe7 | 2022-02-25 18:30:07 -0800 | [diff] [blame] | 302 | |
| 303 | // Export libc++ headers for inclusion in the musl sysroot. |
| 304 | genrule { |
| 305 | name: "libc_musl_sysroot_libc++_headers", |
| 306 | visibility: ["//external/musl"], |
| 307 | srcs: [ |
| 308 | "NOTICE", |
| 309 | "include/**/*", |
| 310 | ], |
| 311 | out: ["libc_musl_sysroot_libc++_headers.zip"], |
| 312 | tools: [ |
| 313 | "soong_zip", |
| 314 | "zip2zip", |
| 315 | ], |
| 316 | cmd: "LIBCXX_DIR=$$(dirname $(location NOTICE)) && " + |
| 317 | "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" + |
| 318 | // NOTICE |
| 319 | " -j -f $(location NOTICE) " + |
| 320 | // headers |
| 321 | " -P include/c++ " + |
| 322 | " -C $${LIBCXX_DIR}/include " + |
| 323 | " -D $${LIBCXX_DIR}/include " + |
| 324 | " && " + |
| 325 | "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(out) " + |
| 326 | " -x include/c++/CMakeLists.txt" + |
| 327 | " -x include/c++/module.modulemap " + |
| 328 | " include/**/*:include " + |
| 329 | " NOTICE:NOTICE.libc++", |
| 330 | } |