[Scons-users] build dependencies question(s)
Dirk Bächle
tshortik at gmx.de
Fri Nov 16 08:50:12 EST 2012
Hi Nikola,
you should be able to achieve your goals without having to use special
methods like Depends().
On 16.11.2012 12:52, Nikola Radovanovic wrote:
> hi,
> i have a few question(s) regarding build order in SCons:
>
> if i have multiple Environments: say e1 and e2; where for example e1
> is a C++ dll and e2 is say PASCAL exe consuming C++ dll
>
> * is it possible to have 2 different SConscript files, each holding
> one of e's and SConstruct file calling SConscripts and
> synchronizing results. ie:
>
> s1 SConscript:
> e1 = Environment(...) # C++ dll build
> res = e1.SharedLibrary('test.dll', ...)
> Return('res')
>
> s2 SConscript:
> e2 = Environment(...) # PASCAL exe build
> res = e2.Program('test.exe', ...)
> Return('res')
>
> SConstruct
> res_2 = SConscript('s2')
> res_1 = SConscript('s1')
> Depends(res_2, res_1) # this will not help i presume?
>
You shouldn't have to use Depends() here and don't need the Return()
stuff either. If you have the following structure:
project
- SConstruct
mylib
- SConscript
- lib.cpp
myexe
- SConscript
- main.cpp
your build files could look like this:
SConstruct
---------------
SConscript('mylib/SConscript')
SConscript('myexe/SConscript')
mylib/SConscript
----------------------
e = Environment(...) # C++ dll build
e.SharedLibrary('mylib', 'lib.cpp')
myexe/SConscript
----------------------
e = Environment(...) # PASCAL exe build
e.Program('myprog', 'main.cpp', LIBS=['mylib'], LIBPATH=['#mylib'])
Like this, SCons automatically detects that it has to compile the
'mylib' library before trying to link against it.
Regard how I didn't use any suffixes for the SharedLibrary, I removed
the ".dll". Now SCons adds a ".dll" under Windows, but a ".so" under
Linux...the same holds for the name of the executable.
> i have deliberately wrote res_2 before res_1, but in reallity,
> i want s1 to be called and finished before s2. cant that be done?
>
> * is there any way to force execution order of different
> Environments()?
>
Don't try to enforce a special order for the single build steps. Try to
think of your build process as a large graph of dependencies and tell
SCons which targets depend on which sources. Then let SCons figure out
the rest...
> for some time i'm experimenting with SCons trying to find the way to
> improve our linux/windows build constisting out of C++, Delphi, JAVA
> code but with not much luck.
>
If you encounter more problems during your experiments, please continue
to ask questions. Regard that providing simple and working examples will
make it easier for us to understand your problems, so we can help you
much faster and better.
Best regards,
Dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20121116/cd6cf8ad/attachment.html>
More information about the Scons-users
mailing list