Comments (4)
@machadolab I'm completely stuck on this one.
I'm testing the feature against the EnableInterrupt library that you pointed out in #28, however, it is such a bad library that I truly don't understand how it even get compiled in Arduino IDE - It's some sort of magic...
The biggest problem is that the header file not only declares functions (such as enableInterrupt
), but also defines them! ๐ฑ
This leads of course to a multiple definitions of linkage error, since a header file can't define the functions it's declaring - they must reside under a different source file (unless marked as inline
, which they're obviously not in this case).
I have absolutely no idea how to solve this, nor how does the Arduino IDE manages to build it successfully.
from arduino-cmake-ng.
Not sure either. I would say just donโt support that mode and encourage people using this project to report to the lib maintainer to properly format their source when it comes up. I doubt many new libs following the 1.5 spec would have this problem.
from arduino-cmake-ng.
It doesn't really matter if the library conform to the 1.0 standard or the 1.5, since the standard doesn't mention anything about this "style" of source/header files.
Nevertheless, I might've thought about a possible solution, and I think this is probably how the Arduino IDE does it, but it's extremely complicated and would be pretty hard to implement in CMake.
The idea is to parse all header files of a library, possibly not only header-only libraries but any type of library, and check whether there are any definitions inside it. If so, physically extract them to a "temporary" source file which will be hidden from the user (It might reside under CMake's build output folder), copy the modified header file to that location as well (as it's not the original anymore) and instruct CMake to refer to those files instead.
One of the biggest problems with this approach is the inability of the user to modify something in the library's sources if he'd wanted to - Modifying the original header won't affect the temp "hidden" files, unless there'd be some sort of a link between them, but that's starting to be really messy...
It's a pretty ugly solution, and again - Would be extremely hard to implement and maintain, but that's the best I can come up with now, except of course nudging these libraries' maintainers to correct their code.
from arduino-cmake-ng.
@machadolab BTW, could you find me a good Arduino header-only library to test against?
I can create one myself just for testing, but I'd like to test against something that's actually may be used by others
from arduino-cmake-ng.
Related Issues (20)
- Project is dead HOT 1
- upload_arduino_target does not work (avrdude problem?) HOT 4
- Problem when with determining link language. HOT 3
- Include library header from another library HOT 9
- Undefined reference error when linking 3rd party libraries. HOT 4
- Refactor upload API
- Undefined reference to countPulseASM when using pulseIn function HOT 8
- Newbie: need some hand holding. HOT 2
- RegisterHardwarePlatform doesn't work HOT 3
- Install for library depending on platform HOT 6
- FastLED library linker errors HOT 1
- vidor 4000 HOT 1
- SDK not found on Debian 9 with official Arduino binary HOT 2
- Provide means to override `avrdude`
- find_arduino_library simply doesn't work HOT 6
- ARDUINO_SDK_PATH variable is forgotten during compiler check (v0.6.1) HOT 2
- Support for Third-Party Boards - Game plan HOT 4
- Reduce search-paths for version.txt file
- Board 'nano33ble' not working, unrecorgnized command -mcpu=cortex-m4 HOT 1
- SD card library is not being found. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-cmake-ng.