Skip to content

Commit c317013

Browse files
committed
SCons: incorrect compiler detection on msystem based environments
As described in issue godotengine#1672 msys2 environments don't use a mingw prefix for their compiler binaries. this patch detects MSYSTEM environment variable detects compilers directly
1 parent 13cd2d9 commit c317013

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tools/windows.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import common_compiler_flags
55
import my_spawn
6-
from SCons.Tool import mingw, msvc
6+
from SCons.Tool import mingw, msvc, clangxx, clang
77
from SCons.Variables import BoolVariable
88

99

@@ -73,14 +73,17 @@ def spawn_capture(sh, escape, cmd, args, env):
7373

7474

7575
def options(opts):
76-
mingw = os.getenv("MINGW_PREFIX", "")
76+
msystem = os.getenv("MSYSTEM", "")
77+
mingw_prefix=""
78+
if not msystem:
79+
mingw_prefix = os.getenv("MINGW_PREFIX", "")
7780

7881
opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
7982
opts.Add(BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True))
8083
opts.Add(BoolVariable("silence_msvc", "Silence MSVC's cl/link stdout bloat, redirecting errors to stderr.", True))
8184
opts.Add(BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False))
8285
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler (MVSC or MinGW depending on the use_mingw flag)", False))
83-
opts.Add("mingw_prefix", "MinGW prefix", mingw)
86+
opts.Add("mingw_prefix", "MinGW prefix", mingw_prefix)
8487

8588

8689
def exists(env):
@@ -132,7 +135,12 @@ def generate(env):
132135

133136
elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
134137
env["use_mingw"] = True
135-
mingw.generate(env)
138+
if env["use_llvm"]:
139+
clang.generate(env)
140+
clangxx.generate(env)
141+
else:
142+
mingw.generate(env)
143+
136144
# Don't want lib prefixes
137145
env["IMPLIBPREFIX"] = ""
138146
env["SHLIBPREFIX"] = ""

0 commit comments

Comments
 (0)