Skip to content

Commit

Permalink
[nrf toup] cmake: Improve access to other images in multi-image builds.
Browse files Browse the repository at this point in the history
Global property:
 - ${IMAGE}PROJECT_BINARY_DIR.
 - ${IMAGE}KERNEL_NAME.

Helper function:
 - get_image_name() to strip the '_'.

Signed-off-by: Øyvind Rønningstad <[email protected]>
Signed-off-by: Marti Bolivar <[email protected]>
(cherry picked from commit f84debc)
(cherry picked from commit 85a6975)
(cherry picked from commit 64d2463)
  • Loading branch information
oyvindronningstad authored and mbolivar-nordic committed Jul 12, 2019
1 parent eff73e7 commit 611e46e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmake/app/boilerplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ set(__build_dir ${CMAKE_CURRENT_BINARY_DIR}/zephyr)

set(PROJECT_BINARY_DIR ${__build_dir})

define_property(GLOBAL PROPERTY ${IMAGE}PROJECT_BINARY_DIR
BRIEF_DOCS "Build directory (PROJECT_BINARY_DIR) for the ${IMAGE} image."
FULL_DOCS "To be used to access e.g. this image's hex file."
)
set_property(GLOBAL PROPERTY ${IMAGE}PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR})

add_custom_target(${IMAGE}code_data_relocation_target)

# CMake's 'project' concept has proven to not be very useful for Zephyr
Expand Down Expand Up @@ -543,6 +549,12 @@ set(KERNEL_EXE_NAME ${KERNEL_NAME}.exe)
set(KERNEL_STAT_NAME ${KERNEL_NAME}.stat)
set(KERNEL_STRIP_NAME ${KERNEL_NAME}.strip)

define_property(GLOBAL PROPERTY ${IMAGE}KERNEL_NAME
BRIEF_DOCS "Name (KERNEL_NAME) for the ${IMAGE} image."
FULL_DOCS "To be used to access e.g. this image's hex file."
)
set_property(GLOBAL PROPERTY ${IMAGE}KERNEL_NAME ${KERNEL_NAME})

include(${BOARD_DIR}/board.cmake OPTIONAL)

# If we are using a suitable ethernet driver inside qemu, then these options
Expand Down
7 changes: 7 additions & 0 deletions cmake/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,13 @@ function(import_kconfig prefix kconfig_fragment)
endforeach()
endfunction()

function(get_image_name image out_var)
string(LENGTH ${image} len)
MATH(EXPR len "${len}-1")
string(SUBSTRING ${image} 0 ${len} ${out_var})
set(${out_var} ${${out_var}} PARENT_SCOPE)
endfunction()

########################################################
# 3. CMake-generic extensions
########################################################
Expand Down

0 comments on commit 611e46e

Please sign in to comment.