Nesting a static library project in a main project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Nesting a static library project in a main project

3,372 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 03:54:01 MST 2014
Hi all,

I am often using static libraries in my projects and this mechanism works fine. Unfortunately, the link between the main project and the static libraries is (seems to be...) maintained in the workspace itself. So, when I switch to another workspace, I need to import again the static libraries and perform the "smart update" before building the main project.

My Question is: is it possible to include the static library in the project in order to have all dependencies set in the project itself,  in order to have them retrieved automatically after a workspace switch ?

Thanks a lot for the support
Michel Kuenemann
0 Kudos
Reply
17 Replies

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Fri Dec 19 03:03:57 MST 2014
Hi support,

Thanks a lot for this reply. The things are very clear now.

What you suggest is one possibility, another could be :

To use a version control system and to commit/update in one unique local sandbox + unversionned workspaces that do NOT contain copies of the projects. That is my option.

What you suggest would create, in my case, many sandboxes to manage on my computer. Furthermore versionned workspaces do not "travel" easily from one computer to another. I tryed this in the beginning but I had a lot of issues, so I decided to unversion the workspaces and to keep them strictly local to each computer.

I will read the documentation about the workspaces.

Regards,
Michel

0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Dec 19 01:36:00 MST 2014
The IDE will only know of changes to a dependent project, if that project is in the workspace.

The correct way to share projects is to use a version control system and to check-in/check-out between each workspace.

Project "Working sets" have been in the product for many years. To quote the docs: Working sets group elements for display in views or for operations on a set of elements. More information can be found by search for Working Sets in the provided help (Help->Help Contents)
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 19:59:36 MST 2014
Hello R2D2,

Of course, I DO NOT (Never) copy the projects in the workspace ! - I have forgoten to mention this !

By the way, this checkbox should NOT be checked by default in the project import wizard. Copying projects in the WS leads to a lot of problems.

Michel
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 19:56:03 MST 2014
Hello R2D2,

I think we are close to the goal.

1 - Yes, you are 100% right, Smart Update adds the settings of the COMPILED library in the main project, not in the WS. But if I change a source file making up the library it won't be compiled unless I have put the library PROJECT itself in the WS. So I need to include both projects in the WS (the main and the lib project) to have them compiled. Is that correct ?

2 - This is annoying, because I work with many different workspaces on different computers. That implies that each time I import a "main" project in a WS, I must know which static lib PROJECT goes with it and import it "manually". Otherwise, the lib will not be eventually updated, but just linked "as is". Is that correct ?

3 - It would be much more EFFICIENT to put a reference to the static lib PROJECT inside the main project, so the static lib would be compiled if something has changed in the static lib source files. As a side effect, loading the main project would be sufficient. But obviously, this feature seems not supported currently. Am I right ?

EDIT: I have just tested assumptions 1 and 2- they are correct.

IMPORTANT: I had errors after removing the static lib project from the WS because Smart Updates creates a path including the workspace itself, like "${workspace_loc:/LARM_LPC1769/Debug}" in the main project Library search path. I had to replace it by a relative path to the library file to get rid of this error, like "..\..\..\sw_LARM\prj_LPC1769\Debug".

I have also put the static library (lib*.a) files under version control, like regular source files, so I am confident that I will always link an updated object file to my main project. Now I can import the main project alone and build it. YESSS

I hope this can help other people.

I have loaded LPCxpresso 7.5.0 and I can now add the project to a "working set". Could this be a solution to have the main project and the lib project "together" outside of a WS ?

Regards,
Michel
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Dec 18 19:43:07 MST 2014
You can import existing projects without copying them  :O

Just disable  'Copy projects into workspace' option while importing an existing project...

Is that what you are looking for?
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Dec 18 15:00:37 MST 2014
Smart update is just adding Include /  Library settings in your project, not in the workspace  :)

0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Dec 18 14:47:07 MST 2014
How did you export the main project?
What is the build failure when you omit the steps?
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 14:32:57 MST 2014
Hi,

Thank you  a lot for you reply, but when I do following, it works :

1 - Create a new workspace
2 - Import a "main" project,
3  - Import a "static lib" project
4 - Do "Smart Update" and check the boxes
5 - Build : success

If I omit step 3 and 4, it won't build. That is why I assume that the dependency with the "static lib" project is managed in the Workspace itself.

All examples from NXP I have tested  (for example with CMSis) need to have the static library project imported in the WS "manually".

I am really puzzled - I am probably missing something, or what I am asking is really impossible in LPCxpresso.

Michel
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Dec 18 14:20:26 MST 2014
Projects contain all settings themselves, not in workspace. Look at the examples and you will projects with dependencies on libraries. They all import and export correctly.
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 14:13:57 MST 2014
Hello,

What is your name ? Are you a nameless robot ? If you don't tell me your name, I won't communicate with you anymore.

What I want to do is to import only the MAIN project in the workspace. That implies that the dependence with the library should be INSIDE the MAIN project and not in the WORKSPACE

If you do not understand what I want, please ask a colleague, I am sure he will understand my request.

Regards
Michel
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 18 08:31:06 MST 2014
I'm sorry, but I really do not understand what you are asking, and why.

Please explain very clearly EXACTLY what it is you want to do, and why.
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 08:18:32 MST 2014

Thanks for the link, but I know this by heart. As I told you this works.


Please just read this carefully :

0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 18 08:08:09 MST 2014
http://www.lpcware.com/content/faq/lpcxpresso/creating-linking-library-projects
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 07:50:11 MST 2014
I am sorry, but you will need to tell me exactly how I can do what you suggest.

I am using LPCxpresso 7.3.0
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 18 07:20:19 MST 2014
Why would you want to do that? Just reference the project in your main project (using the Linker path in the project settings). Do not include it in the project.
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MichelKuenemann on Thu Dec 18 07:00:34 MST 2014
Hello,

I would like to "include" the static library inside the main project, a bit like a linked folder.

Regards,
Michel
0 Kudos
Reply

3,330 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 18 04:11:56 MST 2014
Are you asking if the Library project can know which projects use it?
If yes, then no, this does not make any sense.
If not, please explain what it is you are trying to acheive.
0 Kudos
Reply