diff --git a/scons/gallium.py b/scons/gallium.py index 9381f804a31..b216304170f 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -237,6 +237,9 @@ def generate(env): hosthost_platform = host_platform.system().lower() if hosthost_platform.startswith('cygwin'): hosthost_platform = 'cygwin' + # Avoid spurious crosscompilation in MSYS2 environment. + if hosthost_platform.startswith('mingw'): + hosthost_platform = 'windows' host_machine = os.environ.get('PROCESSOR_ARCHITEW6432', os.environ.get('PROCESSOR_ARCHITECTURE', host_platform.machine())) host_machine = { 'x86': 'x86', diff --git a/scons/llvm.py b/scons/llvm.py index 33505f79447..fc128ab1e68 100644 --- a/scons/llvm.py +++ b/scons/llvm.py @@ -30,6 +30,7 @@ Tool-specific initialization for LLVM import os import os.path import re +import platform as host_platform import sys import distutils.version @@ -192,6 +193,12 @@ def generate(env): 'uuid', ]) + # Mingw-w64 zlib is required when building with LLVM support in MSYS2 environment + if host_platform.system().lower().startswith('mingw'): + env.Append(LIBS = [ + 'z', + ]) + if env['msvc']: # Some of the LLVM C headers use the inline keyword without # defining it. diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index 61432a0c342..1230cbb5b77 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -214,7 +214,7 @@ env.Prepend(CPPPATH = [ envavx = env.Clone() envavx.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX']) -if env['platform'] == 'windows': +if env['msvc']: envavx.Append(CCFLAGS = ['/arch:AVX']) else: envavx.Append(CCFLAGS = ['-mavx']) @@ -230,7 +230,7 @@ env.Alias('swrAVX', swrAVX) envavx2 = env.Clone() envavx2.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX2']) -if env['platform'] == 'windows': +if env['msvc']: envavx2.Append(CCFLAGS = ['/arch:AVX2']) else: envavx2.Append(CCFLAGS = ['-mavx2', '-mfma', '-mbmi2', '-mf16c'])