summaryrefslogtreecommitdiff
path: root/scons
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-04-10 02:41:39 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-04-11 17:17:34 +0900
commitea532f0e725bd68e7784189c9b7f6f7bf7f9d901 (patch)
tree1b318d82380b08fb3f602597b61d797a2f5656bd /scons
parent9fc93b80413d63aeb08b5a17602d111ed3899faf (diff)
scons: Make LLVM a black-white dependency.
Now that draw depends on llvm it is very difficult to correctly handle broken llvm installations. Either the user requests LLVM and it needs to supply a working installation. Or it doesn't, and it gets no LLVM accelerate pipe drivers.
Diffstat (limited to 'scons')
-rw-r--r--scons/gallium.py6
-rw-r--r--scons/llvm.py18
2 files changed, 15 insertions, 9 deletions
diff --git a/scons/gallium.py b/scons/gallium.py
index 925effc25d..dd7275460d 100644
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -142,8 +142,6 @@ def generate(env):
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
- if env['llvm']:
- build_subdir += "-llvm"
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['debug']:
@@ -471,6 +469,10 @@ def generate(env):
# Default libs
env.Append(LIBS = [])
+ # Load LLVM
+ if env['llvm']:
+ env.Tool('llvm')
+
# Custom builders and methods
env.Tool('custom')
createInstallMethods(env)
diff --git a/scons/llvm.py b/scons/llvm.py
index 01eae2403a..d88d6e3a5a 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -63,13 +63,14 @@ def generate(env):
if env['platform'] == 'windows':
# XXX: There is no llvm-config on Windows, so assume a standard layout
if llvm_dir is None:
- return
+ print 'scons: LLVM environment variable must be specified when building for windows'
+ env.Exit(1)
# Try to determine the LLVM version from llvm/Config/config.h
llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
if not os.path.exists(llvm_config):
print 'scons: could not find %s' % llvm_config
- return
+ env.Exit(1)
llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
llvm_version = None
for line in open(llvm_config, 'rt'):
@@ -80,7 +81,7 @@ def generate(env):
break
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
- return
+ env.Exit(1)
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
@@ -129,7 +130,11 @@ def generate(env):
# debug build we'll be linking against LIBCMTD, so disable
# that.
env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
- elif env.Detect('llvm-config'):
+ else:
+ if not env.Detect('llvm-config'):
+ print 'scons: llvm-config script not found' % llvm_version
+ env.Exit(1)
+
llvm_version = env.backtick('llvm-config --version').rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
@@ -138,11 +143,10 @@ def generate(env):
env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
env.ParseConfig('llvm-config --ldflags')
except OSError:
- print 'llvm-config version %s failed' % llvm_version
+ print 'scons: llvm-config version %s failed' % llvm_version
+ env.Exit(1)
else:
env['LINK'] = env['CXX']
- else:
- return
assert llvm_version is not None