Author Topic: Track lib changes ?  (Read 8389 times)

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Track lib changes ?
« on: September 09, 2010, 07:30:11 pm »
Hi !

First, I'm sorry if this subject has been discussed before, but I couldn't find anything related in the forum.
So here goes : currently, when you modify a .cpp or a .h file and press Ctrl+F9, Code::Blocks rebuilds the necessary files and links everything together.
My "problem" is : I'm developing a project that depends on several libraries that I wrote myself. From time to time, I need to do some adjustments in these libraries, so I do these changes and compile the library.
Now I need to test it in my main program. If I switch to the main program's project and press Ctrl+F9, C::B does nothing and tells me everything is up to date, while it is clearly not the case. Actually, I don't need C::B to compile any file : I just need to "link again".
I thought C::B would find out that the library file (.a) has changed, and links everything once again.

Right now, my solution is to go into one of the main project's code file, add a line jump and delete it right away. Then I press Ctrl+F9, and C::B compiles the "changed" file and links. But it's not handy at all.

Is there an option/button somewhere that I missed ? And if not, could it be implemented ?
Thanks for your time.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Track lib changes ?
« Reply #1 on: September 09, 2010, 07:38:35 pm »
External Dependency is the term used; I have not done it myself.

Top search returned is
http://forums.codeblocks.org/index.php/topic,12959.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #2 on: September 09, 2010, 07:57:21 pm »
You seem to be right !
That said, there seem to be a problem with this feature anyway.
I configured my main project to depend on 4 different other projects, but it seems to consider only 2 of them.
I think it comes from the name of the different build targets, which are different depending on the project.
Is there a way to fix this (anything but changing the target names, which I can't) ?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Track lib changes ?
« Reply #3 on: September 09, 2010, 08:17:05 pm »
Look at virtual targets
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline huzhongshan

  • Multiple posting newcomer
  • *
  • Posts: 109
Re: Track lib changes ?
« Reply #4 on: September 10, 2010, 12:38:50 am »
you have to set dependancy in the workspace. the dependancy is saved in workspace (not in the project .cbp).

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #5 on: September 10, 2010, 01:57:40 am »
Look at virtual targets
My main project has 4 different build targets : Win32_Release, Win32_Debug, Linux_Release, Linux_Debug.
The GUI library can handle 2 different graphics engine (Ogre3D and SFML), but the code is identical for both windows and linux. So I also have 4 targets : Release_SFML, Debug_SFML, Release_OGRE, Debug_OGRE.
Using virtual targets to create "Win32_Release" etc for the GUI library would certainly work, but makes no sense here.

you have to set dependancy in the workspace. the dependancy is saved in workspace (not in the project .cbp).
I do set my dependencies in the workspace, using Project -> Properties... -> [Project's dependencies...].
How would I do otherwise ? I need the other projects to be in the workspace in order to select them in the list :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: Track lib changes ?
« Reply #6 on: September 10, 2010, 09:41:56 am »
Kalith: the only answer we can give you (If I'm not missing something) is: patches are welcomed :)

A dialog like this [1] is required to so you can connect your targets...


[1] http://cdn.ww.ossdl.de/wp-content/uploads/2009/11/vs2008-configuration-manager-for-mysql.png
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #7 on: September 10, 2010, 02:50:29 pm »
That's what I was afraid of :)

Unfortunately, I'm no expert in wxWidget. Even if I could write something that looks like your link (would take me a few days maybe), it would certainly not be as clean and bullet/idiot proof as the rest of C::B.
I've never done anything serious with GUIs like these (QT, GTK, etc).

Anyway, I've done a quick sketch of what would work for me, as a replacement of the old dependency dialog :

Pick a project and a target on the left, then check all the targets/projects you want to depend on.

I'll take a look at C::B source code to see if I can get something running, but I don't promise anything.
Furthermore, a change like this one would imply changing the structure of the .workspace files, and I assume this is not a trivial operation.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: Track lib changes ?
« Reply #8 on: September 10, 2010, 03:33:38 pm »
In your GUI mock up how would you choose multiple dependencies?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Track lib changes ?
« Reply #9 on: September 10, 2010, 03:37:06 pm »
Anyway, I've done a quick sketch of what would work for me, as a replacement of the old dependency dialog :
I still believe this is possible with what we already have on board. A combination of virtual targets, dependencies between projects in a workspace, the order of targets in a project, the declaration to a target OS and external dependencies is IMHO all you need.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #10 on: September 10, 2010, 03:55:21 pm »
In your GUI mock up how would you choose multiple dependencies?
The right part of the dialog uses check boxes, so you can choose as many dependencies as you wish.
By the way, it could be the occasion to implement dependencies within a single project (as I've seen somewhere in the source code : it's in somebody's todo list).

I've had a quick glance at the project dependencies GUI source code and, as far as I can tel, it is all located in sdk/resources/project_deps.xrc, in an XML format I'm totally unfamiliar with. I'm afraid it would take me too much time to learn all this...

I still believe this is possible with what we already have on board. A combination of virtual targets, dependencies between projects in a workspace, the order of targets in a project, the declaration to a target OS and external dependencies is IMHO all you need.
I'm sorry, but I still fail to see how it would work in my situation (maybe because I don't fully understand what you mean, I'm not a native english speaker). Would you mind giving a small example ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Track lib changes ?
« Reply #11 on: September 10, 2010, 04:21:00 pm »
Would you mind giving a small example ?
What about setting up virtual targets e.g. WinRelease_OGRE and Win_ReleaseSFML etc.?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #12 on: September 10, 2010, 04:27:33 pm »
Well, specifying "OGRE" for the main project makes no sense because it cannot use anything else :)
And specifying "Win" or "Linux" for the GUI lib also makes no sense because the code is exactly the same regardless of the OS.

It can be done of course, but it seems more like a hack/trick to me. I'm developing a set of library and project that (I hope) will be used by other people, so I need the workspace to be as clear and clean as possible.

If it was only for me, I'd probably go for your solution though !

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Track lib changes ?
« Reply #13 on: September 10, 2010, 05:23:18 pm »
Well, specifying "OGRE" for the main project makes no sense because it cannot use anything else :)
Mmmmh... I still don't get it (it was a long day for me today...). Are you aware that you can do several virtual targets (VT's), not just one? All I am saying is that you create the VT just as you need it for the platform / library you want to compile. Then you add these VT's in all your projects and configure them to compile the relevant targets pr project as needed.

Of course selecting a wrong VT on a certain platform will fail, but if you do a plausible naming this should be clear.

In fact I have something similar. A library that can / should be compiled using three compilers, a core application who's content depends on the OS and several tools using the library that differ per platform. I was able to setup Virtual targets for every platform / combination that makes sense just fine.

For my understanding: Can you compile a list/table with the combinations you want to have?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Kalith

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Track lib changes ?
« Reply #14 on: September 10, 2010, 05:48:35 pm »
Are you aware that you can do several virtual targets (VT's), not just one?
Yes of course ;)

For my understanding: Can you compile a list/table with the combinations you want to have?
I simplified the problem and got rid of redundancy, but here is basically what it looks like :

(the "other project" is secondary, and remains in a different workspace, so I don't care about it for now)

A solution would be to do like Ogre3D : use different project for different targets.
They have a Linux and a Windows workspace for example. But that would render C::B's target system almost useless.