1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpp: Use modules for cpp and libstdcpp

Also add better error message when kconfig or make includes a .cpp without cpp module.
This commit is contained in:
MrKevinWeiss 2021-06-25 11:48:59 +02:00
parent 630f7a2102
commit 652e4f41c1
No known key found for this signature in database
GPG Key ID: 3514539D7808D123
6 changed files with 31 additions and 4 deletions

View File

@ -67,9 +67,14 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
ASSMSRC := $(wildcard *.S)
endif
ifneq (,$(SRCXX))
ifeq (,$(filter cpp,$(FEATURES_USED)))
$(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp")
ifeq (,$(filter cpp,$(USEMODULE)))
ifneq (1,$(TEST_KCONFIG))
$(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp")
else
$(error Found C++ source, but "cpp" module is not used. Enable the MODULE_CPP in Kconfig)
endif
endif
endif

View File

@ -104,7 +104,13 @@ FEATURES_OPTIONAL += no_idle_thread
ifneq (,$(filter libstdcpp,$(FEATURES_USED)))
# Also use C++ if libstdc++ is used
FEATURES_REQUIRED += cpp
USEMODULE += cpp
USEMODULE += libstdcpp
endif
ifneq (,$(filter cpp,$(FEATURES_USED)))
# Also use C++ if libstdc++ is used
USEMODULE += cpp
endif
ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE)))

View File

@ -623,7 +623,7 @@ else
endif
# variables used to compile and link c++
ifneq (,$(filter cpp,$(FEATURES_USED)))
ifneq (,$(filter cpp,$(USEMODULE)))
CPPMIX ?= 1
endif

View File

@ -20,6 +20,7 @@ PSEUDOMODULES += cord_ep_standalone
PSEUDOMODULES += core_%
PSEUDOMODULES += cortexm_fpu
PSEUDOMODULES += cortexm_svc
PSEUDOMODULES += cpp
PSEUDOMODULES += cpu_check_address
PSEUDOMODULES += dbgpin
PSEUDOMODULES += devfs_%
@ -75,6 +76,7 @@ PSEUDOMODULES += ieee802154_submac
PSEUDOMODULES += ina3221_alerts
PSEUDOMODULES += l2filter_blacklist
PSEUDOMODULES += l2filter_whitelist
PSEUDOMODULES += libstdcpp
PSEUDOMODULES += lis2dh12_i2c
PSEUDOMODULES += lis2dh12_int
PSEUDOMODULES += lis2dh12_spi

View File

@ -58,6 +58,18 @@ rsource "usb/Kconfig"
rsource "xtimer/Kconfig"
rsource "ztimer/Kconfig"
config MODULE_CPP
bool "Use CPP compiler"
depends on TEST_KCONFIG
depends on HAS_CPP
config MODULE_LIBSTDCPP
bool "Use the CPP standard library"
depends on TEST_KCONFIG
depends on HAS_LIBSTDCPP
depends on HAS_CPP
select MODULE_CPP
config MODULE_SYS
bool
default y

View File

@ -16,8 +16,10 @@ menuconfig MODULE_ARDUINO
imply MODULE_PERIPH_SPI
depends on HAS_ARDUINO
depends on HAS_PERIPH_GPIO
depends on HAS_CPP
depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO
select MODULE_CPP
select MODULE_ARDUINO_SKETCHES
select MODULE_FMT
select MODULE_ZTIMER