blob: 1ce1365abbdb96abe8b446291d4a5f3b3aaa9448 [file] [log] [blame]
Dan Willemsen00e6a4f2015-09-11 13:07:33 -07001//
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 Albert911760b2021-08-20 13:52:55 -070017// 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 Badoure1204862021-02-12 21:15:54 -080021package {
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
39license {
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 Albertfc8f2682018-12-06 13:57:32 -080053cc_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 Albertfc8f2682018-12-06 13:57:32 -080061 "-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 Albertfc8f2682018-12-06 13:57:32 -080081 },
82}
83
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070084// host + device static lib
85cc_library_static {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070086 name: "libc++_static",
Dan Albertfc8f2682018-12-06 13:57:32 -080087 defaults: ["libc++ defaults"],
Dan Willemsen4cef24e2017-04-07 14:12:18 -070088 vendor_available: true,
Justin Yun8b6fee82020-11-11 16:25:19 +090089 product_available: true,
Yifan Hong5488d3c2020-01-21 16:44:28 -080090 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -070091 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +090092 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +090093 apex_available: [
94 "//apex_available:platform",
95 "//apex_available:anyapex",
96 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +090097 // being part of updatable apexes, this should work on older releases
98 min_sdk_version: "apex_inherit",
dimitrya44472d2019-05-06 12:37:14 +020099 native_bridge_supported: true,
Colin Cross286a75e2015-11-19 14:23:11 -0800100 srcs: [
101 "src/algorithm.cpp",
102 "src/any.cpp",
103 "src/bind.cpp",
Dan Albert91714f92018-12-05 16:06:16 -0800104 "src/charconv.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -0800105 "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 Albertc0ecf332017-01-26 18:48:00 -0800129 "src/variant.cpp",
Dan Albert80bd2e42018-02-07 15:05:22 -0800130 "src/vector.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -0800131 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700132 whole_static_libs: [
133 "libc++abi",
134 ],
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700135 target: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700136 windows: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700137 srcs: [
138 "src/support/win32/*.cpp",
139 ]
140 },
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700141 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700142}
143
144// host + device dynamic lib
145cc_library_shared {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700146 name: "libc++",
Dan Willemsen4cef24e2017-04-07 14:12:18 -0700147 host_supported: true,
148 vendor_available: true,
Justin Yun8b6fee82020-11-11 16:25:19 +0900149 product_available: true,
dimitrya44472d2019-05-06 12:37:14 +0200150 native_bridge_supported: true,
Justin Yun6e22fc82017-07-24 15:19:44 +0900151 vndk: {
152 enabled: true,
153 support_system_process: true,
154 },
Yifan Hong5488d3c2020-01-21 16:44:28 -0800155 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -0700156 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +0900157 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +0900158 apex_available: [
159 "//apex_available:platform",
160 "//apex_available:anyapex",
161 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +0900162 // being part of updatable apexes, this should work on older releases
163 min_sdk_version: "apex_inherit",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700164 whole_static_libs: ["libc++_static"],
165 stl: "none",
166
Yi Kongdf8cb362022-01-06 16:04:07 +0800167 afdo: true,
Yi Kongc74f1b62021-02-23 20:00:37 +0800168
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700169 target: {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700170 darwin: {
Dan Willemsene368a1f2015-12-04 15:50:00 -0800171 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 Willemseneab4a7b2016-11-04 12:26:27 -0700174 ldflags: [
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700175 "-Wl,-undefined,dynamic_lookup",
176 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700177 },
178
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700179 linux_bionic: {
180 enabled: true,
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700181 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700182 },
Hsin-Yi Chenddcf30d2022-05-26 12:27:56 +0800183
184 header_abi_checker: {
185 diff_flags: ["-allow-adding-removing-weak-symbols"],
186 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700187}
188
Dan Albertfc8f2682018-12-06 13:57:32 -0800189cc_library_static {
190 name: "libc++experimental",
191 defaults: ["libc++ defaults"],
192 srcs: [
193 "src/experimental/memory_resource.cpp",
194 ],
195}
196
Dan Alberteda4e912020-04-13 12:08:37 -0700197// Not available to vendor modules until libc++ is updated and this library is
198// merged into libc++ proper.
Elliott Hughesbb48d642021-08-11 11:53:45 -0700199// Follow http://b/175635923 for progress.
Dan Albert4d4d6a82018-12-12 13:45:05 -0800200cc_library_static {
201 name: "libc++fs",
Inseob Kime8660a02021-06-14 11:55:25 +0900202 ramdisk_available: true,
Bowgo Tsai9c713b62019-04-16 16:07:53 +0800203 recovery_available: true,
Jiakai Zhang978cfa22021-11-12 16:53:21 +0000204 apex_available: [
205 "//apex_available:platform",
206 "com.android.art",
207 "com.android.art.debug",
William Escandeb27c7822022-06-16 17:26:10 -0700208 "com.android.bluetooth",
Jiakai Zhang978cfa22021-11-12 16:53:21 +0000209 ],
210 // being part of updatable apexes, this should work on older releases
211 min_sdk_version: "apex_inherit",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800212 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 Collingbourne26cd9b82018-11-30 20:29:22 -0800233// This target is used to extract the build commands for a test executable.
234// See run_tests.py.
235cc_binary {
236 name: "libcxx_test_template",
237 srcs: [
238 "libcxx_test_template.cpp",
239 ],
240 cppflags: [
241 "-fsized-deallocation",
242 "-fexceptions",
Dan Albertfd86c1f2019-02-28 15:11:47 -0800243 "-fcoroutines-ts",
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800244 "-Wno-format-zero-length",
245 "-Wno-implicit-fallthrough",
246 "-Wno-non-virtual-dtor",
247 "-Wno-return-stack-address",
248 "-Wno-unused-local-typedef",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700249
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800250 "-UNDEBUG",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700251
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800252 // 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 Albertfc8f2682018-12-06 13:57:32 -0800256 static_libs: [
257 "libc++experimental",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800258 "libc++fs",
Dan Albertfc8f2682018-12-06 13:57:32 -0800259 ],
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800260 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 Hughes58fffb42018-12-12 09:16:09 -0800274 target: {
275 linux: {
276 ldflags: [
277 // This makes the tests run a little faster.
278 "-Wl,--strip-all",
279 ],
280 },
281 },
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800282 gnu_extensions: false,
283 cpp_std: "c++17",
284}
Dan Albert4d4d6a82018-12-12 13:45:05 -0800285
286python_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 Crossbdf5fe72022-02-25 18:30:07 -0800302
303// Export libc++ headers for inclusion in the musl sysroot.
304genrule {
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}