Skip to content

Commit 4596a97

Browse files
committed
modules: Make modules optional
Make modules optional. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent c50205e commit 4596a97

4 files changed

Lines changed: 19 additions & 14 deletions

File tree

app/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ target_sources(app PRIVATE src/main.c)
1717

1818
# Include mandatory module source folders
1919
add_subdirectory(src/modules/network)
20-
add_subdirectory(src/modules/cloud)
21-
add_subdirectory(src/modules/location)
22-
add_subdirectory(src/modules/fota)
2320
add_subdirectory(src/modules/button)
2421
add_subdirectory(src/cbor)
2522

2623
# Optional modules
2724
add_subdirectory_ifdef(CONFIG_APP_POWER src/modules/power)
2825
add_subdirectory_ifdef(CONFIG_APP_ENVIRONMENTAL src/modules/environmental)
2926
add_subdirectory_ifdef(CONFIG_APP_LED src/modules/led)
27+
add_subdirectory_ifdef(CONFIG_APP_LOCATION src/modules/location)
28+
add_subdirectory_ifdef(CONFIG_APP_CLOUD src/modules/cloud)
29+
add_subdirectory_ifdef(CONFIG_APP_FOTA src/modules/fota)

app/src/modules/cloud/Kconfig.cloud

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
menu "Cloud module"
8-
depends on NRF_CLOUD_COAP
7+
menuconfig APP_CLOUD
8+
bool "Cloud module"
9+
default y if NRF_CLOUD_COAP
10+
11+
if APP_CLOUD
912

1013
config APP_CLOUD_SHELL
1114
bool "Enable cloud shell"
@@ -112,4 +115,4 @@ module = APP_CLOUD
112115
module-str = Cloud
113116
source "subsys/logging/Kconfig.template.log_config"
114117

115-
endmenu # Cloud
118+
endif # APP_CLOUD

app/src/modules/fota/Kconfig.fota

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
menuconfig APP_FOTA
88
bool "FOTA"
9-
select FOTA
10-
default y if !BOARD_NATIVE_POSIX
9+
default y if (!BOARD_NATIVE_POSIX && NRF_CLOUD_FOTA_POLL)
10+
11+
if APP_FOTA
1112

1213
config APP_FOTA_THREAD_STACK_SIZE
1314
int "Thread stack size"
@@ -33,8 +34,6 @@ config APP_FOTA_MSG_PROCESSING_TIMEOUT_SECONDS
3334
Maximum time allowed for processing a single message in the module's state machine.
3435
The value must be smaller than CONFIG_APP_FOTA_WATCHDOG_TIMEOUT_SECONDS.
3536

36-
if APP_FOTA
37-
3837
module = APP_FOTA
3938
module-str = FOTA
4039
source "subsys/logging/Kconfig.template.log_config"

app/src/modules/location/Kconfig.location

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
44
#
55

6-
menu "Location"
7-
depends on LOCATION
8-
depends on LOCATION_DATA_DETAILS
6+
menuconfig APP_LOCATION
7+
bool "Location"
8+
default y if LOCATION
9+
select LOCATION_DATA_DETAILS
10+
11+
if APP_LOCATION
912

1013
config APP_LOCATION_THREAD_STACK_SIZE
1114
int "Thread stack size"
@@ -35,4 +38,4 @@ module = APP_LOCATION
3538
module-str = Location
3639
source "subsys/logging/Kconfig.template.log_config"
3740

38-
endmenu # Network
41+
endif # APP_LOCATION

0 commit comments

Comments
 (0)