blob: bbb3d8d0599f15281d0e745c4de7cf00773ea176 [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 Kongc74f1b62021-02-23 20:00:37 +0800167 pgo: {
168 sampling: true,
169 },
170
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700171 target: {
Yi Kongc74f1b62021-02-23 20:00:37 +0800172 android: {
173 pgo: {
174 profile_file: "libc++/libc++.profdata",
175 },
176 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700177 darwin: {
Dan Willemsene368a1f2015-12-04 15:50:00 -0800178 unexported_symbols_list: "lib/libc++unexp.exp",
179 force_symbols_not_weak_list: "lib/notweak.exp",
180 force_symbols_weak_list: "lib/weak.exp",
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700181 ldflags: [
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700182 "-Wl,-undefined,dynamic_lookup",
183 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700184 },
185
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700186 linux_bionic: {
187 enabled: true,
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700188 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700189 },
190}
191
Dan Albertfc8f2682018-12-06 13:57:32 -0800192cc_library_static {
193 name: "libc++experimental",
194 defaults: ["libc++ defaults"],
195 srcs: [
196 "src/experimental/memory_resource.cpp",
197 ],
198}
199
Dan Alberteda4e912020-04-13 12:08:37 -0700200// Not available to vendor modules until libc++ is updated and this library is
201// merged into libc++ proper.
Elliott Hughesbb48d642021-08-11 11:53:45 -0700202// Follow http://b/175635923 for progress.
Dan Albert4d4d6a82018-12-12 13:45:05 -0800203cc_library_static {
204 name: "libc++fs",
Inseob Kime8660a02021-06-14 11:55:25 +0900205 ramdisk_available: true,
Bowgo Tsai9c713b62019-04-16 16:07:53 +0800206 recovery_available: true,
Jiakai Zhang978cfa22021-11-12 16:53:21 +0000207 apex_available: [
208 "//apex_available:platform",
209 "com.android.art",
210 "com.android.art.debug",
211 ],
212 // being part of updatable apexes, this should work on older releases
213 min_sdk_version: "apex_inherit",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800214 defaults: ["libc++ defaults"],
215 srcs: [
216 "src/filesystem/directory_iterator.cpp",
217 "src/filesystem/operations.cpp",
218 ],
219 multilib: {
220 lib32: {
221 // off_t usage is constrained to within the libc++ source (not the
222 // headers), so we can build the filesystem library with a 64-bit
223 // off_t on LP32 to get large file support without needing all users
224 // of the library to match.
225 cflags: ["-D_FILE_OFFSET_BITS=64"],
226 },
227 },
228 target: {
229 windows: {
230 enabled: false,
231 },
232 },
233}
234
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800235// This target is used to extract the build commands for a test executable.
236// See run_tests.py.
237cc_binary {
238 name: "libcxx_test_template",
239 srcs: [
240 "libcxx_test_template.cpp",
241 ],
242 cppflags: [
243 "-fsized-deallocation",
244 "-fexceptions",
Dan Albertfd86c1f2019-02-28 15:11:47 -0800245 "-fcoroutines-ts",
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800246 "-Wno-format-zero-length",
247 "-Wno-implicit-fallthrough",
248 "-Wno-non-virtual-dtor",
249 "-Wno-return-stack-address",
250 "-Wno-unused-local-typedef",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700251
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800252 "-UNDEBUG",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700253
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800254 // Optimization is causing relocation for nothrow new to be thrown away.
255 // http://llvm.org/bugs/show_bug.cgi?id=21421
256 "-O0",
257 ],
Dan Albertfc8f2682018-12-06 13:57:32 -0800258 static_libs: [
259 "libc++experimental",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800260 "libc++fs",
Dan Albertfc8f2682018-12-06 13:57:32 -0800261 ],
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800262 rtti: true,
263 local_include_dirs: [
264 "test/support",
265 ],
266 multilib: {
267 lib32: {
268 suffix: "32",
269 },
270 lib64: {
271 suffix: "64",
272 },
273 },
274 compile_multilib: "both",
275 host_supported: true,
Elliott Hughes58fffb42018-12-12 09:16:09 -0800276 target: {
277 linux: {
278 ldflags: [
279 // This makes the tests run a little faster.
280 "-Wl,--strip-all",
281 ],
282 },
283 },
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800284 gnu_extensions: false,
285 cpp_std: "c++17",
286}
Dan Albert4d4d6a82018-12-12 13:45:05 -0800287
288python_test {
289 name: "filesystem_dynamic_test_helper.py",
290 main: "test/support/filesystem_dynamic_test_helper.py",
291 srcs: [
292 "test/support/filesystem_dynamic_test_helper.py",
293 ],
294 version: {
295 py2: {
296 enabled: true,
297 embedded_launcher: true,
298 },
299 py3: {
300 enabled: false,
301 },
302 },
303}