[Scons-users] Linking a subset of common object files
Viktor Dick
viktordick86 at gmail.com
Thu Apr 28 04:27:01 EDT 2016
On 2016-04-28 09:53, Ale Strooisma wrote:
> This makes me think: this is precisely the kind of problem I use a smart
> build system for! Now I realize that figuring out the dependencies for
> linking is non-trivial. I noticed however that for each object file that
> needs to be linked, the main source file depends (directly or
> indirectly) on the a header file with the same name, save for the
> extension. And a dependency tree for those header files exists. Is there
> a way to use this?
Hi,
this discussion comes up every now and then. My current solution is to
create the dependency tree of which files to link within the SConstruct
file (which means that it is rebuild every time) by essentially calling
'g++ -MM' on each file, which returns a list of header files and then
looking if there are corresponding source files. At first this was quite
slow, but now I use multiple threads for this and it is reasonably fast.
Instead of calling 'g++ -MM' it mould also be possible to use the scons
scanner, but I found that it would sometimes be unable to correctly
resolve preprocessor directives ("#ifdef" works, but "#if A == B" doesn't).
At some point I wanted to write a wiki article about my solution, but I
somehow could not create an account at that time. At the moment I do not
have the time to do that, but I could try to reduce my solution to a MWE
and post in on this list.
Regards,
Viktor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160428/03bac548/attachment.pgp>
More information about the Scons-users
mailing list