summaryrefslogtreecommitdiff
path: root/scons/llvm.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-11-01 13:30:22 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-11-01 13:30:22 +0000
commit601498ae73e654c2de997ea75075613a694d604d (patch)
treefb1eb85143f5222b3c4b4d059276095e658506f5 /scons/llvm.py
parenta84bd587c68a48c675aae538934a0de48421ff08 (diff)
scons: Revamp how to specify targets to build.
Use scons target and dependency system instead of ad-hoc options. Now is simply a matter of naming what to build. For example: scons libgl-xlib scons libgl-gdi scons graw-progs scons llvmpipe and so on. And there is also the possibility of scepcified subdirs, e.g. scons src/gallium/drivers If nothing is specified then everything will be build. There might be some rough corners over the next days. Please bare with me.
Diffstat (limited to 'scons/llvm.py')
-rw-r--r--scons/llvm.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/scons/llvm.py b/scons/llvm.py
index 39fbb910b6d..1b033acb1b3 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -38,6 +38,8 @@ import SCons.Util
def generate(env):
+ env['llvm'] = False
+
try:
llvm_dir = os.environ['LLVM']
except KeyError:
@@ -64,13 +66,13 @@ def generate(env):
# XXX: There is no llvm-config on Windows, so assume a standard layout
if llvm_dir is None:
print 'scons: LLVM environment variable must be specified when building for windows'
- env.Exit(1)
+ return
# 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
- env.Exit(1)
+ return
llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
llvm_version = None
for line in open(llvm_config, 'rt'):
@@ -81,7 +83,7 @@ def generate(env):
break
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
- env.Exit(1)
+ return
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
@@ -133,7 +135,7 @@ def generate(env):
else:
if not env.Detect('llvm-config'):
print 'scons: llvm-config script not found' % llvm_version
- env.Exit(1)
+ return
llvm_version = env.backtick('llvm-config --version').rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
@@ -144,11 +146,12 @@ def generate(env):
env.ParseConfig('llvm-config --ldflags')
except OSError:
print 'scons: llvm-config version %s failed' % llvm_version
- env.Exit(1)
+ return
else:
env['LINK'] = env['CXX']
assert llvm_version is not None
+ env['llvm'] = True
print 'scons: Found LLVM version %s' % llvm_version
env['LLVM_VERSION'] = llvm_version