Closed treaves closed 12 years ago
Could you show me what your directory structure looks like....
I think the easiest way (method 1) to do this would be to put the ModbusMaster Library into Libraries folder with the other standard arduino libraries. Create a folder ModbusMaster at hardware/library and copy the ModbusMaster.cpp and ModbusMaster.h into it. Should be able to declare an import statement from there and all should be well.
Though if you're dead-set on using method 2 you're going to need to post your directory structure.
My basic structure is: /OpenTroller -/CMakeLists.txt -/builds/ -/src/ -/src/CMakeLists.txt -/src/(source files)
This works, in that cmake finishes, and make fails with the first missing library, in this case ModbusMaster. The file structure is: /ModbusMaster -/ModbusMaster.h -/ModbusMaster.cpp
I have tried: /OpenTroller -/libraries/ModbusMaster/...
/OpenTroller -/ModbusMaster/...
/OpenTroller -/src/libraries/ModbusMaster/...
/OpenTroller -/src/ModbusMaster/...
In all of these cases, no change was made to CMakeLists.txt, and in all cases, the library was not found. Next, I used: /OpenTroller -/libraries/ -/libraries/CMakeLists.txt -/libraries/ModbusMaster/... and included the the cmake file in the master one. This causes ModbusMaster to be found, but as I originally posted, cmake spits out two entries for it.
Very intresting... The following two directory structures should have worked:
/OpenTroller -/src/ModbusMaster/...
and
/OpenTroller -/src/libraries/ModbusMaster/...
I'll check in my work, and give the link to the SVN repository if you'd care to try it and help me figure out what I may have done wrong.
I am also having an issue where loop(), setup(), etc are not being found. But as I am trying to create a library, they should not be needed. I have a tarball (70k) of my entire project. It does not look like I can attach it here. Would one of you be willing to have me e-mail it to you ?
In addition to the above issue, a more serious one is that these libraries, when added with a CMakeLists.txt file, do not get added to the include path. So my src/* files, when they try to import a header from a library, can not be found.
I've committed this to https://brewtroller.googlecode.com/svn/branches/BrewTroller/cmake
This should work with Arduino IDE 0022, but, the sanguine modifications from http://code.google.com/p/brewtroller/downloads/detail?name=BTModsForArduino22%2C20110227.zip&can=2&q= will need to be added (this adds support for the sanguino boards).
Thanks for making your sources available. I'll look at them as soon as I have some free time, hopefully that will be in the next few days.
As for the include search paths, when using generate_arduino_library you have to manually setup the search paths using the cmake command include_directories().
Also could you tell me what operating system your are using. I mainly use linux (Arch Linux) do my development...
I believe I have resolved this issue. It was relating to the include_directories directive. It would be nice to have that done automatically. So I'm going to close this issue, and open a new one for the above referenced code.
The "Arduino Libraries" section of the documentation is a bit ambiguous. I am trying to use the ModbusMaster library. I have tried to put the ModbusMaster folder in my top-level folder, as well as my src/ folder (both of which contain a CMakeLists.txt file). In neither case is it found.
When I create a libraries folder in my top-level folder, and put the ModbusMaster folder in this folder, and create a CMakeLists.txt file for it (with the .h & .cpp), cmake does then see it, but I see this output: -- Generating ModbusMaster -- Generating Arduino ModbusMaster library
Which to me seems like it is trying to create it twice.
So, the documentation is either incorrect, or there is a defect in the project, or I'm doing something wrong. But following the #2 library note to "Place the library next to the firmware configuration file (same directory as the CMakeLists.txt)" does not seem to be working (this would be my src folder).