@ -171,9 +171,17 @@ def detect_windows_arch(compilers):
for compiler in compilers . values ( ) :
for compiler in compilers . values ( ) :
# Check if we're using and inside an MSVC toolchain environment
# Check if we're using and inside an MSVC toolchain environment
if compiler . id == ' msvc ' and ' VCINSTALLDIR ' in os . environ :
if compiler . id == ' msvc ' and ' VCINSTALLDIR ' in os . environ :
# 'Platform' is only set when the target arch is not 'x86'.
if float ( compiler . get_toolset_version ( ) ) < 10.0 :
# It's 'x64' when targeting x86_64 and 'arm' when targeting ARM.
# On MSVC 2008 and earlier, check 'BUILD_PLAT', where
platform = os . environ . get ( ' Platform ' , ' x86 ' ) . lower ( )
# 'Win32' means 'x86'
platform = os . environ . get ( ' BUILD_PLAT ' , ' x86 ' )
if platform == ' Win32 ' :
return ' x86 '
else :
# On MSVC 2010 and later 'Platform' is only set when the
# target arch is not 'x86'. It's 'x64' when targeting
# x86_64 and 'arm' when targeting ARM.
platform = os . environ . get ( ' Platform ' , ' x86 ' ) . lower ( )
if platform == ' x86 ' :
if platform == ' x86 ' :
return platform
return platform
if compiler . id == ' gcc ' and compiler . has_builtin_define ( ' __i386__ ' ) :
if compiler . id == ' gcc ' and compiler . has_builtin_define ( ' __i386__ ' ) :