[Scons-users] build dependencies question(s)
Nikola Radovanovic
nikola.radovanovic at schneider-electric-dms.com
Mon Nov 19 01:18:40 EST 2012
i think i now understand some global SCons dependency rules. what i'm desperate to achieve is to do the following:
i have bunch of idl files in some folder called IDL. i want to call IDL builder, 'build' proper cpps and headers, move cpps to SRC and includes to INC folder.after this step i want to compile regulary.
expected folder layout (after build) is:
IDL
a.idl
b.idl
SRC
a.cpp
aDynSK.cpp
b.cpp
bDynSK.cpp
INC
a.h
b.h
how can i achieve this?i know how to write IDL builder, but i must wait with moves (i have 2 moves: for cpp and h files) to IDL to finish.
do i have to use phoney targets, SideEffect(), Depends() or something else?
thanks in advance
On 11/16/2012 02:50 PM, Dirk Bächle wrote:
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
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
http://four.pairlist.net/mailman/listinfo/scons-users
--
__________________________________________________________________________________________________________________
Nikola Radovanovic | Schneider Electric DMS NS | Smart Grid IT | SERBIA | CPASv2 team deputy
Phone: +381 (0)21 488 3633 | Fax: +381 (0)21 488 3789 | Mobile: +381 (0)64 29 74 528
Email: nikola.radovanovic at schneider-electric-dms.com<mailto:nikola.radovanovic at schneider-electric-dms.com> | Site: www.schneider-electric-dms.com<http://www.schneider-electric-dms.com/> | Address: Narodnog fronta 25A-D, 21000 Novi Sad
*** Please consider the environment before printing this e-mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20121119/999da5ad/attachment.html>
More information about the Scons-users
mailing list