Ask Your Question
4

make without rebuilding everything everytime

asked 2012-11-21 22:41:07 -0500

In my package I defined a library which is linked to my executable.. the cmakelists file looks like this:

...
rosbuild_add_library(mylib src/lib_src.cpp) #in the real cmake I have lot of sources in the library
rosbuild_add_executable(myexe src/exe_src.cpp)
target_link_libraries(myexe mylib)
...

When I run make everything is compiled. But if I run make again, everything is compiled again, even if nothing was modified.

Is it possible to compile only the changed parts? In my case would be fine to recompile the changed executable without recompiling the unchanged (and huge) library.

Thanks

edit retag flag offensive close merge delete

Comments

Make should only compile your code if something changed. Without more information it's hard to guess a reason for the recompilation of everything.

Lorenz gravatar image Lorenz  ( 2012-11-21 23:03:31 -0500 )edit

Happy to hear that I am not expecting strange things :D which kind of information should I provide to help the debug?

Francesco Sacchi gravatar image Francesco Sacchi  ( 2012-11-21 23:37:53 -0500 )edit

For instance the actual snapshot in CMakeLists.txt you are using, not just something simplified. Also watch your clock and check the modification dates of your files. Are they maybe in the future?

Lorenz gravatar image Lorenz  ( 2012-11-22 00:42:45 -0500 )edit

heres my cmakelists: https://gist.github.com/4131480 timestamps are ok..

Francesco Sacchi gravatar image Francesco Sacchi  ( 2012-11-22 02:37:08 -0500 )edit

2 Answers

Sort by » oldest newest most voted
12

answered 2012-11-22 04:31:38 -0500

Finally, after hours I have an answer..

The problem is in the cfg files.

You must be sure that the filename matches the third parameter of the last line of the file, the one with the exit statement.

For example if the last line is:

exit(gen.generate(PACKAGE, "dummy", "myNameIsImportant"))

the file name must be myNameIsImportant.cfg

I did not find this information in the documentation/tutorials...

edit flag offensive delete link more

Comments

1

Good work! Feel free to add this information to the wiki and tutorials.

Lorenz gravatar image Lorenz  ( 2012-11-22 04:40:12 -0500 )edit

Yes, excellent find!

Martin Günther gravatar image Martin Günther  ( 2012-11-22 20:40:59 -0500 )edit
0

answered 2012-11-22 03:08:37 -0500

Lorenz gravatar image

One problem I see in your cmake file is the way you use rosbuild_add_library. Instead of calling it multiple times, you should call it only once with a list of all your source files as shown here. I'm not sure if that's the reason for your problems though.

edit flag offensive delete link more

Comments

That dido not fixed the issue.. I also removed everything apart from a single executable but it keeps compiling.. maybe is an issue with the dyn rec gen msg...

Francesco Sacchi gravatar image Francesco Sacchi  ( 2012-11-22 03:33:13 -0500 )edit

Yes. Could be. I think I've seen similar problems before when dynamic reconfigure was used but I'm not really sure.

Lorenz gravatar image Lorenz  ( 2012-11-22 03:43:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-11-21 22:41:07 -0500

Seen: 1,542 times

Last updated: Nov 22 '12