• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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
17// 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
21package {
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
53cc_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",
61        "-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        },
81    },
82}
83
84// host + device static lib
85cc_library_static {
86    name: "libc++_static",
87    defaults: ["libc++ defaults"],
88    vendor_available: true,
89    product_available: true,
90    ramdisk_available: true,
91    vendor_ramdisk_available: true,
92    recovery_available: true,
93    apex_available: [
94        "//apex_available:platform",
95        "//apex_available:anyapex",
96    ],
97    // being part of updatable apexes, this should work on older releases
98    min_sdk_version: "apex_inherit",
99    native_bridge_supported: true,
100    srcs: [
101        "src/algorithm.cpp",
102        "src/any.cpp",
103        "src/bind.cpp",
104        "src/charconv.cpp",
105        "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",
129        "src/variant.cpp",
130        "src/vector.cpp",
131    ],
132    whole_static_libs: [
133        "libc++abi",
134    ],
135    target: {
136        windows: {
137            srcs: [
138                "src/support/win32/*.cpp",
139            ]
140        },
141    },
142}
143
144// host + device dynamic lib
145cc_library_shared {
146    name: "libc++",
147    host_supported: true,
148    vendor_available: true,
149    product_available: true,
150    native_bridge_supported: true,
151    vndk: {
152        enabled: true,
153        support_system_process: true,
154    },
155    ramdisk_available: true,
156    vendor_ramdisk_available: true,
157    recovery_available: true,
158    apex_available: [
159        "//apex_available:platform",
160        "//apex_available:anyapex",
161    ],
162    // being part of updatable apexes, this should work on older releases
163    min_sdk_version: "apex_inherit",
164    whole_static_libs: ["libc++_static"],
165    stl: "none",
166
167    afdo: true,
168
169    target: {
170        darwin: {
171            unexported_symbols_list: "lib/libc++unexp.exp",
172            force_symbols_not_weak_list: "lib/notweak.exp",
173            force_symbols_weak_list: "lib/weak.exp",
174            ldflags: [
175                "-Wl,-undefined,dynamic_lookup",
176            ],
177        },
178
179        linux_bionic: {
180            enabled: true,
181        },
182    },
183
184    header_abi_checker: {
185        diff_flags: ["-allow-adding-removing-weak-symbols"],
186    },
187}
188
189cc_library_static {
190    name: "libc++experimental",
191    defaults: ["libc++ defaults"],
192    srcs: [
193        "src/experimental/memory_resource.cpp",
194    ],
195}
196
197// Not available to vendor modules until libc++ is updated and this library is
198// merged into libc++ proper.
199// Follow http://b/175635923 for progress.
200cc_library_static {
201    name: "libc++fs",
202    ramdisk_available: true,
203    recovery_available: true,
204    apex_available: [
205        "//apex_available:platform",
206        "com.android.art",
207        "com.android.art.debug",
208        "com.android.bluetooth",
209    ],
210    // being part of updatable apexes, this should work on older releases
211    min_sdk_version: "apex_inherit",
212    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
233// 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",
243        "-fcoroutines-ts",
244        "-Wno-format-zero-length",
245        "-Wno-implicit-fallthrough",
246        "-Wno-non-virtual-dtor",
247        "-Wno-return-stack-address",
248        "-Wno-unused-local-typedef",
249
250        "-UNDEBUG",
251
252        // Optimization is causing relocation for nothrow new to be thrown away.
253        // http://llvm.org/bugs/show_bug.cgi?id=21421
254        "-O0",
255    ],
256    static_libs: [
257        "libc++experimental",
258        "libc++fs",
259    ],
260    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,
274    target: {
275        linux: {
276            ldflags: [
277                // This makes the tests run a little faster.
278                "-Wl,--strip-all",
279            ],
280        },
281    },
282    gnu_extensions: false,
283    cpp_std: "c++17",
284}
285
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}
302
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}
331