[Mesa-dev] [PATCH] scons: Recognize LLVM_CONFIG environment variable.
Emil Velikov
emil.l.velikov at gmail.com
Wed Nov 23 14:08:16 UTC 2016
On 23 November 2016 at 01:23, Vinson Lee <vlee at freedesktop.org> wrote:
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> scons/llvm.py | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/scons/llvm.py b/scons/llvm.py
> index 977e47a..a27bf00 100644
> --- a/scons/llvm.py
> +++ b/scons/llvm.py
> @@ -194,11 +194,16 @@ def generate(env):
> # that.
> env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
> else:
> - if not env.Detect('llvm-config'):
> + if os.environ.has_key('LLVM_CONFIG'):
> + env['LLVM_CONFIG'] = os.environ['LLVM_CONFIG']
> + else:
> + env['LLVM_CONFIG'] = 'llvm-config'
> +
> + if not env.Detect(env['LLVM_CONFIG']):
> print 'scons: llvm-config script not found'
> return
>
> - llvm_version = env.backtick('llvm-config --version').rstrip()
> + llvm_version = env.backtick('%s --version' % env['LLVM_CONFIG']).rstrip()
> llvm_version = distutils.version.LooseVersion(llvm_version)
>
> if llvm_version < distutils.version.LooseVersion(required_llvm_version):
> @@ -208,7 +213,7 @@ def generate(env):
> try:
> # Treat --cppflags specially to prevent NDEBUG from disabling
> # assertion failures in debug builds.
> - cppflags = env.ParseFlags('!llvm-config --cppflags')
> + cppflags = env.ParseFlags('!%s --cppflags' % env['LLVM_CONFIG'])
> try:
> cppflags['CPPDEFINES'].remove('NDEBUG')
> except ValueError:
> @@ -216,16 +221,16 @@ def generate(env):
> env.MergeFlags(cppflags)
>
> # Match llvm --fno-rtti flag
> - cxxflags = env.backtick('llvm-config --cxxflags').split()
> + cxxflags = env.backtick('%s --cxxflags' % env['LLVM_CONFIG']).split()
> if '-fno-rtti' in cxxflags:
> env.Append(CXXFLAGS = ['-fno-rtti'])
>
> components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler', 'irreader']
>
> - env.ParseConfig('llvm-config --libs ' + ' '.join(components))
> - env.ParseConfig('llvm-config --ldflags')
> + env.ParseConfig('%s --libs ' % env['LLVM_CONFIG'] + ' '.join(components))
> + env.ParseConfig('%s --ldflags' % env['LLVM_CONFIG'])
> if llvm_version >= distutils.version.LooseVersion('3.5'):
> - env.ParseConfig('llvm-config --system-libs')
> + env.ParseConfig('%s --system-libs' % env['LLVM_CONFIG'])
> env.Append(CXXFLAGS = ['-std=c++11'])
> except OSError:
> print 'scons: llvm-config version %s failed' % llvm_version
Please update this message as well. With that
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Can you send a patch for swr (src/gallium/drivers/swr/SConscript) as
well please ?
Emil
More information about the mesa-dev
mailing list