mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-12-04 17:05:17 +00:00
split up functions/scripts a bit. downloads avr-gcc
This commit is contained in:
parent
d32724c08f
commit
2031d063b5
3
.gitignore
vendored
3
.gitignore
vendored
@ -55,6 +55,9 @@ cmake-build-debug
|
||||
# CMakeLists.txt
|
||||
*.pdf
|
||||
|
||||
# cmake toolchain downloads
|
||||
toolchains
|
||||
|
||||
# Let these ones be user specific, since we have so many different configurations
|
||||
*.code-workspace
|
||||
.stfolder
|
||||
|
@ -1,5 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
include(UpdateSubmodule)
|
||||
|
||||
macro(add_qmk_executable _)
|
||||
endmacro(add_qmk_executable)
|
||||
|
||||
@ -7,33 +11,7 @@ if(NOT DEFINED QMK_KEYBOARD)
|
||||
|
||||
project(qmk_firmware)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
macro(add_keyboard KEYBOARD_CMAKE)
|
||||
get_filename_component(KEYBOARD_FULL_DIRECTORY "${KEYBOARD_CMAKE}" DIRECTORY)
|
||||
file(RELATIVE_PATH KEYBOARD_FOLDER "${CMAKE_SOURCE_DIR}/keyboards" "${KEYBOARD_FULL_DIRECTORY}")
|
||||
string(REPLACE "/" "." KEYBOARD_NAME ${KEYBOARD_FOLDER})
|
||||
ExternalProject_Add(${KEYBOARD_NAME}
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}
|
||||
TMP_DIR ${CMAKE_SOURCE_DIR}/build
|
||||
INSTALL_COMMAND cmake -E echo "No install needed"
|
||||
CMAKE_GENERATOR "Unix Makefiles"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/platforms/avr/toolchain.cmake
|
||||
-DQMK_KEYBOARD=${KEYBOARD_NAME}
|
||||
-DQMK_KEYBOARD_FOLDER=${KEYBOARD_FOLDER}
|
||||
)
|
||||
endmacro(add_keyboard)
|
||||
|
||||
if(DEFINED QMK_KEYBOARD_FOLDER)
|
||||
add_keyboard(${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER}/CMakeFiles.txt)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE KEYBOARDS keyboards/**/CMakeLists.txt)
|
||||
|
||||
foreach(KEYBOARD_CMAKE ${KEYBOARDS})
|
||||
add_keyboard(${KEYBOARD_CMAKE})
|
||||
endforeach()
|
||||
add_subdirectory(keyboards)
|
||||
|
||||
else()
|
||||
|
||||
@ -47,31 +25,40 @@ while(NOT ${QMK_KEYBOARD_CURRENT_FOLDER} STREQUAL "")
|
||||
get_filename_component(QMK_KEYBOARD_CURRENT_FOLDER ${QMK_KEYBOARD_CURRENT_FOLDER} DIRECTORY)
|
||||
endwhile()
|
||||
|
||||
file(READ keyboards/${QMK_KEYBOARD_FOLDER}/info.json JSON_STRING)
|
||||
string(JSON KEYBOARD_NAME GET ${JSON_STRING} keyboard_name)
|
||||
string(JSON MANUFACTURER GET ${JSON_STRING} manufacturer)
|
||||
string(JSON QMK_MCU GET ${JSON_STRING} processor)
|
||||
string(JSON VENDOR_ID GET ${JSON_STRING} usb vid)
|
||||
string(JSON PRODUCT_ID GET ${JSON_STRING} usb pid)
|
||||
string(JSON DEVICE_VER GET ${JSON_STRING} usb device_version)
|
||||
# would be nice to also do validation here
|
||||
file(READ keyboards/${QMK_KEYBOARD_FOLDER}/info.json QMK_KEYBOARD_INFO_JSON_STRING)
|
||||
string(JSON KEYBOARD_NAME GET ${QMK_KEYBOARD_INFO_JSON_STRING} keyboard_name)
|
||||
string(JSON MANUFACTURER GET ${QMK_KEYBOARD_INFO_JSON_STRING} manufacturer)
|
||||
string(JSON QMK_MCU GET ${QMK_KEYBOARD_INFO_JSON_STRING} processor)
|
||||
string(JSON VENDOR_ID GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb vid)
|
||||
string(JSON PRODUCT_ID GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb pid)
|
||||
string(JSON DEVICE_VER GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb device_version)
|
||||
|
||||
foreach(FOLDER ${QMK_KEYBOARD_FOLDERS})
|
||||
include_directories(${CMAKE_SOURCE_DIR}/keyboards/${FOLDER})
|
||||
# assuming every keyboard has a config at some level
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/config.h)
|
||||
list(APPEND QMK_KEYBOARD_CONFIG_HS "${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/config.h")
|
||||
endif()
|
||||
# assuming every keyboard has a default/keymap.c at some level
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/default/keymap.c)
|
||||
list(APPEND QMK_KEYBOARD_KEYMAPS "${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/default/keymap.c")
|
||||
endif()
|
||||
# not sure if merging is needed, since info.json is required iirc
|
||||
get_filename_component(LAST_PART ${FOLDER} NAME)
|
||||
# assuming every keyboard has a header.h at some level
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/${LAST_PART}.h)
|
||||
# use just the filename, since the folder is already in our include path (maybe it should only be the base keyboard folder?)
|
||||
list(APPEND QMK_KEYBOARD_HEADERS "${LAST_PART}.h")
|
||||
endif()
|
||||
# not sure if merging is needed, since info.json is required per level? iirc
|
||||
# if(EXISTS keyboards/${FOLDER}/info.json)
|
||||
# file(READ keyboards/${FOLDER}/info.json JSON_STRING)
|
||||
# string(JSON KEYBOARD_NAME GET ${JSON_STRING} keyboard_name)
|
||||
# string(JSON MANUFACTURER GET ${JSON_STRING} manufacturer)
|
||||
# string(JSON QMK_MCU GET ${JSON_STRING} processor)
|
||||
# string(JSON VENDOR_ID GET ${JSON_STRING} usb vid)
|
||||
# string(JSON PRODUCT_ID GET ${JSON_STRING} usb pid)
|
||||
# string(JSON DEVICE_VER GET ${JSON_STRING} usb device_version)
|
||||
# file(READ keyboards/${FOLDER}/info.json QMK_KEYBOARD_INFO_JSON_STRING)
|
||||
# string(JSON KEYBOARD_NAME GET ${QMK_KEYBOARD_INFO_JSON_STRING} keyboard_name)
|
||||
# string(JSON MANUFACTURER GET ${QMK_KEYBOARD_INFO_JSON_STRING} manufacturer)
|
||||
# string(JSON QMK_MCU GET ${QMK_KEYBOARD_INFO_JSON_STRING} processor)
|
||||
# string(JSON VENDOR_ID GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb vid)
|
||||
# string(JSON PRODUCT_ID GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb pid)
|
||||
# string(JSON DEVICE_VER GET ${QMK_KEYBOARD_INFO_JSON_STRING} usb device_version)
|
||||
# endif()
|
||||
endforeach()
|
||||
|
||||
@ -79,9 +66,13 @@ if(NOT DEFINED QMK_KEYBOARD_KEYMAPS)
|
||||
message(FATAL_ERROR "Keymap not found")
|
||||
endif()
|
||||
|
||||
list(GET QMK_KEYBOARD_FOLDERS 0 QMK_KEYBOARD_BASE_FOLDER)
|
||||
if(NOT DEFINED QMK_KEYBOARD_HEADERS)
|
||||
message(FATAL_ERROR "Header not found")
|
||||
endif()
|
||||
|
||||
# list(GET QMK_KEYBOARD_FOLDERS 0 QMK_KEYBOARD_BASE_FOLDER)
|
||||
list(GET QMK_KEYBOARD_KEYMAPS 0 QMK_KEYBOARD_KEYMAP)
|
||||
list(GET QMK_KEYBOARD_FOLDER_PARTS -1 QMK_KEYBOARD_FOLDER_LAST_PART)
|
||||
list(GET QMK_KEYBOARD_HEADERS 0 QMK_KEYBOARD_HEADER)
|
||||
|
||||
project(${QMK_KEYBOARD}
|
||||
LANGUAGES C CXX ASM
|
||||
@ -93,7 +84,6 @@ set(VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
math(EXPR VERSION_C_EVAL "${VERSION_MAJOR} * 10000 + ${VERSION_MINOR} * 100 + ${VERSION_PATCH}" OUTPUT_FORMAT HEXADECIMAL)
|
||||
|
||||
|
||||
add_compile_options(
|
||||
-include ${QMK_KEYBOARD_CONFIG_HS}
|
||||
-mmcu=${QMK_MCU}
|
||||
@ -104,7 +94,7 @@ add_link_options(
|
||||
)
|
||||
|
||||
add_compile_definitions(
|
||||
QMK_KEYBOARD_H="${QMK_KEYBOARD_FOLDER_LAST_PART}.h"
|
||||
QMK_KEYBOARD_H="${QMK_KEYBOARD_HEADER}"
|
||||
KEYMAP_C="${QMK_KEYBOARD_KEYMAP}"
|
||||
MATRIX_ROWS=6
|
||||
MATRIX_COLS=15
|
||||
@ -119,16 +109,8 @@ add_subdirectory(quantum)
|
||||
add_subdirectory(platforms)
|
||||
add_subdirectory(tmk_core/protocol)
|
||||
|
||||
# option(OLED_ENABLE "" TRUE)
|
||||
# if(${OLED_ENABLE})
|
||||
# target_sources(quantum PUBLIC
|
||||
# ${CMAKE_SOURCE_DIR}/drivers/oled/ssd1306_sh1106.c
|
||||
# ${CMAKE_SOURCE_DIR}/platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers/i2c_master.c)
|
||||
# add_compile_definitions(OLED_ENABLE)
|
||||
# target_include_directories(quantum PUBLIC ${CMAKE_SOURCE_DIR}/drivers)
|
||||
# target_include_directories(quantum PUBLIC ${CMAKE_SOURCE_DIR}/drivers/oled)
|
||||
# target_include_directories(quantum PUBLIC ${CMAKE_SOURCE_DIR}/platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers)
|
||||
# endif()
|
||||
include(features/oled)
|
||||
include(features/backlight)
|
||||
|
||||
if(EXISTS keyboards/${QMK_KEYBOARD_FOLDER}/CMakeLists.txt)
|
||||
add_subdirectory(keyboards/${QMK_KEYBOARD_FOLDER})
|
||||
|
46
cmake/AddKeyboard.cmake
Normal file
46
cmake/AddKeyboard.cmake
Normal file
@ -0,0 +1,46 @@
|
||||
macro(add_keyboard KEYBOARD_CMAKE)
|
||||
get_filename_component(KEYBOARD_FULL_DIRECTORY "${KEYBOARD_CMAKE}" DIRECTORY)
|
||||
|
||||
# find the right toolchain
|
||||
file(READ ${KEYBOARD_FULL_DIRECTORY}/info.json JSON_STRING)
|
||||
string(JSON PROCESSOR GET ${JSON_STRING} processor)
|
||||
if(${PROCESSOR} MATCHES "^at.*")
|
||||
set(PLATFORM "avr")
|
||||
# find_package(avr-gcc)
|
||||
elseif(
|
||||
${PROCESSOR} MATCHES "^STM.*" OR
|
||||
${PROCESSOR} MATCHES "^WB32.*" OR
|
||||
${PROCESSOR} MATCHES "^MK.*" OR
|
||||
${PROCESSOR} MATCHES "RP2040" OR
|
||||
${PROCESSOR} MATCHES "^GD32.*")
|
||||
set(PLATFORM "chibios")
|
||||
endif()
|
||||
if(NOT DEFINED PLATFORM)
|
||||
message(FATAL_ERROR "Could not find platform for ${KEYBOARD_FULL_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
include(FindToolChain)
|
||||
find_toolchain()
|
||||
|
||||
file(RELATIVE_PATH KEYBOARD_FOLDER "${CMAKE_SOURCE_DIR}/keyboards" "${KEYBOARD_FULL_DIRECTORY}")
|
||||
string(REPLACE "/" "." KEYBOARD_NAME ${KEYBOARD_FOLDER})
|
||||
ExternalProject_Add(${KEYBOARD_NAME}
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}
|
||||
PREFIX ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}
|
||||
TMP_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/tmp
|
||||
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Download
|
||||
BINARY_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Build
|
||||
STAMP_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Stamp
|
||||
LOG_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Log
|
||||
INSTALL_DIR ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Install
|
||||
INSTALL_COMMAND cmake -E echo "No install needed"
|
||||
# this seems to work well for all systems so far - not sure if it'd be useful to customize
|
||||
CMAKE_GENERATOR "Unix Makefiles"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/platforms/${PLATFORM}/toolchain.cmake
|
||||
-DTOOLCHAIN_ROOT=${TOOLCHAIN_ROOT}
|
||||
-DMAKE_ROOT=${MAKE_ROOT}
|
||||
-DQMK_KEYBOARD=${KEYBOARD_NAME}
|
||||
-DQMK_KEYBOARD_FOLDER=${KEYBOARD_FOLDER}
|
||||
)
|
||||
endmacro(add_keyboard)
|
23
cmake/FindLufa.cmake
Normal file
23
cmake/FindLufa.cmake
Normal file
@ -0,0 +1,23 @@
|
||||
include(UpdateSubmodule)
|
||||
update_submodule(lib/lufa)
|
||||
set(LUFA_PATH ${CMAKE_SOURCE_DIR}/lib/lufa)
|
||||
set(LUFA_ROOT_PATH ${LUFA_PATH}/LUFA)
|
||||
add_library(lufa
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBController_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBInterrupt_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/ConfigDescriptors.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/Events.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/USBTask.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Class/Common/HIDParser.c
|
||||
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Host_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Pipe_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/PipeStream_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/HostStandardReq.c
|
||||
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Device_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Endpoint_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/EndpointStream_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/DeviceStandardReq.c
|
||||
)
|
||||
target_include_directories(lufa PUBLIC ${LUFA_PATH})
|
62
cmake/FindToolchain.cmake
Normal file
62
cmake/FindToolchain.cmake
Normal file
@ -0,0 +1,62 @@
|
||||
macro(find_gcc TRIPLE)
|
||||
if(UNIX)
|
||||
set(OS_SUFFIX "")
|
||||
find_path(TOOLCHAIN_ROOT
|
||||
NAMES
|
||||
${TRIPLE}-gcc${OS_SUFFIX}
|
||||
PATHS
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc/avr-gcc-12.1.0-x64-linux/bin/"
|
||||
/usr/bin/
|
||||
/usr/local/bin
|
||||
/bin/
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
find_path(MAKE_ROOT
|
||||
NAMES
|
||||
make${OS_SUFFIX}
|
||||
PATHS
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc/avr-gcc-12.1.0-x64-linux/bin/"
|
||||
/usr/bin/
|
||||
/usr/local/bin
|
||||
/bin/
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
elseif(WIN32)
|
||||
set(OS_SUFFIX ".exe")
|
||||
find_path(TOOLCHAIN_ROOT
|
||||
NAMES
|
||||
${TRIPLE}-gcc${OS_SUFFIX}
|
||||
PATHS
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
"C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
find_path(MAKE_ROOT
|
||||
NAMES
|
||||
make${OS_SUFFIX}
|
||||
PATHS
|
||||
"${CMAKE_SOURCE_DIR}/toolchains/avr-gcc/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
"C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
else(UNIX)
|
||||
message(FATAL_ERROR "toolchain not supported on this OS")
|
||||
endif(UNIX)
|
||||
endmacro(find_gcc)
|
||||
|
||||
macro(find_toolchain)
|
||||
find_gcc(avr)
|
||||
|
||||
if(NOT TOOLCHAIN_ROOT)
|
||||
include(GetAVR-GCC)
|
||||
find_gcc(avr)
|
||||
endif(NOT TOOLCHAIN_ROOT)
|
||||
|
||||
if(NOT TOOLCHAIN_ROOT)
|
||||
message(FATAL_ERROR "Toolchain root could not be found!!!")
|
||||
endif(NOT TOOLCHAIN_ROOT)
|
||||
|
||||
message("Found toolchain: ${TOOLCHAIN_ROOT}")
|
||||
message("Found make: ${MAKE_ROOT}")
|
||||
|
||||
endmacro()
|
24
cmake/GetAVR-GCC.cmake
Normal file
24
cmake/GetAVR-GCC.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
message("Downloading avr-gcc")
|
||||
if(WIN32)
|
||||
file(DOWNLOAD
|
||||
https://github.com/ZakKemble/avr-gcc-build/releases/download/v12.1.0-1/avr-gcc-12.1.0-x64-windows.zip
|
||||
${CMAKE_SOURCE_DIR}/toolchains/downloads/avr-gcc-x64-windows.zip
|
||||
EXPECTED_HASH SHA256=e921a964fdeaedbe963352d0f26c6520a0a3eb8effc6ff232f3824b06c4ea0e2
|
||||
SHOW_PROGRESS TRUE
|
||||
)
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT ${CMAKE_SOURCE_DIR}/toolchains/downloads/avr-gcc-x64-windows.zip
|
||||
DESTINATION ${CMAKE_SOURCE_DIR}/toolchains/
|
||||
)
|
||||
elseif(UNIX)
|
||||
file(DOWNLOAD
|
||||
https://github.com/ZakKemble/avr-gcc-build/releases/download/v12.1.0-1/avr-gcc-12.1.0-x64-linux.tar.bz2
|
||||
${CMAKE_SOURCE_DIR}/toolchains/downloads/avr-gcc-x64-linux.tar.bz2
|
||||
EXPECTED_HASH SHA256=feb034f4b85237032da8bac1f03765af5ebc4a8939b69bed57ff31bc482ca1a6
|
||||
SHOW_PROGRESS TRUE
|
||||
)
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT ${CMAKE_SOURCE_DIR}/toolchains/downloads/avr-gcc-x64-linux.tar.bz2
|
||||
DESTINATION ${CMAKE_SOURCE_DIR}/toolchains/
|
||||
)
|
||||
endif()
|
22
cmake/UpdateSubmodule.cmake
Normal file
22
cmake/UpdateSubmodule.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
# can be passed a relative path (to CMAKE_SOURCE_DIR) to update/checkout that submodule
|
||||
macro(update_submodule SUBMODULE)
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
option(GIT_SUBMODULE "Check submodules during build" ON)
|
||||
if(GIT_SUBMODULE)
|
||||
message(STATUS "Updating submoudle ${SUBMODULE}")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update ${SUBMODULE}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||
message(FATAL_ERROR "git submodule update ${SUBMODULE} failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message("Git not found - skipping submodule update")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/${SUBMODULE}/.git")
|
||||
message(FATAL_ERROR "The submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
|
||||
endif()
|
||||
endmacro()
|
28
cmake/features/backlight.cmake
Normal file
28
cmake/features/backlight.cmake
Normal file
@ -0,0 +1,28 @@
|
||||
option(BACKLIGHT_ENABLE "" TRUE)
|
||||
set(BACKLIGHT_DRIVER "pwm" CACHE STRING "Backlight driver")
|
||||
set_property(CACHE BACKLIGHT_DRIVER PROPERTY STRINGS pwm timer software custom)
|
||||
|
||||
if(${BACKLIGHT_ENABLE})
|
||||
add_library(backlight
|
||||
quantum/backlight/backlight.c
|
||||
quantum/process_keycode/process_backlight.c
|
||||
)
|
||||
string(JSON BACKLIGHT_PIN GET ${QMK_KEYBOARD_INFO_JSON_STRING} backlight pin)
|
||||
add_compile_definitions(
|
||||
BACKLIGHT_ENABLE
|
||||
BACKLIGHT_PIN=${BACKLIGHT_PIN}
|
||||
)
|
||||
if(${BACKLIGHT_DRIVER} STREQUAL "custom")
|
||||
add_compile_definitions(BACKLIGHT_CUSTOM_DRIVER)
|
||||
else()
|
||||
target_sources(backlight PRIVATE quantum/backlight/backlight_driver_common.c)
|
||||
if(${BACKLIGHT_DRIVER} STREQUAL "pwm")
|
||||
target_sources(backlight PRIVATE quantum/backlight/backlight_${CMAKE_SYSTEM_PROCESSOR}.c)
|
||||
else()
|
||||
target_sources(backlight PRIVATE quantum/backlight/backlight_${BACKLIGHT_DRIVER}.c)
|
||||
endif()
|
||||
endif()
|
||||
target_include_directories(backlight PUBLIC quantum/backlight)
|
||||
target_include_directories(quantum PUBLIC quantum/backlight)
|
||||
target_link_libraries(backlight PUBLIC quantum)
|
||||
endif()
|
13
cmake/features/oled.cmake
Normal file
13
cmake/features/oled.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
option(OLED_ENABLE "" TRUE)
|
||||
if(${OLED_ENABLE})
|
||||
add_library(oled
|
||||
drivers/oled/ssd1306_sh1106.c
|
||||
platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers/i2c_master.c)
|
||||
add_compile_definitions(OLED_ENABLE)
|
||||
target_include_directories(oled PUBLIC drivers)
|
||||
target_include_directories(quantum PUBLIC drivers/oled)
|
||||
target_include_directories(oled PUBLIC drivers/oled)
|
||||
target_include_directories(oled PUBLIC platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers)
|
||||
target_link_libraries(oled PUBLIC quantum)
|
||||
target_link_libraries(oled PUBLIC platform_avr)
|
||||
endif()
|
12
keyboards/CMakeLists.txt
Normal file
12
keyboards/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
include(ExternalProject)
|
||||
include(AddKeyboard)
|
||||
|
||||
if(DEFINED QMK_KEYBOARD_FOLDER)
|
||||
add_keyboard(${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER}/CMakeFiles.txt)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE KEYBOARDS **/CMakeLists.txt)
|
||||
|
||||
foreach(KEYBOARD_CMAKE ${KEYBOARDS})
|
||||
add_keyboard(${KEYBOARD_CMAKE})
|
||||
endforeach()
|
@ -6,52 +6,12 @@
|
||||
|
||||
set(TRIPLE "avr")
|
||||
|
||||
# find the toolchain root directory
|
||||
|
||||
if(UNIX)
|
||||
set(OS_SUFFIX "")
|
||||
find_path(TOOLCHAIN_ROOT
|
||||
NAMES
|
||||
${TRIPLE}-gcc${OS_SUFFIX}
|
||||
PATHS
|
||||
/usr/bin/
|
||||
/usr/local/bin
|
||||
/bin/
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
find_path(MAKE_ROOT
|
||||
NAMES
|
||||
make${OS_SUFFIX}
|
||||
PATHS
|
||||
/usr/bin/
|
||||
/usr/local/bin
|
||||
/bin/
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
elseif(WIN32)
|
||||
set(OS_SUFFIX ".exe")
|
||||
find_path(TOOLCHAIN_ROOT
|
||||
NAMES
|
||||
${TRIPLE}-gcc${OS_SUFFIX}
|
||||
PATHS
|
||||
"C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
set(OS_SUFFIX ".exe")
|
||||
find_path(MAKE_ROOT
|
||||
NAMES
|
||||
make${OS_SUFFIX}
|
||||
PATHS
|
||||
"C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/bin/"
|
||||
$ENV{AVR_ROOT}
|
||||
)
|
||||
else(UNIX)
|
||||
message(FATAL_ERROR "toolchain not supported on this OS")
|
||||
endif(UNIX)
|
||||
endif()
|
||||
|
||||
if(NOT TOOLCHAIN_ROOT)
|
||||
message(FATAL_ERROR "Toolchain root could not be found!!!")
|
||||
endif(NOT TOOLCHAIN_ROOT)
|
||||
|
||||
# setup the AVR compiler variables
|
||||
|
||||
@ -117,7 +77,7 @@ add_compile_definitions(
|
||||
# LTO_ENABLE
|
||||
)
|
||||
|
||||
include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
||||
# include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
||||
|
||||
macro(add_qmk_executable target_name)
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
set(LUFA_PATH ${CMAKE_SOURCE_DIR}/lib/lufa)
|
||||
set(ARCH AVR8)
|
||||
set(USE_STATIC_OPTIONS "(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)")
|
||||
|
||||
@ -20,65 +19,9 @@ add_library(tmk_core_protocol_lufa
|
||||
usb_util.c
|
||||
)
|
||||
|
||||
find_package(lufa REQUIRED)
|
||||
|
||||
target_include_directories(tmk_core_protocol_lufa PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(tmk_core_protocol_lufa PUBLIC ${LUFA_PATH})
|
||||
|
||||
target_link_libraries(tmk_core_protocol_lufa PUBLIC quantum)
|
||||
|
||||
set(LUFA_ROOT_PATH ${CMAKE_SOURCE_DIR}/lib/lufa/LUFA)
|
||||
|
||||
target_sources(tmk_core_protocol_lufa
|
||||
PUBLIC
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBController_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBInterrupt_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/ConfigDescriptors.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/Events.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/USBTask.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Common/HIDParser.c
|
||||
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Host_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Pipe_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/PipeStream_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/HostStandardReq.c
|
||||
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Device_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Endpoint_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/EndpointStream_${ARCH}.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Core/DeviceStandardReq.c
|
||||
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBController_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/USBInterrupt_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/ConfigDescriptors.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/Events.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/USBTask.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Class/Common/HIDParser.c
|
||||
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Host_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Pipe_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/PipeStream_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/HostStandardReq.c
|
||||
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Device_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/Endpoint_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/${ARCH}/EndpointStream_${ARCH}.c
|
||||
${LUFA_ROOT_PATH}/Drivers/USB/Core/DeviceStandardReq.c
|
||||
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/AudioClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/CCIDClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/CDCClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/HIDClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/MassStorageClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/MIDIClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/PrinterClassDevice.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Device/RNDISClassDevice.c
|
||||
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/AudioClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/CDCClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/HIDClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/MassStorageClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/MIDIClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/PrinterClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/RNDISClassHost.c
|
||||
# ${LUFA_ROOT_PATH}/Drivers/USB/Class/Host/StillImageClassHost.c
|
||||
)
|
||||
target_link_libraries(tmk_core_protocol_lufa PUBLIC lufa)
|
||||
target_link_libraries(tmk_core_protocol_lufa PUBLIC quantum)
|
Loading…
Reference in New Issue
Block a user