Commit dc099566 authored by Prodea Alexandru-Liviu's avatar Prodea Alexandru-Liviu Committed by Dylan Baker

scons: Fix MSYS2 Mingw-w64 build.

Reviewed-by: Jose Fonseca's avatarJose Fonseca <>

This patch is based on but with tweaks to avoid MSVC build break when applied.

v2: Create Mingw platform alias pointing to windows host platform define to avoid spurious crosscompilation;

v3: Fix obviously wrong compiler flags for swr driver;

v4: Update original patch URL because it has been relocated;

v5: Don't bother patching autools stuff as it's not used by MSYS2 Mingw-w64 build and it's days are numbered anyway;

v6: After Mingw posix flag fix in 295851eb things are far simpler as we don't need more linking of uuid, ole32, version and shell32 than what is already in place.
(cherry picked from commit ffb0d3a2)
parent 434ab094
......@@ -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',
......@@ -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
......@@ -217,6 +218,12 @@ def generate(env):
# Mingw-w64 zlib is required when building with LLVM support in MSYS2 environment
if host_platform.system().lower().startswith('mingw'):
env.Append(LIBS = [
if env['msvc']:
# Some of the LLVM C headers use the inline keyword without
# defining it.
......@@ -214,7 +214,7 @@ env.Prepend(CPPPATH = [
envavx = env.Clone()
if env['platform'] == 'windows':
if env['msvc']:
envavx.Append(CCFLAGS = ['/arch:AVX'])
envavx.Append(CCFLAGS = ['-mavx'])
......@@ -230,7 +230,7 @@ env.Alias('swrAVX', swrAVX)
envavx2 = env.Clone()
if env['platform'] == 'windows':
if env['msvc']:
envavx2.Append(CCFLAGS = ['/arch:AVX2'])
envavx2.Append(CCFLAGS = ['-mavx2', '-mfma', '-mbmi2', '-mf16c'])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment