Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Arduino SDK 1.6 compatibility #174

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

JonasProgrammer
Copy link

  • incorporated patch to fix library- and compiler detection in newer arduino sdk versions (huge thanks to @thx8411 for providing the patch in Arduino SDK 1.5 Support #55 (comment))
  • fixed variables getting lost during compiler detection by storing them temporarily in environment
  • added auto-discovery via "ARDUINO_SDK_PATH" environment variable, so the path doesn't have to be set individually for each project, if the sdk is installed to a non-standard location

JonasProgrammer and others added 30 commits May 5, 2017 20:16
- incorporated patch to fix library- and compiler detection in newer arduino sdk versions (huge thanks to @thx8411 for providing the patch in queezythegreat#55 (comment))
- fixed variables getting lost during compiler detection by storing them temporarily in environment
- added auto-discovery via "ARDUINO_SDK_PATH" environment variable, so the path doesn't have to be set individually for each project, if the sdk is installed to a non-standard location
- fixed errornous path for detection
- trailing /src is no longer used for library names
- -> libraries detected correctly now
- prevent self-linking cmake warning
… to the 'LOAD_ARDUINO_STYLE_SETTINGS' function.

This function loads all settings of all boards defined in the 'boards.txt' file.
…st of available CPUs for a given board.

This list will be used later to automatically define arguments, based on their matching architecture.
…ith regards to the new 1.6 SDK modifications.
This is made to process a 2000-lines long file quicker, since there are no special navigating tools for CMake files.
It's especially compatible with the CLion IDE, which offers to collapse selected blocks of plain text into unnamed regions.
… the Arduino 1.6 SDK.

Board's cpu architecture (mcu) must be defined through the variable 'board.build.mcu' for this feature to work.
Also changed the example a bit to test it against the new feature.
… the Arduino 1.6 SDK.

Board's cpu architecture (mcu) must be defined through the variable 'board.build.mcu' for this feature to work.
Added support for board settings (menu-based) in the 1.6 SDK (thx @MrPointer)
Now you can generate examples from the 'examples' directory, such as the classic 'blink' example, using the command 'generate_arduino_example', setting the 'LIBRARY' variable to the name of the parent directory of the example, such as '01.Basics' for the 'Blink' example.
Also added a demo for it in the example CMakeLists.txt file.
Added a new command named 'GENERATE_ARDUINO_EXAMPLE', which does the same as generating examples for libraries except it is optimized for built-in examples.
Added a new function named 'setup_arduino_example' which finds an example and generates a sketch for it. This function can be optimized by passing an optional parameter which specifies the 'Category' of the example, meaning its parent directory, such as 'Basics' is for 'Blink'.
Currently only the 'xx.Example_Name' model is supported (Two-digits used).
It means that both SDKs that add a leading '0' to the index of an example's category (in single-digit indices), and those that don't, are successfully parsed.
As this commit may be a bit unclear, an example is the 'Blink' Arduino example:
Its category is named 'Basics', yet some SDKs define it in their path as '01.Basics' and some as '1.Basics'.
…ORIES'.

This variable stores a list of the loaded example categories.
Documented the 'load_arduino_examples' function.
Modified the 'find_arduino_libraries' function to perform better and return actual results when the libraries to search for are known in advance.
Modified the setup functions 'setup_arduino_libraries' and 'setup_arduino_library' to actually setup the library, correcting a few bugs that were present before, mostly regarding false variables passed to functions.
Added a new example to test the code, will be removed later or integrated to the current examples.
###Note
There is still work to do! There are a lot of untested scenarios to worry about!
The function 'Generate_cpp_from_sketch' appears damaged, creating a source file that can't be built correctly due to various function redefinitions.
Added a new version named 'generate_sketch_cpp', which seems to resolve this issue.
Also modified the command 'GENERATE_ARDUINO_LIBRARY_EXAMPLE' to perform better and adapt the new 'generate_cpp_sketch' function.

## Note
This change might by *deadly*, since the only sketch that has been tested is the one defined in the examples of this project - Others might require further processing. If it's the case, let the developers know!
…- Accidentally removed some lines 2 commits earlier, which may be valuable.

Removed unnecessary debug messages, turned off the arduino_debug switch.
Modified the regex that searches for the category's alphabetical name in the 'load_arduino_examples_categories' function. Also fixed some variable names that were have been renamed but not updated in their usage.
Modified the 'INCREMENT_EXAMPLE_CATEGORY_INDEX' macro to set the output variable locally, and not in the PARENT_SCOPE as it is a macro.
MrPointer and others added 6 commits June 24, 2017 15:45
Listed some changes regarding *arduino examples*.
Added self and [Jonas](https://github.com/JonasProgrammer) to the contributors list.
Replaced the link to the repository with a link to [Jonas's Fork](https://github.com/JonasProgrammer/arduino-cmake), honoring the original repository as well.
Added support for built-in examples and libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants