From aa4090e375bc28fd7ef5412f898672a5a5f0d3ce Mon Sep 17 00:00:00 2001 From: haopengxiang Date: Thu, 14 Nov 2024 00:10:51 +0800 Subject: [PATCH] cmake(bugfix):fix libcxxabi layout build error Signed-off-by: haopengxiang --- libs/libxx/libcxx/CMakeLists.txt | 4 ++++ libs/libxx/libcxxabi/CMakeLists.txt | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libs/libxx/libcxx/CMakeLists.txt b/libs/libxx/libcxx/CMakeLists.txt index ff5a4b2487..6788eb4bbd 100644 --- a/libs/libxx/libcxx/CMakeLists.txt +++ b/libs/libxx/libcxx/CMakeLists.txt @@ -84,6 +84,10 @@ if(CONFIG_LIBCXX) add_compile_definitions(__GLIBCXX__) endif() + if(CONFIG_LIBCXXABI) + add_compile_definitions(LIBCXX_BUILDING_LIBCXXABI) + endif() + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) diff --git a/libs/libxx/libcxxabi/CMakeLists.txt b/libs/libxx/libcxxabi/CMakeLists.txt index 1defc475f2..ab518d852b 100644 --- a/libs/libxx/libcxxabi/CMakeLists.txt +++ b/libs/libxx/libcxxabi/CMakeLists.txt @@ -76,7 +76,14 @@ if(CONFIG_LIBCXXABI) cxa_thread_atexit.cpp cxa_vector.cpp cxa_virtual.cpp) + add_compile_definitions(_LIBCPP_BUILDING_LIBRARY) + if(CONFIG_LIBSUPCXX_TOOLCHAIN) + add_compile_definitions(__GLIBCXX__) + endif() + if(CONFIG_LIBSUPCXX) + add_compile_definitions(__GLIBCXX__) + endif() # C++ STL files list(APPEND SRCS stdlib_exception.cpp stdlib_new_delete.cpp stdlib_stdexcept.cpp stdlib_typeinfo.cpp) @@ -121,6 +128,6 @@ if(CONFIG_LIBCXXABI) target_sources(libcxxabi PRIVATE ${TARGET_SRCS}) target_include_directories( - libcxxabi BEFORE PRIVATE ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/include - ${CMAKE_CURRENT_LIST_DIR}/libcxx/src) + libcxxabi BEFORE PRIVATE ${NUTTX_DIR}/libs/libxx/libcxx/libcxx/src + ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/include) endif()