blob: 7e82b08ff3b52602d4a3ba9cc4bf5efb1213cb3f [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 },
Dan Albertfc8f2682018-12-06 13:57:32 -080045 },
46}
47
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070048// host + device static lib
49cc_library_static {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070050 name: "libc++_static",
Dan Albertfc8f2682018-12-06 13:57:32 -080051 defaults: ["libc++ defaults"],
Dan Willemsen4cef24e2017-04-07 14:12:18 -070052 vendor_available: true,
Yifan Hong5488d3c2020-01-21 16:44:28 -080053 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -070054 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +090055 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +090056 apex_available: [
57 "//apex_available:platform",
58 "//apex_available:anyapex",
59 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +090060 // being part of updatable apexes, this should work on older releases
61 min_sdk_version: "apex_inherit",
dimitrya44472d2019-05-06 12:37:14 +020062 native_bridge_supported: true,
Colin Cross286a75e2015-11-19 14:23:11 -080063 srcs: [
64 "src/algorithm.cpp",
65 "src/any.cpp",
66 "src/bind.cpp",
Dan Albert91714f92018-12-05 16:06:16 -080067 "src/charconv.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -080068 "src/chrono.cpp",
69 "src/condition_variable.cpp",
70 "src/debug.cpp",
71 "src/exception.cpp",
72 "src/future.cpp",
73 "src/hash.cpp",
74 "src/ios.cpp",
75 "src/iostream.cpp",
76 "src/locale.cpp",
77 "src/memory.cpp",
78 "src/mutex.cpp",
79 "src/new.cpp",
80 "src/optional.cpp",
81 "src/random.cpp",
82 "src/regex.cpp",
83 "src/shared_mutex.cpp",
84 "src/stdexcept.cpp",
85 "src/string.cpp",
86 "src/strstream.cpp",
87 "src/system_error.cpp",
88 "src/thread.cpp",
89 "src/typeinfo.cpp",
90 "src/utility.cpp",
91 "src/valarray.cpp",
Dan Albertc0ecf332017-01-26 18:48:00 -080092 "src/variant.cpp",
Dan Albert80bd2e42018-02-07 15:05:22 -080093 "src/vector.cpp",
Colin Cross286a75e2015-11-19 14:23:11 -080094 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -070095 whole_static_libs: [
96 "libc++abi",
97 ],
Dan Willemseneab4a7b2016-11-04 12:26:27 -070098 target: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -070099 windows: {
Pirama Arumuga Nainar5383d2f2018-08-08 10:31:09 -0700100 srcs: [
101 "src/support/win32/*.cpp",
102 ]
103 },
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700104 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700105}
106
107// host + device dynamic lib
108cc_library_shared {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700109 name: "libc++",
Dan Willemsen4cef24e2017-04-07 14:12:18 -0700110 host_supported: true,
111 vendor_available: true,
dimitrya44472d2019-05-06 12:37:14 +0200112 native_bridge_supported: true,
Justin Yun6e22fc82017-07-24 15:19:44 +0900113 vndk: {
114 enabled: true,
115 support_system_process: true,
116 },
Yifan Hong5488d3c2020-01-21 16:44:28 -0800117 ramdisk_available: true,
Yifan Hong60865662020-10-21 18:42:18 -0700118 vendor_ramdisk_available: true,
Jiyong Parkbfb14242018-04-27 21:47:53 +0900119 recovery_available: true,
Jiyong Park2d6d9ab2020-03-07 16:40:05 +0900120 apex_available: [
121 "//apex_available:platform",
122 "//apex_available:anyapex",
123 ],
Jooyung Hanf65f67c2020-04-16 18:48:28 +0900124 // being part of updatable apexes, this should work on older releases
125 min_sdk_version: "apex_inherit",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700126 whole_static_libs: ["libc++_static"],
127 stl: "none",
128
129 target: {
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700130 darwin: {
Dan Willemsene368a1f2015-12-04 15:50:00 -0800131 unexported_symbols_list: "lib/libc++unexp.exp",
132 force_symbols_not_weak_list: "lib/notweak.exp",
133 force_symbols_weak_list: "lib/weak.exp",
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700134 ldflags: [
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700135 "-Wl,-undefined,dynamic_lookup",
136 ],
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700137 },
138
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700139 linux_bionic: {
140 enabled: true,
Dan Willemseneab4a7b2016-11-04 12:26:27 -0700141 },
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700142 },
143}
144
Dan Albertfc8f2682018-12-06 13:57:32 -0800145cc_library_static {
146 name: "libc++experimental",
147 defaults: ["libc++ defaults"],
148 srcs: [
149 "src/experimental/memory_resource.cpp",
150 ],
151}
152
Dan Alberteda4e912020-04-13 12:08:37 -0700153// Not available to vendor modules until libc++ is updated and this library is
154// merged into libc++ proper.
155// https://issuetracker.google.com/147469372
Dan Albert4d4d6a82018-12-12 13:45:05 -0800156cc_library_static {
157 name: "libc++fs",
Bowgo Tsai9c713b62019-04-16 16:07:53 +0800158 recovery_available: true,
Dan Albert4d4d6a82018-12-12 13:45:05 -0800159 defaults: ["libc++ defaults"],
160 srcs: [
161 "src/filesystem/directory_iterator.cpp",
162 "src/filesystem/operations.cpp",
163 ],
164 multilib: {
165 lib32: {
166 // off_t usage is constrained to within the libc++ source (not the
167 // headers), so we can build the filesystem library with a 64-bit
168 // off_t on LP32 to get large file support without needing all users
169 // of the library to match.
170 cflags: ["-D_FILE_OFFSET_BITS=64"],
171 },
172 },
173 target: {
174 windows: {
175 enabled: false,
176 },
177 },
178}
179
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800180// This target is used to extract the build commands for a test executable.
181// See run_tests.py.
182cc_binary {
183 name: "libcxx_test_template",
184 srcs: [
185 "libcxx_test_template.cpp",
186 ],
187 cppflags: [
188 "-fsized-deallocation",
189 "-fexceptions",
Dan Albertfd86c1f2019-02-28 15:11:47 -0800190 "-fcoroutines-ts",
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800191 "-Wno-format-zero-length",
192 "-Wno-implicit-fallthrough",
193 "-Wno-non-virtual-dtor",
194 "-Wno-return-stack-address",
195 "-Wno-unused-local-typedef",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700196
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800197 "-UNDEBUG",
Dan Willemsen00e6a4f2015-09-11 13:07:33 -0700198
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800199 // Optimization is causing relocation for nothrow new to be thrown away.
200 // http://llvm.org/bugs/show_bug.cgi?id=21421
201 "-O0",
202 ],
Dan Albertfc8f2682018-12-06 13:57:32 -0800203 static_libs: [
204 "libc++experimental",
Dan Albert4d4d6a82018-12-12 13:45:05 -0800205 "libc++fs",
Dan Albertfc8f2682018-12-06 13:57:32 -0800206 ],
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800207 rtti: true,
208 local_include_dirs: [
209 "test/support",
210 ],
211 multilib: {
212 lib32: {
213 suffix: "32",
214 },
215 lib64: {
216 suffix: "64",
217 },
218 },
219 compile_multilib: "both",
220 host_supported: true,
Elliott Hughes58fffb42018-12-12 09:16:09 -0800221 target: {
222 linux: {
223 ldflags: [
224 // This makes the tests run a little faster.
225 "-Wl,--strip-all",
226 ],
227 },
228 },
Peter Collingbourne26cd9b82018-11-30 20:29:22 -0800229 gnu_extensions: false,
230 cpp_std: "c++17",
231}
Dan Albert4d4d6a82018-12-12 13:45:05 -0800232
233python_test {
234 name: "filesystem_dynamic_test_helper.py",
235 main: "test/support/filesystem_dynamic_test_helper.py",
236 srcs: [
237 "test/support/filesystem_dynamic_test_helper.py",
238 ],
239 version: {
240 py2: {
241 enabled: true,
242 embedded_launcher: true,
243 },
244 py3: {
245 enabled: false,
246 },
247 },
248}