Generate C/C++ header to expose px4board kconfig symbols to the preprocessor

This commit is contained in:
Peter van der Perk 2022-02-02 13:16:31 +01:00 committed by Daniel Agar
parent 2fc95bb369
commit 9f97793491
2 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ set(MENUCONFIG_PATH ${PYTHON_EXECUTABLE} -m menuconfig CACHE INTERNAL "menuconfi
set(GUICONFIG_PATH ${PYTHON_EXECUTABLE} -m guiconfig CACHE INTERNAL "guiconfig program" FORCE) set(GUICONFIG_PATH ${PYTHON_EXECUTABLE} -m guiconfig CACHE INTERNAL "guiconfig program" FORCE)
set(DEFCONFIG_PATH ${PYTHON_EXECUTABLE} -m defconfig CACHE INTERNAL "defconfig program" FORCE) set(DEFCONFIG_PATH ${PYTHON_EXECUTABLE} -m defconfig CACHE INTERNAL "defconfig program" FORCE)
set(SAVEDEFCONFIG_PATH ${PYTHON_EXECUTABLE} -m savedefconfig CACHE INTERNAL "savedefconfig program" FORCE) set(SAVEDEFCONFIG_PATH ${PYTHON_EXECUTABLE} -m savedefconfig CACHE INTERNAL "savedefconfig program" FORCE)
set(GENCONFIG_PATH ${PYTHON_EXECUTABLE} -m genconfig CACHE INTERNAL "genconfig program" FORCE)
set(COMMON_KCONFIG_ENV_SETTINGS set(COMMON_KCONFIG_ENV_SETTINGS
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
@ -47,6 +48,11 @@ if(EXISTS ${BOARD_DEFCONFIG})
OUTPUT_VARIABLE DUMMY_RESULTS) OUTPUT_VARIABLE DUMMY_RESULTS)
endif() endif()
# Generate header file for C/C++ preprocessor
execute_process(COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS}
${GENCONFIG_PATH} --header-path ${PX4_BINARY_DIR}/px4_boardconfig.h
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
OUTPUT_VARIABLE DUMMY_RESULTS)
# parse board config options for cmake # parse board config options for cmake
file(STRINGS ${BOARD_CONFIG} ConfigContents) file(STRINGS ${BOARD_CONFIG} ConfigContents)

View File

@ -52,3 +52,6 @@
#include <board_config.h> #include <board_config.h>
#endif #endif
/* PX4 board kconfig symbols */
#include <px4_boardconfig.h>