2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-24 18:59:39 +01:00

Update c_nec and c_emscripten

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

View File

@ -1,11 +1,11 @@
#!/usr/bin/env python
# -*- 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.Configure import conf
from waflib.TaskGen import after_method, feature
from waflib.Tools.compiler_c import c_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
"""
dummy = conf.cachedir.parent.make_node("waf-emscripten.c")
dummy.write("")
cmd = cc + ['-dM', '-E', '-x', 'c', dummy.abspath()]
env = conf.env.env or None
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
out = p.communicate()[0]
except Exception as 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')
out, err = conf.cmd_and_log(cmd, output=0, env=env)
except Errors.WafError as e:
conf.fatal('Could not determine the emscripten version %r: %s' % (cmd, e))
k = {}
out = out.splitlines()

View File

@ -7,7 +7,7 @@ NEC SX Compiler for SX vector systems
"""
import re
from waflib import Utils
from waflib import Errors, Utils
from waflib.Tools import ccroot,ar
from waflib.Configure import conf
@ -26,8 +26,11 @@ def find_sxc(conf):
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
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:
match = version_re(out)