• 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
17cc_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",
25        "-nostdinc++",
26        "-fexceptions",
27        "-DLIBCXX_BUILDING_LIBCXXABI",
28        "-D_LIBCPP_BUILDING_LIBRARY",
29    ],
30    rtti: true,
31    stl: "none",
32    target: {
33        linux_bionic: {
34            enabled: true,
35        },
36        windows: {
37            enabled: true,
38            cflags: [
39                "-D_LIBCPP_HAS_THREAD_API_WIN32",
40                "-D_LIBCXXABI_BUILDING_LIBRARY",
41                "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
42                "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
43                "-UWIN32_LEAN_AND_MEAN",
44            ],
45        },
46        windows_x86: {
47            cflags: [
48                "-fsjlj-exceptions",
49            ],
50        },
51    },
52}
53
54// host + device static lib
55cc_library_static {
56    name: "libc++_static",
57    defaults: ["libc++ defaults"],
58    vendor_available: true,
59    recovery_available: true,
60    srcs: [
61        "src/algorithm.cpp",
62        "src/any.cpp",
63        "src/bind.cpp",
64        "src/charconv.cpp",
65        "src/chrono.cpp",
66        "src/condition_variable.cpp",
67        "src/debug.cpp",
68        "src/exception.cpp",
69        "src/future.cpp",
70        "src/hash.cpp",
71        "src/ios.cpp",
72        "src/iostream.cpp",
73        "src/locale.cpp",
74        "src/memory.cpp",
75        "src/mutex.cpp",
76        "src/new.cpp",
77        "src/optional.cpp",
78        "src/random.cpp",
79        "src/regex.cpp",
80        "src/shared_mutex.cpp",
81        "src/stdexcept.cpp",
82        "src/string.cpp",
83        "src/strstream.cpp",
84        "src/system_error.cpp",
85        "src/thread.cpp",
86        "src/typeinfo.cpp",
87        "src/utility.cpp",
88        "src/valarray.cpp",
89        "src/variant.cpp",
90        "src/vector.cpp",
91    ],
92    whole_static_libs: [
93        "libc++abi",
94    ],
95    target: {
96        windows: {
97            srcs: [
98                "src/support/win32/*.cpp",
99            ]
100        },
101    },
102}
103
104// host + device dynamic lib
105cc_library_shared {
106    name: "libc++",
107    host_supported: true,
108    vendor_available: true,
109    vndk: {
110        enabled: true,
111        support_system_process: true,
112    },
113    recovery_available: true,
114    whole_static_libs: ["libc++_static"],
115    stl: "none",
116
117    target: {
118        android_arm: {
119            static_libs: ["libunwind_llvm"],
120            ldflags: ["-Wl,--exclude-libs,libunwind_llvm.a"],
121        },
122        darwin: {
123            unexported_symbols_list: "lib/libc++unexp.exp",
124            force_symbols_not_weak_list: "lib/notweak.exp",
125            force_symbols_weak_list: "lib/weak.exp",
126            ldflags: [
127                "-nodefaultlibs",
128                "-Wl,-undefined,dynamic_lookup",
129            ],
130        },
131
132        linux_glibc: {
133            ldflags: ["-nodefaultlibs"],
134        },
135        linux_bionic: {
136            enabled: true,
137        },
138    },
139}
140
141cc_library_static {
142    name: "libc++experimental",
143    defaults: ["libc++ defaults"],
144    srcs: [
145        "src/experimental/memory_resource.cpp",
146    ],
147}
148
149cc_library_static {
150    name: "libc++fs",
151    recovery_available: true,
152    defaults: ["libc++ defaults"],
153    srcs: [
154        "src/filesystem/directory_iterator.cpp",
155        "src/filesystem/operations.cpp",
156    ],
157    multilib: {
158        lib32: {
159            // off_t usage is constrained to within the libc++ source (not the
160            // headers), so we can build the filesystem library with a 64-bit
161            // off_t on LP32 to get large file support without needing all users
162            // of the library to match.
163            cflags: ["-D_FILE_OFFSET_BITS=64"],
164        },
165    },
166    target: {
167        windows: {
168            enabled: false,
169        },
170    },
171}
172
173// This target is used to extract the build commands for a test executable.
174// See run_tests.py.
175cc_binary {
176    name: "libcxx_test_template",
177    srcs: [
178        "libcxx_test_template.cpp",
179    ],
180    cppflags: [
181        "-fsized-deallocation",
182        "-fexceptions",
183        "-fcoroutines-ts",
184        "-Wno-format-zero-length",
185        "-Wno-implicit-fallthrough",
186        "-Wno-non-virtual-dtor",
187        "-Wno-return-stack-address",
188        "-Wno-unused-local-typedef",
189
190        "-UNDEBUG",
191
192        // Optimization is causing relocation for nothrow new to be thrown away.
193        // http://llvm.org/bugs/show_bug.cgi?id=21421
194        "-O0",
195    ],
196    static_libs: [
197        "libc++experimental",
198        "libc++fs",
199    ],
200    rtti: true,
201    local_include_dirs: [
202        "test/support",
203    ],
204    multilib: {
205        lib32: {
206            suffix: "32",
207        },
208        lib64: {
209            suffix: "64",
210        },
211    },
212    compile_multilib: "both",
213    host_supported: true,
214    target: {
215        linux: {
216            ldflags: [
217                // This makes the tests run a little faster.
218                "-Wl,--strip-all",
219            ],
220        },
221    },
222    gnu_extensions: false,
223    cpp_std: "c++17",
224}
225
226python_test {
227    name: "filesystem_dynamic_test_helper.py",
228    main: "test/support/filesystem_dynamic_test_helper.py",
229    srcs: [
230        "test/support/filesystem_dynamic_test_helper.py",
231    ],
232    version: {
233        py2: {
234            enabled: true,
235            embedded_launcher: true,
236        },
237        py3: {
238            enabled: false,
239        },
240    },
241}
242