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

ronex chako ronex_89 at yahoo.in
Wed Jun 18 02:37:22 EDT 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140618/4b48b844/attachment.html>


More information about the Scons-users mailing list