mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-30 13:58:57 +02:00
load keyboard ui through vscode
This commit is contained in:
@@ -72,5 +72,5 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
||||
-DTARGET_NAME=${TARGET_NAME}
|
||||
)
|
||||
|
||||
file(APPEND "${CMAKE_SOURCE_DIR}/build/targets" "${TARGET_NAME}|${KEYBOARD_NAME} with ${KEYMAP_FOLDER}|${KEYBOARD_FOLDER}|Made by: ${MANUFACTURER}\n")
|
||||
# file(APPEND "${CMAKE_SOURCE_DIR}/build/targets" "${TARGET_NAME}|${KEYBOARD_NAME} with ${KEYMAP_FOLDER}|${KEYBOARD_FOLDER}|Made by: ${MANUFACTURER}\n")
|
||||
endmacro(add_keyboard)
|
||||
@@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
include(ResolveKeyboard)
|
||||
include(ValidateJSON)
|
||||
|
||||
resolve_keyboard(${QMK_KEYBOARD_FOLDER} KEYBOARD_FOLDER_ABS)
|
||||
validate_json(${KEYBOARD_FOLDER_ABS}/info.json keyboard JSON_STRING)
|
||||
|
||||
if(NOT DEFINED QMK_KEYMAP_FOLDER)
|
||||
set(QMK_KEYMAP_FOLDER default)
|
||||
endif()
|
||||
|
||||
set(TEMP_PATH ${QMK_KEYBOARD_FOLDER})
|
||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
||||
|
||||
set(TEMP_PATH ${QMK_KEYMAP_FOLDER})
|
||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYMAP_FOLDER_RELATIVE)
|
||||
|
||||
if(${IS_KEYMAP_FOLDER_RELATIVE})
|
||||
set(KEYMAP_NAME ${QMK_KEYMAP_FOLDER})
|
||||
else()
|
||||
if(WIN32)
|
||||
set(KEYMAP_NAME $ENV{USERNAME})
|
||||
else()
|
||||
set(KEYMAP_NAME $ENV{USE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(JSON KEYBOARD_NAME GET ${JSON_STRING} keyboard_name)
|
||||
|
||||
if(${IS_KEYBOARD_FOLDER_RELATIVE})
|
||||
string(MAKE_C_IDENTIFIER ${QMK_KEYBOARD_FOLDER} KEYBOARD_SLUG)
|
||||
else()
|
||||
string(MAKE_C_IDENTIFIER ${KEYBOARD_NAME} KEYBOARD_SLUG)
|
||||
endif()
|
||||
|
||||
string(JSON MANUFACTURER GET ${JSON_STRING} manufacturer)
|
||||
|
||||
set(TARGET_NAME "${KEYBOARD_SLUG}_${KEYMAP_NAME}")
|
||||
file(APPEND "${CMAKE_SOURCE_DIR}/build/targets" "${TARGET_NAME}|${KEYBOARD_NAME} with ${QMK_KEYMAP_FOLDER}|${QMK_KEYBOARD_FOLDER}|Made by: ${MANUFACTURER}\n")
|
||||
|
||||
message(STATUS "Added keyboard '${QMK_KEYBOARD_FOLDER}' with keymap '${QMK_KEYMAP_FOLDER}'")
|
||||
@@ -30,8 +30,8 @@ set(AVR_SIZE "${TOOLCHAIN_ROOT}/${QMK_TOOLCHAIN}-size${OS_SUFFIX}"
|
||||
|
||||
find_program(CMAKE_MAKE_PROGRAM NAME make
|
||||
PATHS
|
||||
$<$<WIN32>:"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc-12.1.0-x64-windows/bin/">
|
||||
$<$UNIX>:"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc-12.1.0-x64-linux/bin/">
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc-12.1.0-x64-linux/bin/"
|
||||
/usr/bin/
|
||||
/usr/local/bin
|
||||
/bin/
|
||||
@@ -100,36 +100,17 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
# include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
||||
|
||||
macro(add_qmk_executable target_name)
|
||||
|
||||
set(elf_file ${target_name}-${QMK_MCU}.elf)
|
||||
set(map_file ${target_name}-${QMK_MCU}.map)
|
||||
set(hex_file ${target_name}-${QMK_MCU}.hex)
|
||||
set(lst_file ${target_name}-${QMK_MCU}.lst)
|
||||
|
||||
# add_link_options(-Wl,--gc-sections,-nostartfiles)
|
||||
set(elf_file ${target_name}.elf)
|
||||
set(map_file ${target_name}.map)
|
||||
set(hex_file ${target_name}.hex)
|
||||
set(lst_file ${target_name}.lst)
|
||||
|
||||
# create elf file
|
||||
add_executable(${elf_file}
|
||||
${ARGN}
|
||||
)
|
||||
add_executable(${elf_file} ${ARGN})
|
||||
|
||||
target_link_libraries(${elf_file}
|
||||
PUBLIC
|
||||
quantum
|
||||
tmk_core_protocol
|
||||
platforms
|
||||
)
|
||||
|
||||
# set_target_properties(
|
||||
# ${elf_file}
|
||||
|
||||
# PROPERTIES
|
||||
# COMPILE_FLAGS "-mmcu=${QMK_MCU} -g -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics"
|
||||
# LINK_FLAGS "-mmcu=${QMK_MCU} -Wl,-Map,${map_file}"
|
||||
# )
|
||||
target_link_libraries(${elf_file} qmk)
|
||||
|
||||
# generate the lst file
|
||||
add_custom_command(
|
||||
@@ -169,11 +150,16 @@ macro(add_qmk_executable target_name)
|
||||
DEPENDS ${hex_file}
|
||||
)
|
||||
|
||||
add_custom_target(copy_hex
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${elf_file}> ${CMAKE_SOURCE_DIR}/build/${target_name}.hex
|
||||
DEPENDS ${hex_file}
|
||||
)
|
||||
|
||||
# build the intel hex file for the device
|
||||
add_custom_target(
|
||||
${target_name}
|
||||
ALL
|
||||
DEPENDS ${hex_file} ${lst_file} "print-size-${elf_file}" "print-size-${hex_file}"
|
||||
DEPENDS ${hex_file} ${lst_file} "print-size-${elf_file}" "print-size-${hex_file}" copy_hex
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
|
||||
@@ -95,8 +95,6 @@ add_link_options(
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
# include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
||||
|
||||
macro(add_qmk_executable target_name)
|
||||
|
||||
set(elf_file ${target_name}.elf)
|
||||
|
||||
Reference in New Issue
Block a user