Commit 12fdde66 authored by Joakim Andersson's avatar Joakim Andersson Committed by Daniel DeGrasse
Browse files

cmake: kconfig: Add APP_DIR to kconfig environment



Add APP_DIR as a kconfig environment variable.

This is useful in cases where you want to set a config path relative to
the directory of the application.

An example of this is how many sysbuild.cmake files sets the source
directory like this:

ExternalZephyrProject_Add(
  APPLICATION remote
  SOURCE_DIR ${APP_DIR}/remote
  BOARD ${SB_CONFIG_REMOTE_BOARD}
)

The same however cannot be done in Kconfig.sysbuild:

config NETCORE_IMAGE_PATH
    default "${APP_DIR}/<image_path>" if NETCORE_ABC

Instead they must use ZEPHYR_MY_MODULE_MODULE_DIR, however not all
applications are part of a zephyr module.

Signed-off-by: default avatarJoakim Andersson <joerchan@gmail.com>
parent 112cd172
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -135,6 +135,9 @@ else()
  set(_local_TOOLCHAIN_HAS_PICOLIBC n)
endif()

# APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild)
zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR)

set(COMMON_KCONFIG_ENV_SETTINGS
  PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
  srctree=${ZEPHYR_BASE}
@@ -142,6 +145,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS
  APPVERSION=${APP_VERSION_STRING}
  APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING}
  APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING}
  APP_DIR=${APP_DIR}
  CONFIG_=${KCONFIG_NAMESPACE}_
  KCONFIG_CONFIG=${DOTCONFIG}
  KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR}