Mesa (staging/19.2): scons/windows: Support build with LLVM 9.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 30 16:13:22 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: a413b55157d0469f1a01f132bac62dbcddff4e14
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a413b55157d0469f1a01f132bac62dbcddff4e14

Author: pal1000 <liviuprodea at yahoo.com>
Date:   Fri Sep  6 17:34:30 2019 +0300

scons/windows: Support build with LLVM 9.

As X86AsmPrinter component is gone, LLVMX86AsmPrinter got replaced
with LLVMRemarks, LLVMBitstreamReader and LLVMDebugInfoDWARF.

Tests done with llvm-config on both LLVM 8 and 9 indicate that
mcjit, bitwriter and x86asmprinter fully fit inside engine component.

On other platforms and with meson build mcdisassembler was used to replace
X86AsmPrinter but mcdisassembler also fully fits inside engine component
for LLVM>=8 according to same tests.

v2: Avoid duplicating code related to Mingw pthreads.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

Cc: 19.1 19.2 <mesa-stable at lists.freedesktop.org>

On 19.1 this patch does not apply cleanly without 88eb2a1f

(cherry picked from commit bcb4dfb14ba1cbbbd43cb6466fb7f73e5dd98513)

---

 scons/llvm.py | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index 1aade4b71d9..386f89e4772 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -101,8 +101,36 @@ def generate(env):
 
         env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
         env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
-        # LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter irreader`
-        if llvm_version >= distutils.version.LooseVersion('5.0'):
+
+        # LLVM 5.0 and newer requires MinGW w/ pthreads due to use of std::thread and friends.
+        if llvm_version >= distutils.version.LooseVersion('5.0') and env['crosscompile']:
+            assert env['gcc']
+            env.AppendUnique(CXXFLAGS = ['-posix'])
+
+        # LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter irreader` for LLVM<=7.0
+        # and `llvm-config --libs engine irreader` for LLVM>=8.0
+        # LLVMAggressiveInstCombine library part of engine component can be safely omitted as it's not used.
+        if llvm_version >= distutils.version.LooseVersion('9.0'):
+            env.Prepend(LIBS = [
+                'LLVMX86Disassembler', 'LLVMX86AsmParser',
+                'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+                'LLVMDebugInfoCodeView', 'LLVMCodeGen',
+                'LLVMScalarOpts', 'LLVMInstCombine',
+                'LLVMTransformUtils',
+                'LLVMBitWriter', 'LLVMX86Desc',
+                'LLVMMCDisassembler', 'LLVMX86Info',
+                'LLVMX86Utils',
+                'LLVMMCJIT', 'LLVMExecutionEngine', 'LLVMTarget',
+                'LLVMAnalysis', 'LLVMProfileData',
+                'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+                'LLVMBitReader', 'LLVMMC', 'LLVMCore',
+                'LLVMSupport',
+                'LLVMIRReader', 'LLVMAsmParser',
+                'LLVMDemangle', 'LLVMGlobalISel', 'LLVMDebugInfoMSF',
+                'LLVMBinaryFormat',
+                'LLVMRemarks', 'LLVMBitstreamReader', 'LLVMDebugInfoDWARF',
+            ])
+        elif llvm_version >= distutils.version.LooseVersion('5.0'):
             env.Prepend(LIBS = [
                 'LLVMX86Disassembler', 'LLVMX86AsmParser',
                 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
@@ -121,10 +149,6 @@ def generate(env):
                 'LLVMDemangle', 'LLVMGlobalISel', 'LLVMDebugInfoMSF',
                 'LLVMBinaryFormat',
             ])
-            if env['platform'] == 'windows' and env['crosscompile']:
-                # LLVM 5.0 requires MinGW w/ pthreads due to use of std::thread and friends.
-                assert env['gcc']
-                env.AppendUnique(CXXFLAGS = ['-posix'])
         elif llvm_version >= distutils.version.LooseVersion('4.0'):
             env.Prepend(LIBS = [
                 'LLVMX86Disassembler', 'LLVMX86AsmParser',




More information about the mesa-commit mailing list