[Scons-users] SCon example for common build scenario
Dan Pidcock
dan.pidcock at googlemail.com
Tue Jun 17 05:25:38 EDT 2014
On 16 June 2014 20:12, ronex chako <ronex_89 at yahoo.in> wrote:
> On Monday, 16 June 2014 11:59 PM, ronex chako <ronex_89 at yahoo.in> wrote:
>
> Hi Dan,
>
> Thanks for sharing wondeful example and explaining my queries in detail,
> Kindly help me with few more questions as mentioned below:
>
> 1) How to copy contents of include directory of each module into another
> directory('headers_dir').
> How could I do this using scons ?
> I check copy function and tried to use it as follow:
> Default(Copy('module_1/include', 'headers_dir/module_1/include')) --
> But this wasn't working
> Here I have used Default because this should be done as default.
> This can be done using subprocess, Please suggest how could I do the
> same ?
>
> >>>>> It is working with Install function, why Copy method doesn't work
> there ?
>
I have only ever used Install. It looks like Copy has to be called
differently (with a Command builder): details are on
http://www.scons.org/doc/0.96.90/HTML/scons-user/c1805.html
> 2) Is it possible to call SConstruct file from another SConscript file ?
> I need to do this because suppose dir_1 is a general directory with
> SConscript which creates a libarary libdir_.
> Another dir_2 , also contains SConstruct and SConscript file, If dir_2
> build satndalone and it also need to use libdir_1, How this can be done.
> Directly calling SConscript of dir_1 might create problem like,
> in dir_1/src/SConscript:
> src_list = Globe(os.path.join(Dir('#').abspath, 'src', '*.cpp'))
> inc_list = Globe(os.path.join(Dir('#').abspath, 'inc', '*.h'))
>
What is the problem you are concerned about? I think calling the SConscript
of dir_1 from the SConstruct for dir_2 should work OK. Paths are usually
resolved in each SConscript. Did you try just using Glob('src/*.cpp')?
Mixing SCons file/directory objects with raw strings and os.path
manipulation is a recipe for pain and lots of time trying to debug your
scons scripts in my experience.
> 3) In Scon how source build can be made dependent on each header
> included in the source file(except system header files) ?
> how could it be implemnted for src_list['a.cpp', 'b.cpp', 'c.cpp'] and
> inc_list['a.h', 'b.h', 'c.h'] ?
> I am looking for the similar approach as in makefile, i.e. generating
> dependency files which can be read first before creating objects.
>
I think this is an area where SCons will cope without having to be told
dependencies. Did you try --debug=tree ? It should show you what is going
to be needed for the build of each object file. Generally .cpp should not
depend on .h files anyway - it is the object files that depend n both.
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140617/f965e41e/attachment.html>
More information about the Scons-users
mailing list