build: support out-of-tree custom boards

This is one way we can support out of tree board definitions. Basically
all this needs is a board definition in the application source directory
that follows the same structure we have in the main Zephyr tree (also
allowing multiple custom boards). An application tree would look like
this for example:

boards/
CMakeLists.txt
prj.conf
README.rst
src/

with boards following the same structure as in Zephyr:

.
├── boards
│   └── x86
│       └── arduino_101
│           ├── doc
│           │   └── img
│           └── support
└── src

To use this, you need to specify the BOARD_ROOT variable on the command
line when building:

cmake -DBOARD=<board name> -DBOARD_ROOT=<path to boards> ..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-02-11 22:30:57 -06:00 committed by Anas Nashif
commit e172fa3b52
5 changed files with 87 additions and 5 deletions

View file

@ -2,5 +2,9 @@
# error if it is missing
if(EXISTS ${BOARD_DIR}/CMakeLists.txt)
add_subdirectory(${BOARD_DIR})
if(BOARD_ROOT)
add_subdirectory(${BOARD_DIR} boards/${ARCH}/${BOARD})
else()
add_subdirectory(${BOARD_DIR})
endif()
endif()