libcxx: fix build error.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
a3eb42f469
commit
fb5c9975cc
@ -94,6 +94,10 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_CXX_STANDARD)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>)
|
||||
endif()
|
||||
|
||||
set(ARCHCFLAGS "-Wstrict-prototypes")
|
||||
set(ARCHCXXFLAGS "-nostdinc++")
|
||||
|
||||
|
11
libs/libxx/0001_fix_stdatomic_h_miss_typedef.patch
Normal file
11
libs/libxx/0001_fix_stdatomic_h_miss_typedef.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- libcxx/include/stdatomic.h.old 2023-12-06 21:01:46.168049453 +0800
|
||||
+++ libcxx/include/stdatomic.h 2023-12-06 21:01:55.056057032 +0800
|
||||
@@ -220,7 +220,7 @@
|
||||
using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
|
||||
using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
|
||||
|
||||
-#elif defined(_LIBCPP_COMPILER_CLANG_BASED)
|
||||
+#else
|
||||
|
||||
// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
|
||||
// the header. We do this because Clang has historically shipped a <stdatomic.h>
|
@ -24,22 +24,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx)
|
||||
|
||||
# cmake-format: off
|
||||
set(LIBCXX_PATCH_COMMAND
|
||||
patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0001-Remove-the-locale-fallback-for-NuttX.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0001-libc-avoid-the-waring-__EXCEPTIONS-is-not-defined-ev.patch
|
||||
&& patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-Rename-PS-macro-to-avoid-clashing-with-Xtensa.patch
|
||||
)
|
||||
|
||||
if(CONFIG_LIBC_ARCH_ATOMIC)
|
||||
list(
|
||||
APPEND
|
||||
LIBCXX_PATCH_COMMAND
|
||||
&& patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch
|
||||
)
|
||||
endif()
|
||||
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx < ${CMAKE_CURRENT_LIST_DIR}/0001_fix_stdatomic_h_miss_typedef.patch)
|
||||
# cmake-format: on
|
||||
FetchContent_Declare(
|
||||
libcxx
|
||||
@ -68,13 +53,31 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx)
|
||||
FetchContent_Populate(libcxx)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
sh -c
|
||||
"ln -s ${CMAKE_CURRENT_LIST_DIR}/libcxx/include ${NUTTX_DIR}/include/libcxx"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||
execute_process(
|
||||
COMMAND
|
||||
sh -c
|
||||
"cp ${CMAKE_CURRENT_LIST_DIR}/__config_site ${NUTTX_DIR}/include/libcxx/__config_site"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif()
|
||||
|
||||
find_program(GN_EXECUTABLEXX gn REQUIRED)
|
||||
message("GN_EXECUTABLEXX ${GN_EXECUTABLEXX}")
|
||||
|
||||
set_property(
|
||||
TARGET nuttx
|
||||
APPEND
|
||||
PROPERTY NUTTX_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/libcxx/include)
|
||||
|
||||
set_property(
|
||||
TARGET nuttx
|
||||
APPEND
|
||||
PROPERTY NUTTX_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/libcxx/src)
|
||||
|
||||
add_compile_definitions(_LIBCPP_BUILDING_LIBRARY)
|
||||
if(CONFIG_LIBSUPCXX)
|
||||
add_compile_definitions(__GLIBCXX__)
|
||||
|
Loading…
x
Reference in New Issue
Block a user