Mesa (master): scons: Hack LLVM support on Windows.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Oct 22 18:12:29 UTC 2009


Module: Mesa
Branch: master
Commit: bf48447cafc8069839ad41c9c11078c794f4b307
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf48447cafc8069839ad41c9c11078c794f4b307

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Oct 22 19:11:48 2009 +0100

scons: Hack LLVM support on Windows.

Doesn't quite work yet though, as small differences in the compilation flags
used when building LLVM and Mesa cause link failures for STL symbols.

---

 scons/llvm.py |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index d3293bb..73e9310 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -29,6 +29,7 @@ Tool-specific initialization for LLVM
 
 import os
 import os.path
+import sys
 
 import SCons.Errors
 import SCons.Util
@@ -39,7 +40,7 @@ def generate(env):
         llvm_dir = os.environ['LLVM']
     except KeyError:
         # Do nothing -- use the system headers/libs
-        pass
+        llvm_dir = None
     else:
         if not os.path.isdir(llvm_dir):
             raise SCons.Errors.InternalError, "Specified LLVM directory not found"
@@ -57,7 +58,47 @@ def generate(env):
 
         env.PrependENVPath('PATH', llvm_bin_dir)
 
-    if env.Detect('llvm-config'):
+    if env['msvc']:
+        # XXX: There is no llvm-config on Windows, so assume a standard layout
+        if llvm_dir is not None:
+            env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
+            env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
+            env.Prepend(LIBS = [
+                'LLVMBitWriter',
+                'LLVMCore',
+                'LLVMSupport',
+                'LLVMSystem',
+                'LLVMSupport',
+                'LLVMSystem',
+                'LLVMCore',
+                'LLVMCodeGen',
+                'LLVMSelectionDAG',
+                'LLVMAsmPrinter',
+                'LLVMBitReader',
+                'LLVMBitWriter',
+                'LLVMTransformUtils',
+                'LLVMInstrumentation',
+                'LLVMScalarOpts',
+                'LLVMipo',
+                'LLVMHello',
+                'LLVMLinker',
+                'LLVMAnalysis',
+                'LLVMipa',
+                'LLVMX86CodeGen',
+                'LLVMX86AsmPrinter',
+                'LLVMExecutionEngine',
+                'LLVMInterpreter',
+                'LLVMJIT',
+                'LLVMTarget',
+                'LLVMAsmParser',
+                'LLVMDebugger',
+                'LLVMArchive',
+                'imagehlp',
+                'psapi',
+            ])
+            env['LLVM_VERSION'] = '2.5'
+        return
+    elif env.Detect('llvm-config'):
         version = env.backtick('llvm-config --version').rstrip()
 
         try:




More information about the mesa-commit mailing list