Skip to content

Commit 1dafa52

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent 35684fa commit 1dafa52

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

libcxx/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ option(LIBCXX_ENABLE_WIDE_CHARACTERS
102102
support the C functionality for wide characters. When wide characters are
103103
not supported, several parts of the library will be disabled, notably the
104104
wide character specializations of std::basic_string." ON)
105+
option(LIBCXX_ENABLE_FATLTO
106+
"Whether to compile libc++ with FatLTO enabled." ON)
107+
option(LIBCXX_ENABLE_LTO
108+
"Whether to compile libc++ with LTO enabled." ON)
105109

106110
# To use time zone support in libc++ the platform needs to have the IANA
107111
# database installed. Libc++ will fail to build if this is enabled on a

libcxx/src/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ if (APPLE AND LLVM_USE_SANITIZER)
173173
endif()
174174
endif()
175175

176+
177+
if(LIBCXX_ENABLE_LTO)
178+
list(APPEND LIBCXX_COMPILE_FLAGS "-flto")
179+
list(APPEND LIBCXX_LINK_FLAGS "-flto")
180+
endif()
181+
if(LIBCXX_ENABLE_FATLTO)
182+
list(APPEND LIBCXX_COMPILE_FLAGS "-ffat-lto-objects")
183+
list(APPEND LIBCXX_LINK_FLAGS "-ffat-lto-objects")
184+
endif()
185+
176186
split_list(LIBCXX_COMPILE_FLAGS)
177187
split_list(LIBCXX_LINK_FLAGS)
178188

libcxxabi/src/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ if ( APPLE )
143143
endif()
144144
endif()
145145

146+
if(LIBCXX_ENABLE_LTO)
147+
list(APPEND LIBCXXABI_COMPILE_FLAGS "-flto")
148+
list(APPEND LIBCXXABI_LINK_FLAGS "-flto")
149+
endif()
150+
if(LIBCXX_ENABLE_FATLTO)
151+
list(APPEND LIBCXXABI_COMPILE_FLAGS "-ffat-lto-objects")
152+
list(APPEND LIBCXXABI_LINK_FLAGS "-ffat-lto-objects")
153+
endif()
154+
146155
split_list(LIBCXXABI_COMPILE_FLAGS)
147156
split_list(LIBCXXABI_LINK_FLAGS)
148157

@@ -154,6 +163,7 @@ endif()
154163

155164
include(WarningFlags)
156165

166+
157167
# Build the shared library.
158168
add_library(cxxabi_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
159169
cxx_add_warning_flags(cxxabi_shared_objects ${LIBCXXABI_ENABLE_WERROR} ${LIBCXXABI_ENABLE_PEDANTIC})

0 commit comments

Comments
 (0)