Skip to content

Commit

Permalink
nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide b…
Browse files Browse the repository at this point in the history
…y toolchain.

Signed-off-by: cuiziwei <[email protected]>
  • Loading branch information
cuiziweizw authored and xiaoxiang781216 committed Oct 23, 2024
1 parent 134ecf3 commit 12fd5ec
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 27 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if(NOT CONFIG_LIBM)
nuttx_find_toolchain_lib(libm.a)
endif()

if(CONFIG_LIBSUPCXX)
if(CONFIG_LIBSUPCXX_TOOLCHAIN)
nuttx_find_toolchain_lib(libsupc++.a)
endif()

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
endif
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/src/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/src/cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if(NOT CONFIG_LIBM)
OUTPUT_VARIABLE extra_library)
list(APPEND EXTRA_LIB ${extra_library})
endif()
if(CONFIG_LIBSUPCXX)
if(CONFIG_LIBSUPCXX_TOOLCHAIN)
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
--print-file-name=libsupc++.a
Expand Down
2 changes: 1 addition & 1 deletion arch/avr/src/avr/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/avr/src/avr32/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/hc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/src/mips32/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/misoc/src/lm32/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/misoc/src/minerva/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/or1k/src/mor1kx/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/renesas/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(NOT CONFIG_LIBM)
list(APPEND EXTRA_LIB ${extra_library})
endif()

if(CONFIG_LIBSUPCXX)
if(CONFIG_LIBSUPCXX_TOOLCHAIN)
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
--print-file-name=libsupc++.a
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/x86_64/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/x86_64/src/cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(CONFIG_LIBM_TOOLCHAIN)
list(APPEND EXTRA_LIB ${extra_library})
endif()

if(CONFIG_LIBSUPCXX)
if(CONFIG_LIBSUPCXX_TOOLCHAIN)
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
--print-file-name=libsupc++.a
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/lx6/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/lx7/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
endif

Expand Down
2 changes: 1 addition & 1 deletion libs/libc/machine/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ elseif(CONFIG_ARCH_ARMV8M) # All ARMv8-M
add_subdirectory(armv8-m)
endif()

if(NOT CONFIG_LIBSUPCXX)
if(NOT CONFIG_LIBSUPCXX_TOOLCHAIN)
list(APPEND SRCS aeabi_atexit.c)
endif()

Expand Down
2 changes: 1 addition & 1 deletion libs/libc/machine/arm/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ else ifeq ($(CONFIG_ARCH_ARMV8M),y) # All ARMv8-M
include $(TOPDIR)/libs/libc/machine/arm/armv8-m/Make.defs
endif

ifneq ($(CONFIG_LIBSUPCXX),y)
ifneq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
CSRCS += aeabi_atexit.c
endif

Expand Down
16 changes: 11 additions & 5 deletions libs/libxx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ config ETL
Implements C++ templates such as containers, string
singleton math without C++ STL libraries

if LIBCXX || UCLIBCXX
if !LIBCXXMINI

choice
prompt "C++ low level library select"
default LIBSUPCXX
default LIBSUPCXX_TOOLCHAIN

config LIBCXXABI
bool "LLVM low level C++ Library"
Expand All @@ -81,21 +81,27 @@ config LIBCXXABI
Select if your use libc++abi as lower level c++ library

config LIBSUPCXX
bool "GNU compile low level libsupc++"
---help---
Select if your compile libsupc++ and use libsupc++ as lower
level c++ library.

config LIBSUPCXX_TOOLCHAIN
bool "GNU low level libsupc++"
---help---
Select if your toolchain provides libsupc++ and use libsupc++ as lower
Select if your toolchain provides libsupc++ and use toolchain libsupc++ as lower
level c++ library.

endchoice

endif

config LIBCXXABI_VERSION
string "Select libcxxabi version"
depends on LIBCXXABI
default LIBCXX_VERSION if LIBCXX
default "17.0.6" if !LIBCXX

endif

config CXX_STANDARD
string "Language standard"
default "gnu++20" if LIBCXX
Expand Down
4 changes: 4 additions & 0 deletions libs/libxx/libcxx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ set_property(
PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxx)

add_compile_definitions(_LIBCPP_BUILDING_LIBRARY)
if(CONFIG_LIBSUPCXX_TOOLCHAIN)
add_compile_definitions(__GLIBCXX__)
endif()

if(CONFIG_LIBSUPCXX)
add_compile_definitions(__GLIBCXX__)
endif()
Expand Down
6 changes: 5 additions & 1 deletion libs/libxx/libcxx.defs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ endif
CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY
CXXFLAGS += ${INCDIR_PREFIX}$(CURDIR)/libcxx/src

ifeq ($(CONFIG_LIBSUPCXX), y)
ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y)
CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
endif

ifeq ($(CONFIG_LIBSUPCXX),y)
CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
endif

Expand Down

0 comments on commit 12fd5ec

Please sign in to comment.