lib: cpp: Rework C++ standard library configurations

This commit reworks the C++ standard library configurations such that:

* the separation between the Zephyr minimal C++ library and the fully
  featured C++ standard libraries, such as GNU libstdc++, is clear.
  This is done by deprecating the Kconfig `CONFIG_LIB_CPLUSPLUS`
  symbol, which implies that the minimal C++ library is selected when
  set to `n`, and introducing the `CONFIG_MINIMAL_LIBCPP` symbol.

* the type of the selected C++ standard library is clear. This is done
  by introducing a Kconfig choice, `LIBCPP_IMPLEMENTATION`, for the C++
  standard library type and providing the choice symbols for each
  library type supported, such as `CONFIG_MINIMAL_LIBCPP` and
  `CONFIG_GLIBCXX_LIBCPP`.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis
2022-12-10 02:15:34 +09:00
committed by Christopher Friedt
parent a3b28ff0eb
commit 669a0f5bec
4 changed files with 68 additions and 10 deletions
+51 -8
View File
@@ -56,6 +56,55 @@ config STD_CPP2B
endchoice
config REQUIRES_FULL_LIBCPP
bool
select REQUIRES_FULL_LIBC
help
Helper symbol to indicate that a full C++ standard library
implementation is required.
Select this from a symbol that enables a feature requiring a full
C++ standard library implementation.
choice LIBCPP_IMPLEMENTATION
prompt "C++ Standard Library Implementation"
default EXTERNAL_LIBCPP if REQUIRES_FULL_LIBCPP && NATIVE_APPLICATION
default GLIBCXX_LIBCPP if REQUIRES_FULL_LIBCPP
default MINIMAL_LIBCPP
config MINIMAL_LIBCPP
bool "Minimal C++ Library"
depends on !REQUIRES_FULL_LIBCPP
help
Build with the minimal C++ library provided by Zephyr.
The Zephyr minimal C++ library only provides a very limited subset
of the standard C++ library and is mainly intended for use with the
applications that do not require the Standard Template Library (STL).
config GLIBCXX_LIBCPP
bool "GNU C++ Standard Library"
depends on !NATIVE_APPLICATION
depends on NEWLIB_LIBC || (PICOLIBC && !PICOLIBC_USE_MODULE)
help
Build with GNU C++ Standard Library (libstdc++) provided by the GNU
Compiler Collection (GCC)-based toolchain.
config ARCMWDT_LIBCPP
bool "ARC MWDT C++ Library"
depends on !NATIVE_APPLICATION
depends on ARCMWDT_LIBC
help
Build with ARC MetaWare C++ Standard Library provided by the ARC
MetaWare Development Tools (MWDT) toolchain.
config EXTERNAL_LIBCPP
bool "External C++ standard library"
help
Build with an external/user-provided C++ standard library.
endchoice # LIBCPP_IMPLEMENTATION
config CPP_MAIN
bool "C++ main() function definition"
help
@@ -67,13 +116,7 @@ config CPP_MAIN
and any applications defining its main() in a C++ source file must
enable this option.
config LIB_CPLUSPLUS
bool "Link with STD C++ library"
select REQUIRES_FULL_LIBC
help
Link with STD C++ Library.
if LIB_CPLUSPLUS
if !MINIMAL_LIBCPP
config CPP_EXCEPTIONS
bool "C++ exceptions support"
@@ -86,7 +129,7 @@ config CPP_RTTI
help
This option enables support of C++ RTTI.
endif # LIB_CPLUSPLUS
endif # !MINIMAL_LIBCPP
config CPP_STATIC_INIT_GNU
# As of today only ARC MWDT toolchain doesn't support GNU-compatible