diff --git a/.clangd b/.clangd new file mode 100644 index 00000000000..dd5cdf855fc --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + Remove: -mcall-prologues \ No newline at end of file diff --git a/cmake/AddKeyboard.cmake b/cmake/AddKeyboard.cmake index 51d5ac68309..a18110b7723 100644 --- a/cmake/AddKeyboard.cmake +++ b/cmake/AddKeyboard.cmake @@ -61,7 +61,7 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER) STAMP_DIR ${CMAKE_SOURCE_DIR}/build/stamp LOG_DIR ${CMAKE_SOURCE_DIR}/build/log INSTALL_DIR ${CMAKE_SOURCE_DIR}/build/install - INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "nothing to install" #copy ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Build/* ${CMAKE_SOURCE_DIR}/build/keyboards/${KEYBOARD_FOLDER}/Install/ + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/build/${TARGET_NAME}.hex ${CMAKE_SOURCE_DIR}/${TARGET_NAME}.hex # 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 @@ -71,6 +71,13 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER) -DQMK_KEYMAP_FOLDER=${KEYMAP_FOLDER} -DTARGET_NAME=${TARGET_NAME} ) + ExternalProject_Add_Step(${TARGET_NAME} copy_compile_commands + DEPENDEES configure + DEPENDERS build + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/build/keyboards/${TARGET_NAME}/compile_commands.json ${CMAKE_SOURCE_DIR}/compile_commands.json + # BYPRODUCTS ${CMAKE_SOURCE_DIR}/compile_commands.json + ALWAYS TRUE + ) # file(APPEND "${CMAKE_SOURCE_DIR}/build/targets" "${TARGET_NAME}|${KEYBOARD_NAME} with ${KEYMAP_FOLDER}|${KEYBOARD_FOLDER}|Made by: ${MANUFACTURER}\n") endmacro(add_keyboard) diff --git a/cmake/toolchains/arm-none-eabi.cmake b/cmake/toolchains/arm-none-eabi.cmake index 2af836d0928..94c1dd6142d 100644 --- a/cmake/toolchains/arm-none-eabi.cmake +++ b/cmake/toolchains/arm-none-eabi.cmake @@ -1,3 +1,5 @@ +set(CMAKE_EXPORT_COMPILE_COMMANDS on) + include(ResolveToolchain) set(QMK_TOOLCHAIN "arm-none-eabi") diff --git a/cmake/toolchains/avr.cmake b/cmake/toolchains/avr.cmake index 0585b8475be..01e80be74e4 100644 --- a/cmake/toolchains/avr.cmake +++ b/cmake/toolchains/avr.cmake @@ -4,6 +4,8 @@ # @author Natesh Narain # @since Feb 06 2016 +set(CMAKE_EXPORT_COMPILE_COMMANDS on) + include(ResolveToolchain) set(QMK_TOOLCHAIN "avr") @@ -127,6 +129,11 @@ macro(add_qmk_executable target_name) # LINK_FLAGS "-mmcu=${QMK_MCU} ${LINK_OPTIONS}" # ) + # add_custom_target(compileOptions + # COMMAND cmake -P ${CMAKE_SOURCE_DIR}/cmake/WriteCompileOptions.cmake + # COMMENT "Writing compile_flags.txt" + # ) + # generate the lst file add_custom_command( OUTPUT ${lst_file} @@ -161,14 +168,12 @@ macro(add_qmk_executable target_name) # 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}" copy_hex + DEPENDS ${hex_file} ${lst_file} "print-size-${elf_file}" "print-size-${hex_file}" copy_hex ) set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${elf_file} ) - # list(JOIN COMPILE_OPTIONS "\n" COMPILE_FLAGS_TXT) - # file(WRITE ${CMAKE_SOURCE_DIR}/compile_flags.txt ${COMPILE_FLAGS_TXT}) endmacro(add_qmk_executable) diff --git a/compile_flags.txt b/compile_flags.txt deleted file mode 100644 index 0f9e5f75340..00000000000 --- a/compile_flags.txt +++ /dev/null @@ -1,61 +0,0 @@ --std=c11 --Iquantum --Itoolchains\avr-gcc-12.1.0-x64-windows\avr\include --DARCH=ARCH_AVR8 --DBACKLIGHT_ENABLE --DBACKLIGHT_PIN=B7 --DBOARD=BOARD_NONE --DDEVICE_VER=0x3 --DFIXED_CONTROL_ENDPOINT_SIZE=8 --DFIXED_NUM_CONFIGURATIONS=1 --DF_CPU=16000000 --DF_USB=16000000UL --DKEYMAP_C=\\\"keyboards/mntre/keymaps/default/keymap.c\\\" --DLTO_ENABLE --DMANUFACTURER=\\\"OLKB\\\" --DMATRIX_COLS=15 --DMATRIX_ROWS=6 --DOLED_ENABLE --DPRODUCT=\\\"MNTRE\\\" --DPRODUCT_ID=0xAE01 --DPROTOCOL_LUFA --DQMK_KEYBOARD_H="mntre.h" --DUSB_DEVICE_ONLY --DUSE_FLASH_DESCRIPTORS --DUSE_STATIC_OPTIONS=\"(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)\" --DVENDOR_ID=0x03A8 --D__AVR_ATmega32U4__ --Ikeyboards/mntre --Iquantum --Iquantum/logging --Iquantum/keymap_extras --Iquantum/process_keycode --Iquantum/sequencer --Iquantum/bootmagic --Iplatforms --Iplatforms/avr --Itmk_core/protocol --Ilib/lufa --Itmk_core/protocol/lufa --Idrivers --Idrivers/oled --Iplatforms/avr/drivers --Iquantum/backlight --std=gnu11 --flto --Os --Wall --Wstrict-prototypes --fcommon ---param=min-pagesize=0 --funsigned-char --funsigned-bitfields --ffunction-sections --fdata-sections --fpack-struct --fshort-enums --fno-builtin-printf --fno-inline-small-functions --fno-strict-aliasing --include keyboards/mntre/config.h --mmcu=atmega32u4 \ No newline at end of file