blob: bd109a21acc3555bc31e569feb9a981df3d06424 [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 Albertfc8f2682018-12-06 13:57:32 -080017cc_defaults {
18 name: "libc++ defaults",
19 host_supported: true,
20 local_include_dirs: ["include"],
21 export_include_dirs: ["include"],
22 cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
23 cppflags: [
24 "-std=c++14",
Dan Albertfc8f2682018-12-06 13:57:32 -080025 "-fexceptions",
26 "-DLIBCXX_BUILDING_LIBCXXABI",
27 "-D_LIBCPP_BUILDING_LIBRARY",
28 ],
29 rtti: true,
30 stl: "none",
31 target: {
32 linux_bionic: {
33 enabled: true,
34 },
35 windows: {
36 enabled: true,
37 cflags: [
38 "-D_LIBCPP_HAS_THREAD_API_WIN32",
39 "-D_LIBCXXABI_BUILDING_LIBRARY",
40 "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
41 "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
42 "-UWIN32_LEAN_AND_MEAN",
43 ],
44 },
45 windows_x86: {
46 cflags: [
47 "-fsjlj-exceptions",
48 ],
49 },
50 },
51}
52
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070053// host + device static lib
54cc_library_static {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070055 name: "libc++_static",
Dan Albertfc8f2682018-12-06 13:57:32 -080056 defaults: ["libc++ defaults"],
Dan Willemsen4cef24e2017-04-07 14:12:18 -070057 vendor_available: true,
Yifan Hong5488d3c2020-01-21 16:44:28 -080058 ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +090059 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +090060 apex_available: [
61 "//apex_available:platform",
62 "//apex_available:anyapex",
63 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +090064 // being part of updatable apexes, this should work on older releases
65 min_sdk_version: "apex_inherit",
dimitrya44472d2019-05-06 12:37:14 +020066 native_bridge_supported: true,
Colin Cross286a75e2015-11-19 14:23:11 -080067 srcs: [
68 "src/algorithm.cpp",
69 "src/any.cpp",
70 "src/bind.cpp",
Dan Albert91714f92018-12-05 16:06:16 -080071 "src/charconv.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -080072 "src/chrono.cpp",
73 "src/condition_variable.cpp",
74 "src/debug.cpp",
75 "src/exception.cpp",
76 "src/future.cpp",
77 "src/hash.cpp",
78 "src/ios.cpp",
79 "src/iostream.cpp",
80 "src/locale.cpp",
81 "src/memory.cpp",
82 "src/mutex.cpp",
83 "src/new.cpp",
84 "src/optional.cpp",
85 "src/random.cpp",
86 "src/regex.cpp",
87 "src/shared_mutex.cpp",
88 "src/stdexcept.cpp",
89 "src/string.cpp",
90 "src/strstream.cpp",
91 "src/system_error.cpp",
92 "src/thread.cpp",
93 "src/typeinfo.cpp",
94 "src/utility.cpp",
95 "src/valarray.cpp",
Dan Albertc0ecf332017-01-26 18:48:00 -080096 "src/variant.cpp",
Dan Albert80bd2e42018-02-07 15:05:22 -080097 "src/vector.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -080098 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070099 whole_static_libs: [
100 "libc++abi",
101 ],
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700102 target: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700103 windows: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700104 srcs: [
105 "src/support/win32/*.cpp",
106 ]
107 },
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700108 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700109}
110
111// host + device dynamic lib
112cc_library_shared {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700113 name: "libc++",
Dan Willemsen4cef24e2017-04-07 14:12:18 -0700114 host_supported: true,
115 vendor_available: true,
dimitrya44472d2019-05-06 12:37:14 +0200116 native_bridge_supported: true,
Justin Yun6e22fc82017-07-24 15:19:44 +0900117 vndk: {
118 enabled: true,
119 support_system_process: true,
120 },
Yifan Hong5488d3c2020-01-21 16:44:28 -0800121 ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +0900122 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +0900123 apex_available: [
124 "//apex_available:platform",
125 "//apex_available:anyapex",
126 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +0900127 // being part of updatable apexes, this should work on older releases
128 min_sdk_version: "apex_inherit",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700129 whole_static_libs: ["libc++_static"],
130 stl: "none",
131
132 target: {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700133 darwin: {
Dan Willemsene368a1f2015-12-04 15:50:00 -0800134 unexported_symbols_list: "lib/libc++unexp.exp",
135 force_symbols_not_weak_list: "lib/notweak.exp",
136 force_symbols_weak_list: "lib/weak.exp",
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700137 ldflags: [
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700138 "-Wl,-undefined,dynamic_lookup",
139 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700140 },
141
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700142 linux_bionic: {
143 enabled: true,
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700144 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700145 },
146}
147
Dan Albertfc8f2682018-12-06 13:57:32 -0800148cc_library_static {
149 name: "libc++experimental",
150 defaults: ["libc++ defaults"],
151 srcs: [
152 "src/experimental/memory_resource.cpp",
153 ],
154}
155
Dan Alberteda4e912020-04-13 12:08:37 -0700156// Not available to vendor modules until libc++ is updated and this library is
157// merged into libc++ proper.
158// https://issuetracker.google.com/147469372
Dan Albert4d4d6a82018-12-12 13:45:05 -0800159cc_library_static {
160 name: "libc++fs",
Bowgo Tsai9c713b62019-04-16 16:07:53 +0800161 recovery_available: true,
Dan Albert4d4d6a82018-12-12 13:45:05 -0800162 defaults: ["libc++ defaults"],
163 srcs: [
164 "src/filesystem/directory_iterator.cpp",
165 "src/filesystem/operations.cpp",
166 ],
167 multilib: {
168 lib32: {
169 // off_t usage is constrained to within the libc++ source (not the
170 // headers), so we can build the filesystem library with a 64-bit
171 // off_t on LP32 to get large file support without needing all users
172 // of the library to match.
173 cflags: ["-D_FILE_OFFSET_BITS=64"],
174 },
175 },
176 target: {
177 windows: {
178 enabled: false,
179 },
180 },
181}
182
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800183// This target is used to extract the build commands for a test executable.
184// See run_tests.py.
185cc_binary {
186 name: "libcxx_test_template",
187 srcs: [
188 "libcxx_test_template.cpp",
189 ],
190 cppflags: [
191 "-fsized-deallocation",
192 "-fexceptions",
Dan Albertfd86c1f2019-02-28 15:11:47 -0800193 "-fcoroutines-ts",
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800194 "-Wno-format-zero-length",
195 "-Wno-implicit-fallthrough",
196 "-Wno-non-virtual-dtor",
197 "-Wno-return-stack-address",
198 "-Wno-unused-local-typedef",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700199
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800200 "-UNDEBUG",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700201
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800202 // Optimization is causing relocation for nothrow new to be thrown away.
203 // http://llvm.org/bugs/show_bug.cgi?id=21421
204 "-O0",
205 ],
Dan Albertfc8f2682018-12-06 13:57:32 -0800206 static_libs: [
207 "libc++experimental",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800208 "libc++fs",
Dan Albertfc8f2682018-12-06 13:57:32 -0800209 ],
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800210 rtti: true,
211 local_include_dirs: [
212 "test/support",
213 ],
214 multilib: {
215 lib32: {
216 suffix: "32",
217 },
218 lib64: {
219 suffix: "64",
220 },
221 },
222 compile_multilib: "both",
223 host_supported: true,
Elliott Hughes58fffb42018-12-12 09:16:09 -0800224 target: {
225 linux: {
226 ldflags: [
227 // This makes the tests run a little faster.
228 "-Wl,--strip-all",
229 ],
230 },
231 },
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800232 gnu_extensions: false,
233 cpp_std: "c++17",
234}
Dan Albert4d4d6a82018-12-12 13:45:05 -0800235
236python_test {
237 name: "filesystem_dynamic_test_helper.py",
238 main: "test/support/filesystem_dynamic_test_helper.py",
239 srcs: [
240 "test/support/filesystem_dynamic_test_helper.py",
241 ],
242 version: {
243 py2: {
244 enabled: true,
245 embedded_launcher: true,
246 },
247 py3: {
248 enabled: false,
249 },
250 },
251}