[Scons-users] [c++] Automatically choosing sources for linking
Dirk Bächle
tshortik at gmx.de
Fri Feb 28 10:57:26 EST 2014
Hi Viktor,
On 28.02.2014 16:21, Viktor Dick wrote:
> Hi.
> I am trying to create a SConstruct file that does not have to name any
> file explicitly. For this, I am restricting my project structure in the
> following way: the implementation of each function or method that is
> declared in somepath/somename.h can be found in somepath/somename.cpp
> (or something included therein). And every file that implements a main
> routine (I need to build multiple executables) starts with main_.
>
> The crucial point is to find the sources for the call to env.Program(),
> i.e. for each main_*.cpp file I need to find the list of .h files that
> are included there and I need to look if there is a .cpp file with the
> same name (essentially).
I'd do this in Python, right in your SConstruct/SConscript file.
Create a list of all "main_*.cpp" files, scan each one of them with a
simple regex for include statements and then compile the list of sources
from that.
Trying to map this process to SCons structures will probably not give
you the desired result. Just put the nice feature of SConstructs being
actual Python scripts to good use here...
Best regards,
Dirk
More information about the Scons-users
mailing list