2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

Update outdated playground examples

This commit is contained in:
Waf Project 2024-04-07 19:34:00 +02:00
parent 76f416ca14
commit a7d05142c5
27 changed files with 11 additions and 787 deletions

View File

@ -1 +0,0 @@
World.SayHello()

View File

@ -1,3 +0,0 @@
class World:
static def SayHello():
print "hello from boo"

View File

@ -1,6 +0,0 @@
public class World {
public static void SayHello()
{
System.Console.WriteLine("Hello from C#");
}
}

View File

@ -1,49 +0,0 @@
#! /usr/bin/env python
##
# This wscript shows the power of the CLI!
# You have an hello.exe using a world.dll,
# the world.dll can be generating using
# world.cs (in C#) or world.boo.
top = '.'
out = 'build'
def options(opt):
opt.load('cs')
opt.add_option("--use-cs", dest="use_cs", action="store_true",
help="use world.cs to generate world.dll")
def configure(conf):
conf.env.USE_CS = conf.options.use_cs
if conf.env.USE_CS:
conf.load('cs')
conf.load('boo')
def build(bld):
if bld.env.USE_CS:
# C# world library
bld(features = "cs",
source = "world.cs",
type = "library",
gen = "world.dll",
name = "world"
)
else:
# boo world library
bld(features = "boo",
source = "world.boo",
type = "library",
gen = "world.dll",
name = "world"
)
# executable that uses the world library
bld(features = "boo",
source = "hello.boo",
type = "exe",
gen = "hello.exe",
use = "world"
)

View File

@ -1,3 +0,0 @@
int main() {
return 0;
}

View File

@ -1,14 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2016 (ita)
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
def build(bld):
bld.load('print_commands')
bld.program(source='main.c', target='app')

View File

@ -1,3 +0,0 @@
int main() {
return 0;
}

View File

@ -1,20 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
top = '.'
out = 'build'
def options(opt):
opt.load('compiler_c')
opt.load('errcheck')
def configure(conf):
conf.load('compiler_c')
def build(bld):
bld(feature='c cprogram', source='main.c', target='app1')
bld.program(sources='main.c', target='app2')
bld.program(source='main.c', targets='app3')
bld.program(source='main.c', target='app4', include='.')
bld.program(source='main.c', target='app5', define='x=1')

View File

@ -1,3 +0,0 @@
"""
nothing to see here
"""

View File

@ -1,15 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
"""
Setting the source directory below the current folder is a
bad idea in general
"""
top = 'src'
out = 'build'
def configure(conf):
pass

View File

@ -25,11 +25,11 @@ def h_file(filename):
"""now folders can have a signature too"""
st = os.stat(filename)
if stat.S_ISDIR(st[stat.ST_MODE]):
return Utils.md5(filename).digest()
return Utils.md5(filename.encode('latin-1')).digest()
m = Utils.md5()
m.update(str(st.st_mtime))
m.update(str(st.st_size))
m.update(filename)
m.update(filename.encode('latin-1'))
return m.digest()
Utils.h_file = h_file

View File

@ -1,88 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2008 (ita)
"""
Native compilation using gcj
highly experimental, and gcj sucks anyway
"""
import os, re
from waflib.Configure import conf
from waflib import TaskGen, Task, Utils, Node
from waflib.TaskGen import feature, before, after
from waflib.Tools import ccroot
def configure(conf):
conf.find_program('gcj', var='GCJ')
conf.env.GCJLINK = conf.env.GCJ
conf.env.GCJLINKFLAGS_gcj_shlib = ['-shared']
conf.env.GCJFLAGS_gcj_shlib = ['-fPIC']
class gcj(Task.Task):
run_str = '${GCJ} ${GCJFLAGS} -classpath ${CLASSPATH} -c -o ${TGT} ${SRC}'
class gcj_program(ccroot.link_task):
run_str = '${GCJLINK} ${GCJLINKFLAGS} ${SRC} -o ${TGT}'
color = 'YELLOW'
class gcj_shlib(gcj_program):
pass
ccroot.USELIB_VARS['gcj'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJFLAGS'])
ccroot.USELIB_VARS['gcj_program'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJLINKFLAGS'])
ccroot.USELIB_VARS['gcj_shlib'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJLINKFLAGS'])
feature('gcj_program', 'gcj_shlib')(ccroot.apply_link)
feature('gcj_program', 'gcj_shlib')(ccroot.propagate_uselib_vars)
@feature('gcj')
@after('propagate_uselib_vars', 'apply_gcj')
def set_gcj_classpath(self):
lst = [isinstance(x, str) and x or x.abspath() for x in self.env.CLASSPATH]
self.env.CLASSPATH = os.pathsep.join(lst) + os.pathsep
@feature('gcj')
@before('apply_java')
def apply_gcj(self):
if 'javac' in self.features:
self.bld.fatal('feature gcj_native is not compatible with javac %r' % self)
srcdir = getattr(self, 'srcdir', '')
if isinstance(srcdir, Node.Node):
srcdir = [srcdir]
tmp = []
for x in Utils.to_list(srcdir):
if isinstance(x, Node.Node):
y = x
else:
y = self.path.find_dir(x)
if not y:
self.bld.fatal('Could not find the folder %s from %s' % (x, self.path))
tmp.append(y)
nodes = []
for x in tmp:
nodes.extend(x.ant_glob('**/*.java'))
if not getattr(self, 'gcjonce', None):
for x in nodes:
self.create_compiled_task('gcj', x)
#############################################################
# gcj is still beta software
# and this workaround cannot work for shared object (-fPIC)
class fix_dummy(Task.Task):
run_str = 'objcopy -L _ZGr8_$$_dummy ${SRC}'
before = ['gcj_program', 'gcj_shlib']
@feature('gcj')
@after('apply_gcj')
def gcj_developers_like_duplicate_dummy_symbols(self):
if self.env.FIX_DUMMY:
for tsk in self.compiled_tasks:
if isinstance(tsk, gcj):
self.create_task('fix_dummy', tsk.outputs[0])

View File

@ -1,5 +0,0 @@
public class Hi {
public Hi() {
System.out.println("hi");
}
}

View File

@ -1,5 +0,0 @@
package es;
public class Comp {
public static final String WAF = "-.-.-.-.-";
}

View File

@ -1,36 +0,0 @@
package es; // obligatory
import es.Comp;
public class Hello
{
int m_var = 0;
public Hello()
{
this.m_var = 2;
}
class MyHelperClass
{
MyHelperClass() { }
int someHelperMethod(int z, int q) { return 2; }
}
public Object makeObj(String name)
{
final String objName = "My name is " + name;
return new Object() {
public String toString()
{
return objName;
}
};
}
public static void main(String args[])
{
System.out.println("Hello, world" + Comp.WAF);
}
}

View File

@ -1,23 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2008 (ita)
VERSION='0.0.2'
APPNAME='gcj_test'
top = '.'
out = 'out'
def configure(conf):
conf.load('gcj', tooldir='.')
conf.env.FIX_DUMMY = True
def build(bld):
bld(
features = 'gcj gcj_program',
srcdir = 'src more',
target = 'test',
gcjlinkflags = '--main=es.Hello',
classpath = [bld.path.find_dir(x) for x in ('src', 'more')],
)

View File

@ -1,9 +0,0 @@
#include "example.h"
constexpr int Example::not_exposed;
int Example::calculate(int some_argument) const { return _value + some_argument; }
int Example::getSomething() const { return _value; }
void Example::setSomething(int value) { _value = value; }

View File

@ -1,20 +0,0 @@
#pragma once
#include "genpybind.h"
class GENPYBIND(visible) Example {
public:
static constexpr int GENPYBIND(hidden) not_exposed = 10;
/// \brief Do a complicated calculation.
int calculate(int some_argument = 5) const;
GENPYBIND(getter_for(something))
int getSomething() const;
GENPYBIND(setter_for(something))
void setSomething(int value);
private:
int _value = 0;
};

View File

@ -1,9 +0,0 @@
import pyexample as m
def test_example():
obj = m.Example()
obj.something = 42
assert obj.something == 42
assert obj.calculate() == 47 # with default argument
assert obj.calculate(2) == 44

View File

@ -1,37 +0,0 @@
#!/usr/bin/env python
def options(opt):
opt.load('python')
opt.load('compiler_cxx')
opt.load('genpybind')
def configure(cfg):
cfg.load('python')
cfg.load('compiler_cxx')
cfg.check_python_version((2, 7))
cfg.check_python_headers()
cfg.load('genpybind')
cfg.check(compiler='cxx',
features='cxx pyext',
uselib_store='PYBIND11GENPYBIND_EXAMPLE',
mandatory=True,
header_name='pybind11/pybind11.h')
def build(bld):
bld(target='example_inc',
export_includes='.')
bld.shlib(target='example',
source='example.cpp',
features='use',
use='example_inc')
bld(target='pyexample',
source='example.h',
genpybind_tags='genpybind_example',
features='use genpybind cxx cxxshlib pyext',
use=['PYBIND11GENPYBIND_EXAMPLE', 'example'])

View File

@ -1,6 +1,6 @@
def configure(ctx):
ctx.load('haxe')
ctx.check_haxe(mini='4.0.0', maxi='4.2.5')
ctx.check_haxe(mini='4.0.0', maxi='4.7.5')
ctx.check_haxe_pkg(
libs=['hashlink'],
uselib_store='HLR',

View File

@ -14,9 +14,9 @@ def build(bld):
from waflib import Utils
from waflib.TaskGen import feature, after
from waflib.TaskGen import feature, after_method
@feature('hidden')
@after('apply_rule')
@after_method('process_rule')
def hide_it(self):
self.tasks[0].__class__.log_display = Utils.nada

View File

@ -18,7 +18,7 @@ def configure(conf):
def build(bld):
bld(rule='echo "int ko = $$RANDOM;" > ${TGT}', target='faa.h', always=True, shell=True, name='z2')
bld(rule='echo "int ko = $$$$ ;" > ${TGT}', target='faa.h', always=True, shell=True, name='z2')
bld.program(source='a.c main.c', target='foo', includes='.')
# sort the tasks in reverse order to force the 'faa.h' creation in last position

View File

@ -50,9 +50,9 @@ def release_maxjob(self):
try:
os.remove(self.generator.bld.lockfile)
os.close(self.lockfd)
except OSError, e:
except OSError as e:
# of someone else has removed the lock... bad luck! but do not fail here
print "unexpected failure", e
print("unexpected failure", e)
pass
def wait_maxjob(self):
@ -60,7 +60,7 @@ def wait_maxjob(self):
while True:
try:
ini = os.stat(self.generator.bld.lockfile).st_mtime
except OSError, e:
except OSError as e:
return
diff = time.time() - ini
if diff > 300: # stale lock file? wait 5 minutes
@ -92,8 +92,8 @@ def process2(self):
def process(self):
try:
process2(self)
except Exception, e:
print type(e), e
except Exception as e:
print(type(e), e)
Task.Task.process_bound_maxjobs = Task.Task.process
Task.Task.process = process

View File

@ -1,81 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# Yannick LM 2011
"""
Support for the boo programming language, for example::
bld(features = "boo", # necessary feature
source = "src.boo", # list of boo files
gen = "world.dll", # target
type = "library", # library/exe ("-target:xyz" flag)
name = "world" # necessary if the target is referenced by 'use'
)
"""
from waflib import Task
from waflib.Configure import conf
from waflib.TaskGen import feature, after_method, before_method, extension
@extension('.boo')
def boo_hook(self, node):
# Nothing here yet ...
# TODO filter the non-boo source files in 'apply_booc' and remove this method
pass
@feature('boo')
@before_method('process_source')
def apply_booc(self):
"""Create a booc task """
src_nodes = self.to_nodes(self.source)
out_node = self.path.find_or_declare(self.gen)
self.boo_task = self.create_task('booc', src_nodes, [out_node])
# Set variables used by the 'booc' task
self.boo_task.env.OUT = '-o:%s' % out_node.abspath()
# type is "exe" by default
type = getattr(self, "type", "exe")
self.boo_task.env.BOO_TARGET_TYPE = "-target:%s" % type
@feature('boo')
@after_method('apply_boo')
def use_boo(self):
""""
boo applications honor the **use** keyword::
"""
dep_names = self.to_list(getattr(self, 'use', []))
for dep_name in dep_names:
dep_task_gen = self.bld.get_tgen_by_name(dep_name)
if not dep_task_gen:
continue
dep_task_gen.post()
dep_task = getattr(dep_task_gen, 'boo_task', None)
if not dep_task:
# Try a cs task:
dep_task = getattr(dep_task_gen, 'cs_task', None)
if not dep_task:
# Try a link task:
dep_task = getattr(dep_task, 'link_task', None)
if not dep_task:
# Abort ...
continue
self.boo_task.set_run_after(dep_task) # order
self.boo_task.dep_nodes.extend(dep_task.outputs) # dependency
self.boo_task.env.append_value('BOO_FLAGS', '-reference:%s' % dep_task.outputs[0].abspath())
class booc(Task.Task):
"""Compiles .boo files """
color = 'YELLOW'
run_str = '${BOOC} ${BOO_FLAGS} ${BOO_TARGET_TYPE} ${OUT} ${SRC}'
@conf
def check_booc(self):
self.find_program('booc', 'BOOC')
self.env.BOO_FLAGS = ['-nologo']
def configure(self):
"""Check that booc is available """
self.check_booc()

View File

@ -1,152 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
# Anton Feldmann, 2012
# "Base for cabal"
from waflib import Task, Utils
from waflib.TaskGen import extension
from waflib.Utils import threading
from shutil import rmtree
lock = threading.Lock()
registering = False
def configure(self):
self.find_program('cabal', var='CABAL')
self.find_program('ghc-pkg', var='GHCPKG')
pkgconfd = self.bldnode.abspath() + '/package.conf.d'
self.env.PREFIX = self.bldnode.abspath() + '/dist'
self.env.PKGCONFD = pkgconfd
if self.root.find_node(pkgconfd + '/package.cache'):
self.msg('Using existing package database', pkgconfd, color='CYAN')
else:
pkgdir = self.root.find_dir(pkgconfd)
if pkgdir:
self.msg('Deleting corrupt package database', pkgdir.abspath(), color ='RED')
rmtree(pkgdir.abspath())
pkgdir = None
self.cmd_and_log(self.env.GHCPKG + ['init', pkgconfd])
self.msg('Created package database', pkgconfd, color = 'YELLOW' if pkgdir else 'GREEN')
@extension('.cabal')
def process_cabal(self, node):
out_dir_node = self.bld.root.find_dir(self.bld.out_dir)
package_node = node.change_ext('.package')
package_node = out_dir_node.find_or_declare(package_node.name)
build_node = node.parent.get_bld()
build_path = build_node.abspath()
config_node = build_node.find_or_declare('setup-config')
inplace_node = build_node.find_or_declare('package.conf.inplace')
config_task = self.create_task('cabal_configure', node)
config_task.cwd = node.parent.abspath()
config_task.depends_on = getattr(self, 'depends_on', '')
config_task.build_path = build_path
config_task.set_outputs(config_node)
build_task = self.create_task('cabal_build', config_node)
build_task.cwd = node.parent.abspath()
build_task.build_path = build_path
build_task.set_outputs(inplace_node)
copy_task = self.create_task('cabal_copy', inplace_node)
copy_task.cwd = node.parent.abspath()
copy_task.depends_on = getattr(self, 'depends_on', '')
copy_task.build_path = build_path
last_task = copy_task
task_list = [config_task, build_task, copy_task]
if (getattr(self, 'register', False)):
register_task = self.create_task('cabal_register', inplace_node)
register_task.cwd = node.parent.abspath()
register_task.set_run_after(copy_task)
register_task.build_path = build_path
pkgreg_task = self.create_task('ghcpkg_register', inplace_node)
pkgreg_task.cwd = node.parent.abspath()
pkgreg_task.set_run_after(register_task)
pkgreg_task.build_path = build_path
last_task = pkgreg_task
task_list += [register_task, pkgreg_task]
touch_task = self.create_task('cabal_touch', inplace_node)
touch_task.set_run_after(last_task)
touch_task.set_outputs(package_node)
touch_task.build_path = build_path
task_list += [touch_task]
return task_list
def get_all_src_deps(node):
hs_deps = node.ant_glob('**/*.hs')
hsc_deps = node.ant_glob('**/*.hsc')
lhs_deps = node.ant_glob('**/*.lhs')
c_deps = node.ant_glob('**/*.c')
cpp_deps = node.ant_glob('**/*.cpp')
proto_deps = node.ant_glob('**/*.proto')
return sum([hs_deps, hsc_deps, lhs_deps, c_deps, cpp_deps, proto_deps], [])
class Cabal(Task.Task):
def scan(self):
return (get_all_src_deps(self.generator.path), ())
class cabal_configure(Cabal):
run_str = '${CABAL} configure -v0 --prefix=${PREFIX} --global --user --package-db=${PKGCONFD} --builddir=${tsk.build_path}'
shell = True
def scan(self):
out_node = self.generator.bld.root.find_dir(self.generator.bld.out_dir)
deps = [out_node.find_or_declare(dep).change_ext('.package') for dep in Utils.to_list(self.depends_on)]
return (deps, ())
class cabal_build(Cabal):
run_str = '${CABAL} build -v1 --builddir=${tsk.build_path}/'
shell = True
class cabal_copy(Cabal):
run_str = '${CABAL} copy -v0 --builddir=${tsk.build_path}'
shell = True
class cabal_register(Cabal):
run_str = '${CABAL} register -v0 --gen-pkg-config=${tsk.build_path}/pkg.config --builddir=${tsk.build_path}'
shell = True
class ghcpkg_register(Cabal):
run_str = '${GHCPKG} update -v0 --global --user --package-conf=${PKGCONFD} ${tsk.build_path}/pkg.config'
shell = True
def runnable_status(self):
global lock, registering
val = False
lock.acquire()
val = registering
lock.release()
if val:
return Task.ASK_LATER
ret = Task.Task.runnable_status(self)
if ret == Task.RUN_ME:
lock.acquire()
registering = True
lock.release()
return ret
def post_run(self):
global lock, registering
lock.acquire()
registering = False
lock.release()
return Task.Task.post_run(self)
class cabal_touch(Cabal):
run_str = 'touch ${TGT}'

View File

@ -1,194 +0,0 @@
import os
import pipes
import subprocess
import sys
from waflib import Logs, Task, Context
from waflib.Tools.c_preproc import scan as scan_impl
# ^-- Note: waflib.extras.gccdeps.scan does not work for us,
# due to its current implementation:
# The -MD flag is injected into the {C,CXX}FLAGS environment variable and
# dependencies are read out in a separate step after compiling by reading
# the .d file saved alongside the object file.
# As the genpybind task refers to a header file that is never compiled itself,
# gccdeps will not be able to extract the list of dependencies.
from waflib.TaskGen import feature, before_method
def join_args(args):
return " ".join(pipes.quote(arg) for arg in args)
def configure(cfg):
cfg.load("compiler_cxx")
cfg.load("python")
cfg.check_python_version(minver=(2, 7))
if not cfg.env.LLVM_CONFIG:
cfg.find_program("llvm-config", var="LLVM_CONFIG")
if not cfg.env.GENPYBIND:
cfg.find_program("genpybind", var="GENPYBIND")
# find clang reasource dir for builtin headers
cfg.env.GENPYBIND_RESOURCE_DIR = os.path.join(
cfg.cmd_and_log(cfg.env.LLVM_CONFIG + ["--libdir"]).strip(),
"clang",
cfg.cmd_and_log(cfg.env.LLVM_CONFIG + ["--version"]).strip())
if os.path.exists(cfg.env.GENPYBIND_RESOURCE_DIR):
cfg.msg("Checking clang resource dir", cfg.env.GENPYBIND_RESOURCE_DIR)
else:
cfg.fatal("Clang resource dir not found")
@feature("genpybind")
@before_method("process_source")
def generate_genpybind_source(self):
"""
Run genpybind on the headers provided in `source` and compile/link the
generated code instead. This works by generating the code on the fly and
swapping the source node before `process_source` is run.
"""
# name of module defaults to name of target
module = getattr(self, "module", self.target)
# create temporary source file in build directory to hold generated code
out = "genpybind-%s.%d.cpp" % (module, self.idx)
out = self.path.get_bld().find_or_declare(out)
task = self.create_task("genpybind", self.to_nodes(self.source), out)
# used to detect whether CFLAGS or CXXFLAGS should be passed to genpybind
task.features = self.features
task.module = module
# can be used to select definitions to include in the current module
# (when header files are shared by more than one module)
task.genpybind_tags = self.to_list(getattr(self, "genpybind_tags", []))
# additional include directories
task.includes = self.to_list(getattr(self, "includes", []))
task.genpybind = self.env.GENPYBIND
# Tell waf to compile/link the generated code instead of the headers
# originally passed-in via the `source` parameter. (see `process_source`)
self.source = [out]
class genpybind(Task.Task): # pylint: disable=invalid-name
"""
Runs genpybind on headers provided as input to this task.
Generated code will be written to the first (and only) output node.
"""
quiet = True
color = "PINK"
scan = scan_impl
@staticmethod
def keyword():
return "Analyzing"
def run(self):
if not self.inputs:
return
args = self.find_genpybind() + self._arguments(
resource_dir=self.env.GENPYBIND_RESOURCE_DIR)
output = self.run_genpybind(args)
# For debugging / log output
pasteable_command = join_args(args)
# write generated code to file in build directory
# (will be compiled during process_source stage)
(output_node,) = self.outputs
output_node.write("// {}\n{}\n".format(
pasteable_command.replace("\n", "\n// "), output))
def find_genpybind(self):
return self.genpybind
def run_genpybind(self, args):
bld = self.generator.bld
kwargs = dict(cwd=bld.variant_dir)
if hasattr(bld, "log_command"):
bld.log_command(args, kwargs)
else:
Logs.debug("runner: {!r}".format(args))
proc = subprocess.Popen(
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
stdout, stderr = proc.communicate()
if not isinstance(stdout, str):
stdout = stdout.decode(sys.stdout.encoding, errors="replace")
if not isinstance(stderr, str):
stderr = stderr.decode(sys.stderr.encoding, errors="replace")
if proc.returncode != 0:
bld.fatal(
"genpybind returned {code} during the following call:"
"\n{command}\n\n{stdout}\n\n{stderr}".format(
code=proc.returncode,
command=join_args(args),
stdout=stdout,
stderr=stderr,
))
if stderr.strip():
Logs.debug("non-fatal warnings during genpybind run:\n{}".format(stderr))
return stdout
def _include_paths(self):
return self.generator.to_incnodes(self.includes + self.env.INCLUDES)
def _inputs_as_relative_includes(self):
include_paths = self._include_paths()
relative_includes = []
for node in self.inputs:
for inc in include_paths:
if node.is_child_of(inc):
relative_includes.append(node.path_from(inc))
break
else:
self.generator.bld.fatal("could not resolve {}".format(node))
return relative_includes
def _arguments(self, genpybind_parse=None, resource_dir=None):
args = []
relative_includes = self._inputs_as_relative_includes()
is_cxx = "cxx" in self.features
# options for genpybind
args.extend(["--genpybind-module", self.module])
if self.genpybind_tags:
args.extend(["--genpybind-tag"] + self.genpybind_tags)
if relative_includes:
args.extend(["--genpybind-include"] + relative_includes)
if genpybind_parse:
args.extend(["--genpybind-parse", genpybind_parse])
args.append("--")
# headers to be processed by genpybind
args.extend(node.abspath() for node in self.inputs)
args.append("--")
# options for clang/genpybind-parse
args.append("-D__GENPYBIND__")
args.append("-xc++" if is_cxx else "-xc")
has_std_argument = False
for flag in self.env["CXXFLAGS" if is_cxx else "CFLAGS"]:
flag = flag.replace("-std=gnu", "-std=c")
if flag.startswith("-std=c"):
has_std_argument = True
args.append(flag)
if not has_std_argument:
args.append("-std=c++14")
args.extend("-I{}".format(n.abspath()) for n in self._include_paths())
args.extend("-D{}".format(p) for p in self.env.DEFINES)
# point to clang resource dir, if specified
if resource_dir:
args.append("-resource-dir={}".format(resource_dir))
return args