[Scons-users] Building mixed architectures with SCons on Windows with VisualStudio
Thomas Berg
merlin66b at gmail.com
Tue Aug 4 11:41:15 EDT 2015
Hi,
I think this already works like you are hoping it should work. You can
construct different scons environments, and pass in the wanted architecture
(and even Visual Studio version) on construction. So you can build both 32
and 64 bit binaries, even for multiple Visual Studio versions at the same
time, in the same build. Environment variables for the compiler commands
are set up per environment with scons, so this is already handled. You
don't need to run scons from a Visual Studio shell, and unless you
explicitly propagate shell environment variables yourself, scons completely
ignores the shell environment anyway and sets up the subcommand environment
by other means.
I'm using something similar to this code to create my environments:
tools = ['mssdk', 'mslink', 'msvc', 'mslib', 'msvs', 'install']
env1 = Environment(tools = tools, MSVC_VERSION = '11.0', TARGET_ARCH =
'x86')
env2 = Environment(tools = tools, MSVC_VERSION = '12.0', TARGET_ARCH =
'amd64')
Now, if you set up variantdirs and install the results to unique paths you
can build the same program once with each environment and get both variants
in the same build.
I think you are right that scons performs a global detection of Visual
Studio, but this is just some setup which detects all installed versions.
The actual version and architecture used is determined independently for
each Environment object.
Hope this helps,
Thomas
On Tue, Aug 4, 2015 at 5:22 PM, <mg at ncp-e.com> wrote:
> Hi,
>
> I'd like to build x86 and amd64 binaries in one build run with SCons
> under Windows using Visual Studio.
>
> I've done something similar under Linux to support a host and a target
> toolchain. This was rather simple, just using a different Environment
> with some changed variables for CC and so on.
>
> On Windows things seem much more complicated. The MSVC detection in
> SCons seems to be a global thing that only runs once. Also the visual
> studio requires a bunch of environment variables and what not to
> working correctly.
>
> Building for both architectures is required partly due to limitations
> in third party products and because we want to ship combined installers
> that can install both x86 and amd64 versions of the software.
>
> Does anyone have suggestions on how to get this smartly done in SCons?
>
> Kind regards
>
> Matthias
>
> --
> Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
> Entwicklung
>
> NCP engineering GmbH
> Dombühler Straße 2, D-90449, Nürnberg
> Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg
>
> Telefon: +49 911 9968-153, Fax: +49 911 9968-229
> E-Mail: Matthias.Gerstner at ncp-e.com
> Internet: http://www.ncp-e.com
>
> _______________________________________________
> 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/20150804/713a74e6/attachment-0001.html>
More information about the Scons-users
mailing list