[Scons-users] VariantDir not working

Ronex Dicapriyo ronex_89 at yahoo.in
Sat Jun 28 13:53:42 EDT 2014


Hi,

Please look below for the SConstruct and SConscript implementation:


SConstruct:


env = Environment()

env.Append(TARGETDIR = 'build')

SConscript('SConscript', exports = 'env')


SConscript:
Import('env')

env.VariantDir(env['TARGETDIR'], 'src', duplicate=0)

src_list = Glob('src/*.cpp')

env.Program(target='hello', source=src_list)


I know, desire thing can be done by using varinat_dir in SConscript call, But I am working on a project of multiple sconscripts where some interdependecies is also present.

Suppose module_1 depends on module_2 and module_3 libraries:
Then in module_1/SConscript I need to bring/run first the library target of module_2 and module_3:

module_1/SConscript:
SConscript(['module_2/SConscript', 'module_3/SConscript'], export='env')
module_1_lib = env.StaticLibrary(target='module_1', source=src_files)
env.Depend(module_1_lib, module_2_lib)
env.Depend(module_1_lib, module_3_lib)

I think above implementaton of module_1/SConscript make sure to execute the 
module_2_lib and module_3_lib targets and then build library for module_1.

Here I need build directory should be created inside all the modules separately.(i.e module_1/build , module_2/build and module_2/build)


I found the above use of VariantDir in scons 2.31. user manual chapter-15, sections-4,5.



On Saturday, 28 June 2014 9:54 PM, Dirk Bächle <tshortik at gmx.de> wrote:
 


Hi Ronex,


On 28.06.2014 17:19, Ronex Dicapriyo wrote:

Hello,
>
>
>I am tring to use SConscript as follows, 
>
>SConscript(['dir_1/SConscript', 'dir_2/SConscript'], export=env)
>
>
>Here when SConscript of dir_1 executes, I want it to create objects, libraries etc... under "dir_1/build" directory:
>
>
>For that Inside dir_1/SConscript I am using VariantDir function as follows:
>
>
>Import ('env')
>
>VariantDir('build', 'src', duplicate=0)before calling any builder methods.
>
>
>
I have a question regarding your current setup. Where exactly did
    you find the syntax of VariantDir as you're using it? Can you please
    give an URL or the name of the file in the "docs" folder of SCons
    that served as your reference documentation in this case?

Additionally, it would help if you could copy-paste the full
    contents of your dir_1/SConscript to your next email.
Thanks a lot in advance for your answer.

Best regards,

Dirk



_______________________________________________
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/20140629/72ec2745/attachment-0002.html>


More information about the Scons-users mailing list