refactor: Hook into CMake loading in a better spot.

* Shift to using an extra Zephyr module to do keymap location
  work after all board roots are resolved. This avoids duplicate work
  and allows us to load custom boards from Zephyr modules as well as
  user config setups.
This commit is contained in:
Peter Johanson 2023-11-06 17:59:01 +00:00 committed by Pete Johanson
parent 0ab6a0ad11
commit efd403a567
3 changed files with 6 additions and 10 deletions

View file

@ -2,14 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)
set(CONFIG_APPLICATION_DEFINED_SYSCALL true) set(CONFIG_APPLICATION_DEFINED_SYSCALL true)
# Add our custom Zephyr module for drivers w/ syscalls, etc. set(ZEPHYR_EXTRA_MODULES "${ZMK_EXTRA_MODULES};${CMAKE_CURRENT_SOURCE_DIR}/module;${CMAKE_CURRENT_SOURCE_DIR}/keymap-module")
list(APPEND DTS_ROOT ${CMAKE_SOURCE_DIR}/drivers/zephyr)
set(ZephyrBuildConfiguration_ROOT ${CMAKE_SOURCE_DIR}/cmake)
list(APPEND ZEPHYR_EXTRA_MODULES
${CMAKE_CURRENT_SOURCE_DIR}/module
)
# Find Zephyr. This also loads Zephyr's build system. # Find Zephyr. This also loads Zephyr's build system.
find_package(Zephyr REQUIRED HINTS ../zephyr) find_package(Zephyr REQUIRED HINTS ../zephyr)

View file

@ -5,8 +5,6 @@
# * single overlay, # * single overlay,
# * or per board/shield. # * or per board/shield.
cmake_minimum_required(VERSION 3.15)
list(APPEND BOARD_ROOT ${APPLICATION_SOURCE_DIR}) list(APPEND BOARD_ROOT ${APPLICATION_SOURCE_DIR})
list(APPEND DTS_ROOT ${APPLICATION_SOURCE_DIR}) list(APPEND DTS_ROOT ${APPLICATION_SOURCE_DIR})

View file

@ -0,0 +1,5 @@
# This ensures our modules/modules.cmake file is loaded *after* all the other modules,
# To set up the various keymap DTS and overridden .conf files are located and chosen.
build:
settings:
module_ext_root: "."