Skip to content

Commit

Permalink
refactor: Hook into CMake loading in a better spot.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
petejohanson committed Nov 24, 2023
1 parent d7d9eed commit e2040a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
9 changes: 1 addition & 8 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)

set(CONFIG_APPLICATION_DEFINED_SYSCALL true)

# Add our custom Zephyr module for drivers w/ syscalls, etc.
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
)
set(ZEPHYR_EXTRA_MODULES "${ZMK_EXTRA_MODULES};${CMAKE_CURRENT_SOURCE_DIR}/module;${CMAKE_CURRENT_SOURCE_DIR}/keymap-module")

# Find Zephyr. This also loads Zephyr's build system.
find_package(Zephyr REQUIRED HINTS ../zephyr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# * single overlay,
# * or per board/shield.

cmake_minimum_required(VERSION 3.15)

list(APPEND BOARD_ROOT ${APPLICATION_SOURCE_DIR})
list(APPEND DTS_ROOT ${APPLICATION_SOURCE_DIR})

Expand Down Expand Up @@ -60,11 +58,11 @@ if (ZMK_CONFIG)
endif()
endif()


if(DEFINED SHIELD)
string(REPLACE " " ";" SHIELD_AS_LIST "${SHIELD}")
endif()


foreach(root ${BOARD_ROOT})
set(shield_dir ${root}/boards/shields)
# Match the Kconfig.shield files in the shield directories to make sure we are
Expand Down
3 changes: 3 additions & 0 deletions app/keymap-module/zephyr/module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
settings:
module_ext_root: "."

0 comments on commit e2040a3

Please sign in to comment.