From d1318ee12c6c19bba899ce97e46a30c461ebac44 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Fri, 2 Mar 2018 14:51:29 -0500 Subject: Enable SCons to autodetect Windows MSVC compiler SCons has good compiler detection logic for MSVC compilers. Up to now, Godot hasn't used it; it depends on passed-in OS environment vars from a specific Visual Studio cmd.exe windows. This makes it harder to build from a msys or cygwin shell. This change allows SCons to autodetect Visual Studio unless it sees VCINSTALLDIR in the os.environ. It also adds a 'msvc_version' arg for manual specification of compiler version, and uses the existing 'bits' arg to specify the target architecture. More detail could be added as desired. It also adds 'use_mingw' to always use mingw, even if Visual Studio is installed. That uses the existing mingw setup logic. If people are used to building Godot in a Visual Studio cmd window, this should not change the behavior in that case, since VCINSTALLDIR will be set in those windows. (However, note that you could now unset that var and build with any other MSVC version or target arch, even in that window.) I refactored much of platform/windows/detect.py during this, to simplify and clarify the logic. I also cleaned up a bunch of env var settings in windows/detect.py and SConstruct to use modern SCons idioms and simplify things. I suspect this will also enable using the Intel compiler on Windows, though that hasn't been tested. --- platform/uwp/detect.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/uwp/detect.py') diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index f2c5c5d42e..d850ab9436 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -27,6 +27,8 @@ def can_build(): def get_opts(): return [ + ('msvc_version', 'MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.', None), + (BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False)), ] -- cgit v1.2.3