Properly add overlay/conf files for base shield dir name as well.

* Needed so when building with `kyria_left` shield, then config
  dir containing `kyria.conf` and `kyria.overlay` will also be
  applied as configs/overlays.
This commit is contained in:
Pete Johanson 2020-07-25 00:13:40 -04:00
parent 25d0664b58
commit 7a59467420
1 changed files with 11 additions and 5 deletions

View File

@ -44,13 +44,13 @@ endif()
set(CACHED_ZMK_CONFIG ${ZMK_CONFIG} CACHE STRING "Selected user ZMK config")
if (ZMK_CONFIG)
if(EXISTS "${ZMK_CONFIG}/boards")
if(EXISTS ${ZMK_CONFIG}/boards)
message(STATUS "Adding ZMK config directory as board root: ${ZMK_CONFIG}")
list(APPEND BOARD_ROOT "${ZMK_CONFIG}")
list(APPEND BOARD_ROOT ${ZMK_CONFIG})
endif()
if(EXISTS "${ZMK_CONFIG}/dts")
if(EXISTS ${ZMK_CONFIG}/dts)
message(STATUS "Adding ZMK config directory as DTS root: ${ZMK_CONFIG}")
list(APPEND DTS_ROOT "${ZMK_CONFIG}")
list(APPEND DTS_ROOT ${ZMK_CONFIG})
endif()
endif()
@ -76,6 +76,7 @@ foreach(root ${BOARD_ROOT})
NO_DEFAULT_PATH
)
foreach(shield_path ${shields_refs_list})
get_filename_component(SHIELD_DIR ${shield_path} NAME)
if (EXISTS "${shield_path}/keymap")
list(APPEND KEYMAP_DIRS ${shield_path}/keymap)
endif()
@ -101,7 +102,7 @@ if (BASE_KEYMAPS_DIR)
endif()
if (ZMK_CONFIG)
if (EXISTS "${ZMK_CONFIG}")
if (EXISTS ${ZMK_CONFIG})
message(STATUS "ZMK Config directory: ${ZMK_CONFIG}")
list(APPEND DTS_ROOT ${ZMK_CONFIG})
if (EXISTS "${ZMK_CONFIG}/include")
@ -109,8 +110,13 @@ if (ZMK_CONFIG)
endif()
if (SHIELD)
message(STATUS "Board: ${BOARD}, ${BOARD_DIR}, ${SHIELD}, ${SHIELD_DIR}")
list(APPEND overlay_candidates "${ZMK_CONFIG}/${SHIELD_DIR}.overlay")
list(APPEND overlay_candidates "${ZMK_CONFIG}/${SHIELD_DIR}_${BOARD}.overlay")
list(APPEND overlay_candidates "${ZMK_CONFIG}/${SHIELD}_${BOARD}.overlay")
list(APPEND overlay_candidates "${ZMK_CONFIG}/${SHIELD}.overlay")
list(APPEND config_candidates "${ZMK_CONFIG}/${SHIELD_DIR}.conf")
list(APPEND config_candidates "${ZMK_CONFIG}/${SHIELD_DIR}_${BOARD}.conf")
list(APPEND config_candidates "${ZMK_CONFIG}/${SHIELD}_${BOARD}.conf")
list(APPEND config_candidates "${ZMK_CONFIG}/${SHIELD}.conf")
endif()