1# C++ configuration options
2
3# Copyright (c) 2018 B. Leforestier
4# SPDX-License-Identifier: Apache-2.0
5
6menu "C++ Language Support"
7
8config CPP
9	bool "C++ support for the application"
10	help
11	  This option enables the use of applications built with C++.
12
13if CPP
14
15config STD_CPP_VERSION
16	int
17	default 199711 if STD_CPP98
18	default 201103 if STD_CPP11
19	default 201402 if STD_CPP14
20	default 201703 if STD_CPP17
21	default 202002 if STD_CPP20 || STD_CPP2A || STD_CPP2B
22	help
23	  The version number of C++ standard being used (NOTE: this uses the
24	  full year and month, and is the same as the __cplusplus macro defined
25	  by the compiler). This config can be used to check for a minimum
26	  supported version. Example:
27
28	    depends on STD_CPP_VERSION >= 201703
29
30	  Adding this to your library's enablement Kconfig will force a minimum
31	  c++17 standard.
32
33	  The full year is used so c++98 can be checked using > and < operators
34	  without conflicting with c++11 or higher.
35
36choice STD_CPP
37	prompt "C++ Standard"
38	default STD_CPP11
39	help
40	  C++ Standards.
41
42config STD_CPP98
43	bool "C++ 98"
44	help
45	  1998 C++ standard as modified by the 2003 technical corrigendum
46	  and some later defect reports.
47
48config STD_CPP11
49	bool "C++ 11"
50	help
51	  2011 C++ standard, previously known as C++0x.
52
53config STD_CPP14
54	bool "C++ 14"
55	help
56	  2014 C++ standard.
57
58config STD_CPP17
59	bool "C++ 17"
60	help
61	  2017 C++ standard, previously known as C++0x.
62
63config STD_CPP2A
64	bool "C++ 2a"
65	help
66	  Next revision of the C++ standard, which is expected to be published in 2020.
67
68config STD_CPP20
69	bool "C++ 20"
70	help
71	  2020 C++ standard, previously known as C++2A.
72
73config STD_CPP2B
74	bool "C++ 2b"
75	help
76	  Next revision of the C++ standard, which is expected to be published in 2023.
77
78endchoice
79
80config REQUIRES_FULL_LIBCPP
81	bool "Require complete C++ standard library"
82	select REQUIRES_FULL_LIBC
83	help
84	  Indicates that a full C++ standard library is required, either by
85	  a subsystem or an application. This will also include a full C
86	  library implementation.
87
88config FULL_LIBCPP_SUPPORTED
89	bool
90	help
91	  Selected when the target has at least one C++ library that offers a
92	  complete implementation and which would be selected when
93	  REQUIRES_FULL_LIBCPP is set.
94
95choice LIBCPP_IMPLEMENTATION
96	prompt "C++ Standard Library Implementation"
97	default EXTERNAL_LIBCPP if REQUIRES_FULL_LIBCPP && NATIVE_BUILD
98	default LIBCXX_LIBCPP if REQUIRES_FULL_LIBCPP && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm"
99	default GLIBCXX_LIBCPP if REQUIRES_FULL_LIBCPP
100	default MINIMAL_LIBCPP
101
102config MINIMAL_LIBCPP
103	bool "Minimal C++ Library"
104	depends on !REQUIRES_FULL_LIBCPP
105	help
106	  Build with the minimal C++ library provided by Zephyr.
107
108	  The Zephyr minimal C++ library only provides a very limited subset
109	  of the standard C++ library and is mainly intended for use with the
110	  applications that do not require the Standard Template Library (STL).
111
112config GLIBCXX_LIBCPP
113	bool "GNU C++ Standard Library"
114	depends on !NATIVE_APPLICATION
115	depends on NEWLIB_LIBC || PICOLIBC
116	select FULL_LIBCPP_SUPPORTED
117	help
118	  Build with GNU C++ Standard Library (libstdc++) provided by the GNU
119	  Compiler Collection (GCC)-based toolchain.
120
121config LIBCXX_LIBCPP
122	bool "LLVM C++ Standard Library"
123	depends on !NATIVE_APPLICATION
124	depends on NEWLIB_LIBC
125	depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm"
126	select FULL_LIBCPP_SUPPORTED
127	help
128	  Build with LLVM C++ Standard Library (libc++) provided by LLVM
129	  toolchain. Information about library can be found at
130	  https://libcxx.llvm.org
131
132config ARCMWDT_LIBCPP
133	bool "ARC MWDT C++ Library"
134	depends on !NATIVE_APPLICATION
135	depends on ARCMWDT_LIBC
136	help
137	  Build with ARC MetaWare C++ Standard Library provided by the ARC
138	  MetaWare Development Tools (MWDT) toolchain.
139
140config EXTERNAL_LIBCPP
141	bool "External C++ standard library"
142	help
143	  Build and link with an external/user-provided C++ standard library.
144
145config EXTERNAL_MODULE_LIBCPP
146	bool "External C++ standard library module"
147	help
148	  Build an external/user-provided C++ standard library.
149
150endchoice # LIBCPP_IMPLEMENTATION
151
152if !MINIMAL_LIBCPP
153
154config CPP_EXCEPTIONS
155	bool "C++ exceptions support"
156	depends on !NEWLIB_LIBC_NANO
157	help
158	  This option enables support of C++ exceptions.
159
160config CPP_RTTI
161	bool "C++ RTTI support"
162	help
163	  This option enables support of C++ RTTI.
164
165endif # !MINIMAL_LIBCPP
166
167endif # CPP
168
169endmenu
170