From bcdff8220ab93e1ff1b5fe9e3b454178d2c6aeda Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 4 Aug 2021 14:40:46 -0700 Subject: [PATCH] drivers: sensors: build as static libraries Instead of putting object files inside libzephyr.a, simply build a separate static library for the top level of sensor drivers. Also, for those that were not building its own static library, make them do so as majority of sensor drivers are building their own static libraries. Signed-off-by: Daniel Leung --- drivers/sensor/CMakeLists.txt | 7 ++++--- drivers/sensor/grove/CMakeLists.txt | 5 +++-- drivers/sensor/lsm303dlhc_magn/CMakeLists.txt | 4 +++- drivers/sensor/ms5837/CMakeLists.txt | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt index ecffdb4325c..250815f468b 100644 --- a/drivers/sensor/CMakeLists.txt +++ b/drivers/sensor/CMakeLists.txt @@ -96,6 +96,7 @@ add_subdirectory_ifdef(CONFIG_ITDS wsen_itds) add_subdirectory_ifdef(CONFIG_MCUX_ACMP mcux_acmp) add_subdirectory_ifdef(CONFIG_TACH_NPCX nuvoton_tach_npcx) -zephyr_sources_ifdef(CONFIG_USERSPACE sensor_handlers.c) -zephyr_sources_ifdef(CONFIG_SENSOR_SHELL sensor_shell.c) -zephyr_sources_ifdef(CONFIG_SENSOR_SHELL_BATTERY shell_battery.c) +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_USERSPACE sensor_handlers.c) +zephyr_library_sources_ifdef(CONFIG_SENSOR_SHELL sensor_shell.c) +zephyr_library_sources_ifdef(CONFIG_SENSOR_SHELL_BATTERY shell_battery.c) diff --git a/drivers/sensor/grove/CMakeLists.txt b/drivers/sensor/grove/CMakeLists.txt index 38d659d5ca7..6313df3806d 100644 --- a/drivers/sensor/grove/CMakeLists.txt +++ b/drivers/sensor/grove/CMakeLists.txt @@ -1,4 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources_ifdef(CONFIG_GROVE_LIGHT_SENSOR light_sensor.c) -zephyr_sources_ifdef(CONFIG_GROVE_TEMPERATURE_SENSOR temperature_sensor.c) +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_GROVE_LIGHT_SENSOR light_sensor.c) +zephyr_library_sources_ifdef(CONFIG_GROVE_TEMPERATURE_SENSOR temperature_sensor.c) diff --git a/drivers/sensor/lsm303dlhc_magn/CMakeLists.txt b/drivers/sensor/lsm303dlhc_magn/CMakeLists.txt index ede2cccba92..e55822cad27 100644 --- a/drivers/sensor/lsm303dlhc_magn/CMakeLists.txt +++ b/drivers/sensor/lsm303dlhc_magn/CMakeLists.txt @@ -3,4 +3,6 @@ # # SPDX-License-Identifier: Apache-2.0 -zephyr_sources_ifdef(CONFIG_LSM303DLHC_MAGN lsm303dlhc_magn.c) +zephyr_library() + +zephyr_library_sources_ifdef(CONFIG_LSM303DLHC_MAGN lsm303dlhc_magn.c) diff --git a/drivers/sensor/ms5837/CMakeLists.txt b/drivers/sensor/ms5837/CMakeLists.txt index 15f61657d32..37e7acdd1f1 100644 --- a/drivers/sensor/ms5837/CMakeLists.txt +++ b/drivers/sensor/ms5837/CMakeLists.txt @@ -4,6 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 # -zephyr_sources( +zephyr_library() + +zephyr_library_sources( ms5837.c )