1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +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) ASSMSRC := $(wildcard *.S)
endif endif
ifneq (,$(SRCXX)) ifneq (,$(SRCXX))
ifeq (,$(filter cpp,$(FEATURES_USED))) ifeq (,$(filter cpp,$(USEMODULE)))
$(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp") 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
endif endif

View File

@ -104,7 +104,13 @@ FEATURES_OPTIONAL += no_idle_thread
ifneq (,$(filter libstdcpp,$(FEATURES_USED))) ifneq (,$(filter libstdcpp,$(FEATURES_USED)))
# Also use C++ if libstdc++ is 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 endif
ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE))) ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE)))

View File

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

View File

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

View File

@ -58,6 +58,18 @@ rsource "usb/Kconfig"
rsource "xtimer/Kconfig" rsource "xtimer/Kconfig"
rsource "ztimer/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 config MODULE_SYS
bool bool
default y default y

View File

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