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