QMK Userspace (#22222)
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
This commit is contained in:
parent
094357c403
commit
5501e804ff
31 changed files with 1085 additions and 111 deletions
|
@ -10,6 +10,8 @@ from qmk.constants import QMK_FIRMWARE, INTERMEDIATE_OUTPUT_PREFIX
|
|||
from qmk.commands import find_make, get_make_parallel_args, parse_configurator_json
|
||||
from qmk.keyboard import keyboard_folder
|
||||
from qmk.info import keymap_json
|
||||
from qmk.keymap import locate_keymap
|
||||
from qmk.path import is_under_qmk_firmware, is_under_qmk_userspace
|
||||
|
||||
|
||||
class BuildTarget:
|
||||
|
@ -158,6 +160,20 @@ class KeyboardKeymapBuildTarget(BuildTarget):
|
|||
for key, value in env_vars.items():
|
||||
compile_args.append(f'{key}={value}')
|
||||
|
||||
# Need to override the keymap path if the keymap is a userspace directory.
|
||||
# This also ensures keyboard aliases as per `keyboard_aliases.hjson` still work if the userspace has the keymap
|
||||
# in an equivalent historical location.
|
||||
keymap_location = locate_keymap(self.keyboard, self.keymap)
|
||||
if is_under_qmk_userspace(keymap_location) and not is_under_qmk_firmware(keymap_location):
|
||||
keymap_directory = keymap_location.parent
|
||||
compile_args.extend([
|
||||
f'MAIN_KEYMAP_PATH_1={keymap_directory}',
|
||||
f'MAIN_KEYMAP_PATH_2={keymap_directory}',
|
||||
f'MAIN_KEYMAP_PATH_3={keymap_directory}',
|
||||
f'MAIN_KEYMAP_PATH_4={keymap_directory}',
|
||||
f'MAIN_KEYMAP_PATH_5={keymap_directory}',
|
||||
])
|
||||
|
||||
return compile_args
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue