[Scons-users] build dependencies question(s)

Bill Deegan bill at baddogconsulting.com
Mon Nov 19 01:45:02 EST 2012


Nikola,

On Sun, Nov 18, 2012 at 10:18 PM, Nikola Radovanovic <
nikola.radovanovic at schneider-electric-dms.com> wrote:


> 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?

>


outNodes = env.SomeIDLBUILDER('IDL/a.idl')
for f in outNodes:
if str(f).endswith('.h'):
env.Install('INC',f)
else:
env.Install('src',f)

Or something like that.
Don't ever worry about order when using SCons. (This is the most common
mistake people make when moving to SCons from some other build system)
You just need to specify the source and the targets right, and SCons will
figure out the order for you.

-Bill




>

> 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 listScons-users at scons.orghttp://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* | Site: *

> www.schneider-electric-dms.com* | Address:* Narodnog fronta 25A-D, 21000

> Novi Sad****

>

> *** Please consider the environment before printing this e-mail****

>

> ** **

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20121118/f33915b5/attachment.htm>


More information about the Scons-users mailing list