build: make non zephyr/ include prefix configurable

Add a Kconfig to disable non prefixed includes. By setting
`CONFIG_LEGACY_INCLUDE_PATH=n` developers can disable having
`include/zephyr` in the search path. This means that includes such
as `#include <kernel.h>` will no longer work.

Internally, every header should be updated to add the `zephyr/`
prefix to the headers. Only then, will developers be able to use
this config value for their applications.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2022-03-31 21:05:42 -06:00 committed by Carles Cufí
commit 1ec0c6f530
9 changed files with 30 additions and 8 deletions

View file

@ -5,7 +5,8 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-c ${CMAKE_C_COMPILER}
-o ${CMAKE_OBJCOPY}
-i ${ZEPHYR_BASE}/include
-i ${ZEPHYR_BASE}/include/zephyr
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:-i>
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:${ZEPHYR_BASE}/include/zephyr>
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}

View file

@ -3,7 +3,8 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
-c ${CMAKE_C_COMPILER}
-i ${ZEPHYR_BASE}/include
-i ${ZEPHYR_BASE}/include/zephyr
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:-i>
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:${ZEPHYR_BASE}/include/zephyr>
-o ${CMAKE_OBJCOPY}
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>

View file

@ -5,7 +5,8 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-c ${CMAKE_C_COMPILER}
-o ${CMAKE_OBJCOPY}
-i ${ZEPHYR_BASE}/include
-i ${ZEPHYR_BASE}/include/zephyr
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:-i>
$<$<BOOL:${CONFIG_LEGACY_INCLUDE_PATH}>:${ZEPHYR_BASE}/include/zephyr>
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}