[Scons-users] Different variant_dir value in SConscript builder methods

Dan Pidcock dan.pidcock at googlemail.com
Thu Jun 19 03:28:43 EDT 2014


One way would be to pass the type of library (static/shared) into the
SConscript and call the SConscript four times with each possible variant,
changing your SConscript so that it builds one library of the correct type
each time. I don't think there's any particular SCons way of doing it, it's
up to you to find a way.
On 19 Jun 2014 06:27, "Ronex Dicapriyo" <ronex_89 at yahoo.in> wrote:

> Hello,
>
> Please help with any suggestion/help on my query.
>
> Regards,
> Ronex
>
>
>   On Wednesday, 18 June 2014 12:10 PM, ronex chako <ronex_89 at yahoo.in>
> wrote:
>
>
> Hello,
>
> I need to use scons to generate release and debug build for a large
> project. For both release and debug build it generates shared and static
> library. After the build the directory structure should look as follows:
> project_dir/
>    |_ src
>    |_ include
>    |_ lib
>       |_ lib_rel
>       |_ lib_dbg
>    |_ dll
>       |_ dll_rel
>       |_ dll_dbg
>
> How could I implement SConstruct an SConscript adhere with above
> requirement ?
>
> SConstruct Implementation:
> env = Environment()
> relEnv = env.clone(CCFLAGS = ['-O3', '-pthread')]
> dbgEnv = env.clone(CCFLAGS = ['-O0', '-g', '-pthread')]
> SConscript(dirs = 'src', name = 'SConscript',  exports = {'env' : relEnv},
> variant_dir = 'lib_rel', duplicate = 0)
> SConscript(dirs = 'src', name = 'SConscript',  exports = {'env' : dbgEnv},
> variant_dir = 'lib_dbg', duplicate = 0)
>
> src/SConscript Implementation:
>
> Import('env')
> src_list = Glob('*.cpp')
> inc_list = ['dir_1/include', 'dir_2/include', 'common/include']
> env.SharedLibrary(target = , source = src_list, CPP_PATH=inc_list)
> env.StaticLibrary(target = , source = src_list, CPP_PATH=inc_list)
>
> With above implementation it could generate shared and static library in
> lib_rel folder and also related object files, Is there any way that I can
> use variant dir in SharedLibrary and StaticLibrary method so that for
> shared library it use target directory as {dll/lib_rel , dll/lib_dbg} and
> And for StaticLibrary call it uses variant_dir as {lib/lib_rel, lib/lib_dbg}
>
> One approach that can be possible is to have separate SConscript for
> SharedLibrary and StaticLibrary. But it would be cumbersome to manage to
> SConscript and looks very noxious implementation.
>
> Kindly suggest proper solution for this.
>
> Best Regards,
> Ronex
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> 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/20140619/3436cc6c/attachment.html>


More information about the Scons-users mailing list