← Back to team overview

yade-dev team mailing list archive

Re: scons and automatic linking

 

Václav Šmilauer said:     (by the date of Mon, 16 Jul 2007 10:02:00 +0200)

> > 1. my proposal: grep source files for #include and link with those
> > files that are found after #include. Add a short table which contains
> > exceptions of this rule.
> > 
> > 2. Bruno's proposal: link with everything compiled so far.
> 
> For (1), I think grepping #includes is not 
> sufficient, since there may be nested includes and so on (?).


Hm, we should check that. I have impression that you only need to
link with the "top" library (skipping nested includes) because others
are linked automatically.


If it's not true - it still should be easy, becasue by grepping files
you will build in memory an array like this:

file1.cpp : list of files to link.
file2.cpp : list of files to link, and link to file1.cpp also.

You should be able to recursively 'extend' the linking information
for file2.cpp by reading the record stored at file1.cpp, and removing
duplicates. I've seen some function calls in python, and AFAIK
removing duplicates is a single function call... so I think that
shouldn't be too slow.

Only one global grep needed for compile. When file's md5sum change
update only information about this file.


> Some files may contain more than one class (like Clump contains ClumpTestGen,
> Clump, ClumpMemberMover).

As I said "add a short table which contains exceptions". 

But I must tell you that I really prefer to have single file for
single class. *Unless* other classes in a file.cpp are for internal
usage only. After talking with other people here (Luc, Wenji) I can
tell you that they prefer this too - it's easier to find a correct
file in kdevelop.

We can ask also what Bruno thinks about that, because I didn't ask him.


> Proper solution that I tried just on the command-line is list symbols in the 
> object file and determine what classes from yade it needs to be linked with; 
> then determine what file contains that class; then link. I am not sure how 
> to integrate that into scons and it is UNIX-specific (uses nm).
> 
> Conclusion: it is not straightforward and it will not happen in near future 
> in a robust way. I may play with that because I personally don't like that 
> either.

Please do that, do that, you are the scons master! ;-)


-- 
Janek Kozicki                                                         |
_______________________________________________
yade-dev mailing list
yade-dev@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-dev



Follow ups

References