Commit 5c682485 authored by Brian Paul's avatar Brian Paul

scons: fix llvm detection

The test for env['platform'] caused an exception since 'env' is not
defined at that point.  Instead, determine the target platform by
scanning sys.argv[].
parent 846b2fcc
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import os import os
import os.path import os.path
import re
import subprocess import subprocess
import sys import sys
import platform as _platform import platform as _platform
...@@ -37,9 +38,18 @@ default_machine = _machine_map.get(default_machine, 'generic') ...@@ -37,9 +38,18 @@ default_machine = _machine_map.get(default_machine, 'generic')
if 'LLVM' in os.environ: if 'LLVM' in os.environ:
default_llvm = 'yes' default_llvm = 'yes'
else: else:
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
platform = default_platform
pattern = re.compile("(platform=)(.*)")
for arg in sys.argv:
m = pattern.match(arg)
if m:
platform = m.group(2)
default_llvm = 'no' default_llvm = 'no'
try: try:
if env['platform'] != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0: if platform != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
default_llvm = 'yes' default_llvm = 'yes'
except: except:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment