2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-28 21:10:33 +01:00

Update c_nec and c_emscripten

This commit is contained in:
Waf Project 2024-04-16 00:23:53 +02:00
parent a7d05142c5
commit e0dcfae373
2 changed files with 11 additions and 13 deletions

View File

@ -1,11 +1,11 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 vi:ts=4:noexpandtab # -*- coding: utf-8 vi:ts=4:noexpandtab
import subprocess, shlex, sys import shlex
from waflib import Errors
from waflib.Tools import ccroot, gcc, gxx from waflib.Tools import ccroot, gcc, gxx
from waflib.Configure import conf from waflib.Configure import conf
from waflib.TaskGen import after_method, feature
from waflib.Tools.compiler_c import c_compiler from waflib.Tools.compiler_c import c_compiler
from waflib.Tools.compiler_cxx import cxx_compiler from waflib.Tools.compiler_cxx import cxx_compiler
@ -20,19 +20,14 @@ def get_emscripten_version(conf, cc):
""" """
Emscripten doesn't support processing '-' like clang/gcc Emscripten doesn't support processing '-' like clang/gcc
""" """
dummy = conf.cachedir.parent.make_node("waf-emscripten.c") dummy = conf.cachedir.parent.make_node("waf-emscripten.c")
dummy.write("") dummy.write("")
cmd = cc + ['-dM', '-E', '-x', 'c', dummy.abspath()] cmd = cc + ['-dM', '-E', '-x', 'c', dummy.abspath()]
env = conf.env.env or None env = conf.env.env or None
try: try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) out, err = conf.cmd_and_log(cmd, output=0, env=env)
out = p.communicate()[0] except Errors.WafError as e:
except Exception as e: conf.fatal('Could not determine the emscripten version %r: %s' % (cmd, e))
conf.fatal('Could not determine emscripten version %r: %s' % (cmd, e))
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding or 'latin-1')
k = {} k = {}
out = out.splitlines() out = out.splitlines()

View File

@ -7,7 +7,7 @@ NEC SX Compiler for SX vector systems
""" """
import re import re
from waflib import Utils from waflib import Errors, Utils
from waflib.Tools import ccroot,ar from waflib.Tools import ccroot,ar
from waflib.Configure import conf from waflib.Configure import conf
@ -26,8 +26,11 @@ def find_sxc(conf):
def get_sxc_version(conf, fc): def get_sxc_version(conf, fc):
version_re = re.compile(r"C\+\+/SX\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search version_re = re.compile(r"C\+\+/SX\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
cmd = fc + ['-V'] cmd = fc + ['-V']
p = Utils.subprocess.Popen(cmd, stdin=False, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=None)
out, err = p.communicate() try:
out, err = conf.cmd_and_log(cmd, output=0)
except Errors.WafError:
conf.fatal('Could not determine an sxcc version %r' % cmd)
if out: if out:
match = version_re(out) match = version_re(out)