mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
libcxx: fix build error.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -94,6 +94,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_CXX_STANDARD)
|
||||||
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(ARCHCFLAGS "-Wstrict-prototypes")
|
set(ARCHCFLAGS "-Wstrict-prototypes")
|
||||||
set(ARCHCXXFLAGS "-nostdinc++")
|
set(ARCHCXXFLAGS "-nostdinc++")
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
+19
-16
@@ -24,22 +24,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx)
|
|||||||
|
|
||||||
# cmake-format: off
|
# cmake-format: off
|
||||||
set(LIBCXX_PATCH_COMMAND
|
set(LIBCXX_PATCH_COMMAND
|
||||||
patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx < ${CMAKE_CURRENT_LIST_DIR}/0001_fix_stdatomic_h_miss_typedef.patch)
|
||||||
${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()
|
|
||||||
# cmake-format: on
|
# cmake-format: on
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
libcxx
|
libcxx
|
||||||
@@ -68,13 +53,31 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx)
|
|||||||
FetchContent_Populate(libcxx)
|
FetchContent_Populate(libcxx)
|
||||||
endif()
|
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()
|
endif()
|
||||||
|
|
||||||
|
find_program(GN_EXECUTABLEXX gn REQUIRED)
|
||||||
|
message("GN_EXECUTABLEXX ${GN_EXECUTABLEXX}")
|
||||||
|
|
||||||
set_property(
|
set_property(
|
||||||
TARGET nuttx
|
TARGET nuttx
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY NUTTX_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/libcxx/include)
|
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)
|
add_compile_definitions(_LIBCPP_BUILDING_LIBRARY)
|
||||||
if(CONFIG_LIBSUPCXX)
|
if(CONFIG_LIBSUPCXX)
|
||||||
add_compile_definitions(__GLIBCXX__)
|
add_compile_definitions(__GLIBCXX__)
|
||||||
|
|||||||
Reference in New Issue
Block a user