@@ -7,7 +7,6 @@ set(LIBCXXABI_SOURCES
7
7
cxa_exception_storage.cpp
8
8
cxa_guard.cpp
9
9
cxa_handlers.cpp
10
- cxa_unexpected.cpp
11
10
cxa_vector.cpp
12
11
cxa_virtual.cpp
13
12
# C++ STL files
@@ -21,7 +20,9 @@ set(LIBCXXABI_SOURCES
21
20
)
22
21
23
22
if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
24
- list (APPEND LIBCXXABI_SOURCES stdlib_new_delete.cpp)
23
+ list (APPEND LIBCXXABI_SOURCES
24
+ stdlib_new_delete.cpp
25
+ )
25
26
endif ()
26
27
27
28
if (LIBCXXABI_ENABLE_EXCEPTIONS)
@@ -60,6 +61,10 @@ if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
60
61
add_definitions (-DHAVE___CXA_THREAD_ATEXIT_IMPL)
61
62
endif ()
62
63
64
+ if (LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST)
65
+ add_definitions (-D_LIBCXXABI_FORGIVING_DYNAMIC_CAST)
66
+ endif ()
67
+
63
68
if (APPLE )
64
69
add_library_flags_if(LIBCXXABI_HAS_SYSTEM_LIB System )
65
70
else ()
@@ -95,6 +100,9 @@ if (MINGW)
95
100
# MINGW_LIBRARIES is defined in config-ix.cmake
96
101
list (APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES} )
97
102
endif ()
103
+ if (ANDROID AND ANDROID_PLATFORM_LEVEL LESS 21)
104
+ list (APPEND LIBCXXABI_LIBRARIES android_support)
105
+ endif ()
98
106
99
107
if (NOT LIBCXXABI_USE_COMPILER_RT)
100
108
add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
@@ -128,6 +136,17 @@ if ( APPLE )
128
136
add_link_flags("-Wl,-rpath,${LIBDIR} " )
129
137
endif ()
130
138
endif ()
139
+
140
+ # Make sure we link in CrashReporterClient if we find it -- it's used by
141
+ # abort() on Apple platforms when building the system dylib.
142
+ find_library (CrashReporterClient NAMES libCrashReporterClient.a
143
+ PATHS "${CMAKE_OSX_SYSROOT} /usr/local/lib" )
144
+ if (CrashReporterClient)
145
+ message (STATUS "Linking with CrashReporterClient at ${CrashReporterClient} " )
146
+ add_library_flags("${CrashReporterClient} " )
147
+ else ()
148
+ message (STATUS "Could not find CrashReporterClient, not linking against it" )
149
+ endif ()
131
150
endif ()
132
151
133
152
split_list(LIBCXXABI_COMPILE_FLAGS)
@@ -143,18 +162,9 @@ if (NOT TARGET pstl::ParallelSTL)
143
162
message (STATUS "Could not find ParallelSTL, libc++abi will not attempt to use it but the build may fail if the libc++ in use needs it to be available." )
144
163
endif ()
145
164
146
- if ("${CMAKE_OSX_ARCHITECTURES} " MATCHES "^(armv6|armv7|armv7s)$" )
147
- set (LIBCXXABI_USE_SJLJ_EXCEPTIONS ON )
148
- else ()
149
- set (LIBCXXABI_USE_SJLJ_EXCEPTIONS OFF )
150
- endif ()
151
-
152
165
# Build the shared library.
153
166
if (LIBCXXABI_ENABLE_SHARED)
154
167
add_library (cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS} )
155
- if (COMMAND llvm_setup_rpath)
156
- llvm_setup_rpath(cxxabi_shared)
157
- endif ()
158
168
target_link_libraries (cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES} )
159
169
if (TARGET pstl::ParallelSTL)
160
170
target_link_libraries (cxxabi_shared PUBLIC pstl::ParallelSTL)
@@ -164,9 +174,9 @@ if (LIBCXXABI_ENABLE_SHARED)
164
174
CXX_EXTENSIONS
165
175
OFF
166
176
CXX_STANDARD
167
- 11
177
+ 20
168
178
CXX_STANDARD_REQUIRED
169
- ON
179
+ OFF
170
180
COMPILE_FLAGS
171
181
"${LIBCXXABI_COMPILE_FLAGS} "
172
182
LINK_FLAGS
@@ -189,18 +199,32 @@ if (LIBCXXABI_ENABLE_SHARED)
189
199
list (APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared" )
190
200
endif ()
191
201
202
+ add_library (cxxabi-reexports INTERFACE )
203
+
192
204
# -exported_symbols_list is only available on Apple platforms
193
205
if (APPLE )
194
- target_link_libraries (cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR} /../lib/itanium-base.exp" )
206
+ function (export_symbols file)
207
+ target_link_libraries (cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${file} " )
208
+ endfunction ()
209
+ function (reexport_symbols file)
210
+ export_symbols("${file} " )
211
+ target_link_libraries (cxxabi-reexports INTERFACE "-Wl,-reexported_symbols_list,${file} " )
212
+ endfunction ()
213
+
214
+ export_symbols("${CMAKE_CURRENT_SOURCE_DIR} /../lib/itanium-base.exp" )
195
215
196
216
if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
197
- target_link_libraries (cxxabi_shared PRIVATE "-Wl,-exported_symbols_list, ${CMAKE_CURRENT_SOURCE_DIR} /../lib/new-delete.exp" )
217
+ reexport_symbols( " ${CMAKE_CURRENT_SOURCE_DIR} /../lib/new-delete.exp" )
198
218
endif ()
199
219
200
- if (LIBCXXABI_USE_SJLJ_EXCEPTIONS)
201
- target_link_libraries (cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR} /../lib/personality-sjlj.exp" )
202
- else ()
203
- target_link_libraries (cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR} /../lib/personality-v0.exp" )
220
+ if (LIBCXXABI_ENABLE_EXCEPTIONS)
221
+ reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR} /../lib/exceptions.exp" )
222
+
223
+ if ("${CMAKE_OSX_ARCHITECTURES} " MATCHES "^(armv6|armv7|armv7s)$" )
224
+ reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR} /../lib/personality-sjlj.exp" )
225
+ else ()
226
+ reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR} /../lib/personality-v0.exp" )
227
+ endif ()
204
228
endif ()
205
229
endif ()
206
230
endif ()
@@ -217,9 +241,9 @@ if (LIBCXXABI_ENABLE_STATIC)
217
241
CXX_EXTENSIONS
218
242
OFF
219
243
CXX_STANDARD
220
- 11
244
+ 20
221
245
CXX_STANDARD_REQUIRED
222
- ON
246
+ OFF
223
247
COMPILE_FLAGS
224
248
"${LIBCXXABI_COMPILE_FLAGS} "
225
249
LINK_FLAGS
@@ -255,10 +279,10 @@ if (LIBCXXABI_ENABLE_STATIC)
255
279
set (MERGE_ARCHIVES_LIBTOOL "--use-libtool" "--libtool" "${CMAKE_LIBTOOL} " )
256
280
endif ()
257
281
258
- # Merge the the libc++abi.a and libunwind.a into one.
282
+ # Merge the libc++abi.a and libunwind.a into one.
259
283
if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
260
284
add_custom_command (TARGET cxxabi_static POST_BUILD
261
- COMMAND ${PYTHON_EXECUTABLE } ${LIBCXXABI_LIBCXX_PATH} /utils/merge_archives.py
285
+ COMMAND ${Python3_EXECUTABLE } ${LIBCXXABI_LIBCXX_PATH} /utils/merge_archives.py
262
286
ARGS
263
287
-o "$<TARGET_LINKER_FILE:cxxabi_static>"
264
288
--ar "${CMAKE_AR} "
@@ -292,7 +316,4 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND LIBCXXABI_INSTALL_LIBRARY)
292
316
-DCMAKE_INSTALL_COMPONENT=cxxabi
293
317
-DCMAKE_INSTALL_DO_STRIP=1
294
318
-P "${LIBCXXABI_BINARY_DIR} /cmake_install.cmake" )
295
-
296
- # TODO: This is a legacy target name and should be removed at some point.
297
- add_custom_target (install -libcxxabi DEPENDS install -cxxabi)
298
319
endif ()
0 commit comments