Skip to content

Instantly share code, notes, and snippets.

@Hexer10
Created August 30, 2020 10:13
Show Gist options
  • Save Hexer10/f4197871909964eec1820c4ee6795be6 to your computer and use it in GitHub Desktop.
Save Hexer10/f4197871909964eec1820c4ee6795be6 to your computer and use it in GitHub Desktop.
message("Found Arduino SDK: ${ARDUINO_SDK_PATH}")
## Uncomment if Arduino SDK Path is wrong
# set(ARDUINO_SDK_PATH <custom path>)
### Edit here
set(CLI_PATH <path to arduino-cli.exe)
set(FQBN <your fully qualified board name>)
set(PORT <your port>
### Add subdirectories for IntelliSense & Autocomplete
include_directories(
# PUT HERE your custom libraries, you need to put the path to the folder which contains the .h and .cpp files
# Also make sure to add the library through Arduino IDE
${ARDUINO_SDK_PATH}/hardware/arduino/avr/libraries/EEPROM/src
${ARDUINO_SDK_PATH}/hardware/arduino/avr/libraries/HID/src
${ARDUINO_SDK_PATH}/hardware/arduino/avr/libraries/SoftwareSerial/src
${ARDUINO_SDK_PATH}/hardware/arduino/avr/libraries/SPI/src
${ARDUINO_SDK_PATH}/hardware/arduino/avr/libraries/Wire/src
)
### Create custom target
add_custom_target(cli-upload
WORKING_DIRECTORY ../
COMMAND ECHO Compiling
COMMAND ${CLI_PATH} compile --fqbn ${FQBN}
COMMAND ECHO Compiling done! Uploading...
COMMAND ${CLI_PATH} upload --port ${PORT} --fqbn ${FQBN}
COMMAND ECHO Uploading done!
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment