blob: e29a44c952dfd867c41e90776a3abe8311979046 [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
Bob Badoure1204862021-02-12 21:15:54 -080017package {
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
Dan Albertfc8f2682018-12-06 13:57:32 -080049cc_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",
Dan Albertfc8f2682018-12-06 13:57:32 -080057 "-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 },
Dan Albertfc8f2682018-12-06 13:57:32 -080077 },
78}
79
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070080// host + device static lib
81cc_library_static {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070082 name: "libc++_static",
Dan Albertfc8f2682018-12-06 13:57:32 -080083 defaults: ["libc++ defaults"],
Dan Willemsen4cef24e2017-04-07 14:12:18 -070084 vendor_available: true,
Justin Yun8b6fee82020-11-11 16:25:19 +090085 product_available: true,
Yifan Hong5488d3c2020-01-21 16:44:28 -080086 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -070087 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +090088 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +090089 apex_available: [
90 "//apex_available:platform",
91 "//apex_available:anyapex",
92 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +090093 // being part of updatable apexes, this should work on older releases
94 min_sdk_version: "apex_inherit",
dimitrya44472d2019-05-06 12:37:14 +020095 native_bridge_supported: true,
Colin Cross286a75e2015-11-19 14:23:11 -080096 srcs: [
97 "src/algorithm.cpp",
98 "src/any.cpp",
99 "src/bind.cpp",
Dan Albert91714f92018-12-05 16:06:16 -0800100 "src/charconv.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -0800101 "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",
Dan Albertc0ecf332017-01-26 18:48:00 -0800125 "src/variant.cpp",
Dan Albert80bd2e42018-02-07 15:05:22 -0800126 "src/vector.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -0800127 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700128 whole_static_libs: [
129 "libc++abi",
130 ],
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700131 target: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700132 windows: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700133 srcs: [
134 "src/support/win32/*.cpp",
135 ]
136 },
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700137 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700138}
139
140// host + device dynamic lib
141cc_library_shared {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700142 name: "libc++",
Dan Willemsen4cef24e2017-04-07 14:12:18 -0700143 host_supported: true,
144 vendor_available: true,
Justin Yun8b6fee82020-11-11 16:25:19 +0900145 product_available: true,
dimitrya44472d2019-05-06 12:37:14 +0200146 native_bridge_supported: true,
Justin Yun6e22fc82017-07-24 15:19:44 +0900147 vndk: {
148 enabled: true,
149 support_system_process: true,
150 },
Yifan Hong5488d3c2020-01-21 16:44:28 -0800151 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -0700152 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +0900153 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +0900154 apex_available: [
155 "//apex_available:platform",
156 "//apex_available:anyapex",
157 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +0900158 // being part of updatable apexes, this should work on older releases
159 min_sdk_version: "apex_inherit",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700160 whole_static_libs: ["libc++_static"],
161 stl: "none",
162
Yi Kongc74f1b62021-02-23 20:00:37 +0800163 pgo: {
164 sampling: true,
165 },
166
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700167 target: {
Yi Kongc74f1b62021-02-23 20:00:37 +0800168 android: {
169 pgo: {
170 profile_file: "libc++/libc++.profdata",
171 },
172 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700173 darwin: {
Dan Willemsene368a1f2015-12-04 15:50:00 -0800174 unexported_symbols_list: "lib/libc++unexp.exp",
175 force_symbols_not_weak_list: "lib/notweak.exp",
176 force_symbols_weak_list: "lib/weak.exp",
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700177 ldflags: [
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700178 "-Wl,-undefined,dynamic_lookup",
179 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700180 },
181
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700182 linux_bionic: {
183 enabled: true,
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700184 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700185 },
186}
187
Dan Albertfc8f2682018-12-06 13:57:32 -0800188cc_library_static {
189 name: "libc++experimental",
190 defaults: ["libc++ defaults"],
191 srcs: [
192 "src/experimental/memory_resource.cpp",
193 ],
194}
195
Dan Alberteda4e912020-04-13 12:08:37 -0700196// Not available to vendor modules until libc++ is updated and this library is
197// merged into libc++ proper.
Elliott Hughesbb48d642021-08-11 11:53:45 -0700198// Follow http://b/175635923 for progress.
Dan Albert4d4d6a82018-12-12 13:45:05 -0800199cc_library_static {
200 name: "libc++fs",
Inseob Kime8660a02021-06-14 11:55:25 +0900201 ramdisk_available: true,
Bowgo Tsai9c713b62019-04-16 16:07:53 +0800202 recovery_available: true,
Dan Albert4d4d6a82018-12-12 13:45:05 -0800203 defaults: ["libc++ defaults"],
204 srcs: [
205 "src/filesystem/directory_iterator.cpp",
206 "src/filesystem/operations.cpp",
207 ],
208 multilib: {
209 lib32: {
210 // off_t usage is constrained to within the libc++ source (not the
211 // headers), so we can build the filesystem library with a 64-bit
212 // off_t on LP32 to get large file support without needing all users
213 // of the library to match.
214 cflags: ["-D_FILE_OFFSET_BITS=64"],
215 },
216 },
217 target: {
218 windows: {
219 enabled: false,
220 },
221 },
222}
223
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800224// This target is used to extract the build commands for a test executable.
225// See run_tests.py.
226cc_binary {
227 name: "libcxx_test_template",
228 srcs: [
229 "libcxx_test_template.cpp",
230 ],
231 cppflags: [
232 "-fsized-deallocation",
233 "-fexceptions",
Dan Albertfd86c1f2019-02-28 15:11:47 -0800234 "-fcoroutines-ts",
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800235 "-Wno-format-zero-length",
236 "-Wno-implicit-fallthrough",
237 "-Wno-non-virtual-dtor",
238 "-Wno-return-stack-address",
239 "-Wno-unused-local-typedef",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700240
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800241 "-UNDEBUG",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700242
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800243 // Optimization is causing relocation for nothrow new to be thrown away.
244 // http://llvm.org/bugs/show_bug.cgi?id=21421
245 "-O0",
246 ],
Dan Albertfc8f2682018-12-06 13:57:32 -0800247 static_libs: [
248 "libc++experimental",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800249 "libc++fs",
Dan Albertfc8f2682018-12-06 13:57:32 -0800250 ],
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800251 rtti: true,
252 local_include_dirs: [
253 "test/support",
254 ],
255 multilib: {
256 lib32: {
257 suffix: "32",
258 },
259 lib64: {
260 suffix: "64",
261 },
262 },
263 compile_multilib: "both",
264 host_supported: true,
Elliott Hughes58fffb42018-12-12 09:16:09 -0800265 target: {
266 linux: {
267 ldflags: [
268 // This makes the tests run a little faster.
269 "-Wl,--strip-all",
270 ],
271 },
272 },
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800273 gnu_extensions: false,
274 cpp_std: "c++17",
275}
Dan Albert4d4d6a82018-12-12 13:45:05 -0800276
277python_test {
278 name: "filesystem_dynamic_test_helper.py",
279 main: "test/support/filesystem_dynamic_test_helper.py",
280 srcs: [
281 "test/support/filesystem_dynamic_test_helper.py",
282 ],
283 version: {
284 py2: {
285 enabled: true,
286 embedded_launcher: true,
287 },
288 py3: {
289 enabled: false,
290 },
291 },
292}