From ab87df9f75b8d59a6b7089a2eced0867d169d89e Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 18 Aug 2021 08:36:43 -0700 Subject: [PATCH] sensor: grove: fix cmake empty library warning When there is no grove sensor driver enabled, cmake warns that the library has no sources. Fix that by adding a new kconfig to be used by CMake to selectively include the grove directory. Signed-off-by: Daniel Leung --- drivers/sensor/CMakeLists.txt | 2 +- drivers/sensor/grove/Kconfig | 9 +++++++++ samples/sensor/grove_light/prj.conf | 1 + samples/sensor/grove_temperature/prj.conf | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt index cdd618d3421..39ec7342b95 100644 --- a/drivers/sensor/CMakeLists.txt +++ b/drivers/sensor/CMakeLists.txt @@ -25,7 +25,7 @@ add_subdirectory_ifdef(CONFIG_ENS210 ens210) add_subdirectory_ifdef(CONFIG_FDC2X1X fdc2x1x) add_subdirectory_ifdef(CONFIG_FXAS21002 fxas21002) add_subdirectory_ifdef(CONFIG_FXOS8700 fxos8700) -add_subdirectory(grove) +add_subdirectory_ifdef(CONFIG_GROVE_SENSORS grove) add_subdirectory_ifdef(CONFIG_TI_HDC ti_hdc) add_subdirectory_ifdef(CONFIG_TI_HDC20XX ti_hdc20xx) add_subdirectory_ifdef(CONFIG_HMC5883L hmc5883l) diff --git a/drivers/sensor/grove/Kconfig b/drivers/sensor/grove/Kconfig index 032c3dd69b5..f9b9d7b1490 100644 --- a/drivers/sensor/grove/Kconfig +++ b/drivers/sensor/grove/Kconfig @@ -3,6 +3,13 @@ # Copyright (c) 2015 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +config GROVE_SENSORS + bool "Seeed Grove sensors support" + help + Enable Seeed Grove sensors support. + +if GROVE_SENSORS + config GROVE_LIGHT_SENSOR bool "Enable the Seeed Grove Light Sensor" depends on ADC && !MINIMAL_LIBC @@ -16,3 +23,5 @@ config GROVE_TEMPERATURE_SENSOR help Setting this value will enable driver support for the Grove Temperature Sensor. + +endif # GROVE_SENSORS diff --git a/samples/sensor/grove_light/prj.conf b/samples/sensor/grove_light/prj.conf index 2e852c494ae..4b88acfa381 100644 --- a/samples/sensor/grove_light/prj.conf +++ b/samples/sensor/grove_light/prj.conf @@ -1,5 +1,6 @@ CONFIG_ADC=y CONFIG_SENSOR=y +CONFIG_GROVE_SENSORS=y CONFIG_GROVE_LIGHT_SENSOR=y CONFIG_NEWLIB_LIBC=y CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y diff --git a/samples/sensor/grove_temperature/prj.conf b/samples/sensor/grove_temperature/prj.conf index 0ba9cf35c00..7e7e509d0cd 100644 --- a/samples/sensor/grove_temperature/prj.conf +++ b/samples/sensor/grove_temperature/prj.conf @@ -1,5 +1,6 @@ CONFIG_ADC=y CONFIG_SENSOR=y +CONFIG_GROVE_SENSORS=y CONFIG_GROVE_TEMPERATURE_SENSOR=y CONFIG_NEWLIB_LIBC=y CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y