Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adding Board Hardware Libraries into the Visual Studio Solution (Read 2148 times)
SeattleArduino
Newbies
*
Offline


Posts: 1
Location: Seattle, WA
Joined: Sep 13th, 2017
Adding Board Hardware Libraries into the Visual Studio Solution
Sep 13th, 2017 at 1:26am
Print Post  
Can I included the entire hardware repository in the project and compile using that on a per project basis?  I am using the ESP8266 Code base 
(esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi ) 
- https://github.com/esp8266/Arduino

The issue is I need to make modifications to this repository for specific project and would like to use github.com to keep track of my code base changes.

Thank you!


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding Board Hardware Libraries into the Visual Studio Solution
Reply #1 - Sep 13th, 2017 at 1:52am
Print Post  
I wouldn't recommend put core and libs in a project although you can effectively do the same thing.

There are 3 distinct phases to an arduino compile. 1) Core 2) Libraries 3) Project. Core is created to be clean and have no connection to the other code. In fact it is built and then compressed into an an archive (core.a) then passed to the linker as the single file.

Libraries are compiled individually, can reference the core but do not normally have access to project code.

The project has access to all.

To edit or clone your own versions of libraries is very easy using shared projects. To see how a library shared project works add any library to a project using the visual micro "add library" menu. Notice the menu also has a checkbox that says "Create a project when adding libraries". Make sure the menu is checked then add a library.

Normally adding an arduino library is just a matter of adding an #include to the code but with the "create a project" option enabled Visual Micro will create a shared project and add it to the current solution along with a readme file explaining how to add a reference to the new shared lib project to any normal Arduino project.



It's easy and after you add a Reference intellisense and build will be more flexible.

The next test would be to remove the Reference and remove the lib from the solution. Then with windows explorer copy the library folder to any location on your pc. The back in VS click "File>Add existing project" and select your library project from its new location. Then add a Reference from the Arduino project to the shared lib project.

You will soon discover that a VS shared project is a simple project_name.vcxitems file. The file is a special Visual Studio project that can not be built directly and that inherits intellisense from the Startup Project of the current solution. 

For Visual Micro a shared Arduino library project is simply a standard VS shared c++ items project located in a folder that has an arduino library.properties text file. During build, Visual Micro will detect the project References and use the source code from the shared project instead of from the original library. 

By having your own library sources in shared projects you will find them easier to structure in the solution explorer.

I hope this makes sense. Some docs here 



File>New>Project>Visual C++>Visual Micro>Arduino Library

You can also create a new library from scratch to experiment but don't forget to "Add a Reference" from the Arduino project to the Shared Project. This is especially important if the library is located outside of the official arduino storage areas. 


« Last Edit: Sep 13th, 2017 at 1:54am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding Board Hardware Libraries into the Visual Studio Solution
Reply #2 - Sep 13th, 2017 at 1:55am
Print Post  
I've switched your email notifications on when posts are made on your threads.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint