X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=scons%2Fllvm.py;h=3fef9e0900d59b2cd57a719cbd5d69aa0571683c;hb=29a2e9133e415de8b010df5b80db758aaf1007a6;hp=01eae2403a7a79d89aa1b4bb036bcbe6e24004ab;hpb=4fb2daf42c8171579cdc18605c5ceeb1963f8b31;p=mesa.git diff --git a/scons/llvm.py b/scons/llvm.py index 01eae2403a7..3fef9e0900d 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: @@ -63,6 +65,7 @@ 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: + print 'scons: LLVM environment variable must be specified when building for windows' return # Try to determine the LLVM version from llvm/Config/config.h @@ -123,13 +126,17 @@ def generate(env): # Some of the LLVM C headers use the inline keyword without # defining it. env.Append(CPPDEFINES = [('inline', '__inline')]) - if env['debug']: + if env['build'] in ('debug', 'checked'): # LLVM libraries are static, build with /MT, and they # automatically link agains LIBCMT. When we're doing a # 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 + return + llvm_version = env.backtick('llvm-config --version').rstrip() llvm_version = distutils.version.LooseVersion(llvm_version) @@ -138,13 +145,11 @@ 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 - else: - env['LINK'] = env['CXX'] - else: - return + print 'scons: llvm-config version %s failed' % llvm_version + return assert llvm_version is not None + env['llvm'] = True print 'scons: Found LLVM version %s' % llvm_version env['LLVM_VERSION'] = llvm_version