[Scons-users] Retrieving variables
Bill Deegan
bill at baddogconsulting.com
Tue Jun 14 14:32:50 EDT 2016
Stefan,
For what you want to do, you're probably best initializing tools=[] in your
Environment.
Then setting TARGET_ARCH, then env.Tool(...) for each/all the tools you
want to use.
Or just have a Environment(tools=[],variables=vars) just for retrieving the
value.
Why not use --arch= instead of arch=?
Also, why not use site_scons/ instead of bin.SCons ?
-Bill
On Tue, Jun 14, 2016 at 1:50 PM, Stefan Seefeld <stefan at seefeld.name> wrote:
> Hello,
>
> I'd like to support the following workflow to build my project:
>
>
> $ scons config --python=/path/to/python arch=x86_64
>
> $ scons
>
>
> where the first ('config') line collects build parameter, runs some
> config checks, and saves everything to a file, while the second line
> then simply picks those values up and does the actual build. Here is the
> code to achieve this:
>
>
> if 'config' in COMMAND_LINE_TARGETS:
> # Clear the cache
> try: os.remove('bin.SCons/config.py')
> except: pass
> if not os.path.exists('bin.SCons/'):
> os.mkdir('bin.SCons/')
> vars = Variables('bin.SCons/config.py', ARGUMENTS)
> ...
> env = Environment(toolpath=['config'],
> variables=vars,
> TARGET_ARCH=arch)
>
> ...
>
>
> This works reasonably well, but presents a little problem: I use an
> 'arch' variable to specify the architecture (typically either 'x86' ot
> 'x86_64'). On Windows this requires the TARGET_ARCH variable to be set
> when the Environment is constructed, so the appropriate msvc init script
> is executed.
>
> However, there doesn't appear any way to retrieve variables from the
> Variables() instance above, so I have no way to fetch the value to set
> it explicitly as I attempt above.
>
> Is this an oversight ? Any suggestion on how to do this instead ? (Is
> there a way to set the TARGET_ARCH flag after the Environment is created ?)
>
>
> Thanks,
>
> Stefan
>
>
> --
>
> ...ich hab' noch einen Koffer in Berlin...
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160614/4d5aaea6/attachment.html>
More information about the Scons-users
mailing list