-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
:type f: function
"""
def fun(*k, **kw):
- mandatory = True
- if 'mandatory' in kw:
- mandatory = kw['mandatory']
- del kw['mandatory']
-
+ mandatory = kw.pop('mandatory', True)
try:
return f(*k, **kw)
except Errors.ConfigurationError:
:type var: string
:param value: obtain the program from the value passed exclusively
:type value: list or string (list is preferred)
- :param ext: list of extensions for the binary (do not add an extension for portability)
- :type ext: list of string
+ :param exts: list of extensions for the binary (do not add an extension for portability)
+ :type exts: list of string
:param msg: name to display in the log, by default filename is used
:type msg: string
:param interpreter: interpreter for the program
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010-2018 (ita)
import waflib.Node
# the following 3 constants are updated on each new release (do not touch)
-HEXVERSION=0x2000400
+HEXVERSION=0x2000800
"""Constant updated on new releases"""
-WAFVERSION="2.0.4"
+WAFVERSION="2.0.8"
"""Constant updated on new releases"""
-WAFREVISION="5996879673deb7166b61a299be317a738de6891e"
+WAFREVISION="f78fbc32bb355a3291c9b5f79bbe0c8dfe81282a"
"""Git revision when the waf version is updated"""
ABI = 20
waf_dir = ''
"""Directory containing the waf modules"""
+default_encoding = Utils.console_encoding()
+"""Encoding to use when reading outputs from other processes"""
+
g_module = None
"""
Module representing the top-level wscript file (see :py:const:`waflib.Context.run_dir`)
if not isinstance(kw['cwd'], str):
kw['cwd'] = kw['cwd'].abspath()
+ encoding = kw.pop('decode_as', default_encoding)
+
try:
ret, out, err = Utils.run_process(cmd, kw, cargs)
except Exception as e:
if out:
if not isinstance(out, str):
- out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace')
+ out = out.decode(encoding, errors='replace')
if self.logger:
self.logger.debug('out: %s', out)
else:
Logs.info(out, extra={'stream':sys.stdout, 'c1': ''})
if err:
if not isinstance(err, str):
- err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace')
+ err = err.decode(encoding, errors='replace')
if self.logger:
self.logger.error('err: %s' % err)
else:
kw['shell'] = isinstance(cmd, str)
self.log_command(cmd, kw)
- if 'quiet' in kw:
- quiet = kw['quiet']
- del kw['quiet']
- else:
- quiet = None
-
- if 'output' in kw:
- to_ret = kw['output']
- del kw['output']
- else:
- to_ret = STDOUT
+ quiet = kw.pop('quiet', None)
+ to_ret = kw.pop('output', STDOUT)
if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0]):
raise Errors.WafError('Program %r not found!' % cmd[0])
if not isinstance(kw['cwd'], str):
kw['cwd'] = kw['cwd'].abspath()
+ encoding = kw.pop('decode_as', default_encoding)
+
try:
ret, out, err = Utils.run_process(cmd, kw, cargs)
except Exception as e:
raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
if not isinstance(out, str):
- out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace')
+ out = out.decode(encoding, errors='replace')
if not isinstance(err, str):
- err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace')
+ err = err.decode(encoding, errors='replace')
if out and quiet != STDOUT and quiet != BOTH:
self.to_log('out: %s' % out)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
if maxdepth:
for k in node.ant_iter(accept=accept, maxdepth=maxdepth - 1, pats=npats, dir=dir, src=src, remove=remove, quiet=quiet):
yield k
- raise StopIteration
def ant_glob(self, *k, **kw):
"""
- Finds files across folders:
+ Finds files across folders and returns Node objects:
* ``**/*`` find all files recursively
* ``**/*.class`` find all files ending by .class
For example::
def configure(cfg):
- cfg.path.ant_glob('**/*.cpp') # finds all .cpp files
- cfg.root.ant_glob('etc/*.txt') # matching from the filesystem root can be slow
- cfg.path.ant_glob('*.cpp', excl=['*.c'], src=True, dir=False)
+ # find all .cpp files
+ cfg.path.ant_glob('**/*.cpp')
+ # find particular files from the root filesystem (can be slow)
+ cfg.root.ant_glob('etc/*.txt')
+ # simple exclusion rule example
+ cfg.path.ant_glob('*.c*', excl=['*.c'], src=True, dir=False)
+
+ For more information about the patterns, consult http://ant.apache.org/manual/dirtasks.html
+ Please remember that the '..' sequence does not represent the parent directory::
+
+ def configure(cfg):
+ cfg.path.ant_glob('../*.h') # incorrect
+ cfg.path.parent.ant_glob('*.h') # correct
+
+ The Node structure is itself a filesystem cache, so certain precautions must
+ be taken while matching files in the build or installation phases.
+ Nodes objects that do have a corresponding file or folder are garbage-collected by default.
+ This garbage collection is usually required to prevent returning files that do not
+ exist anymore. Yet, this may also remove Node objects of files that are yet-to-be built.
- For more information see http://ant.apache.org/manual/dirtasks.html
+ This typically happens when trying to match files in the build directory,
+ but there are also cases when files are created in the source directory.
+ Run ``waf -v`` to display any warnings, and try consider passing ``remove=False``
+ when matching files in the build directory.
+
+ Since ant_glob can traverse both source and build folders, it is a best practice
+ to call this method only from the most specific build node::
+
+ def build(bld):
+ # traverses the build directory, may need ``remove=False``:
+ bld.path.ant_glob('project/dir/**/*.h')
+ # better, no accidental build directory traversal:
+ bld.path.find_node('project/dir').ant_glob('**/*.h') # best
+
+ In addition, files and folders are listed immediately. When matching files in the
+ build folders, consider passing ``generator=True`` so that the generator object
+ returned can defer computation to a later stage. For example::
+
+ def build(bld):
+ bld(rule='tar xvf ${SRC}', source='arch.tar')
+ bld.add_group()
+ gen = bld.bldnode.ant_glob("*.h", generator=True, remove=True)
+ # files will be listed only after the arch.tar is unpacked
+ bld(rule='ls ${SRC}', source=gen, name='XYZ')
- The nodes that correspond to files and folders that do not exist are garbage-collected.
- To prevent this behaviour in particular when running over the build directory, pass ``remove=False``
:param incl: ant patterns or list of patterns to include
:type incl: string or list of strings
:type maxdepth: int
:param ignorecase: ignore case while matching (False by default)
:type ignorecase: bool
- :returns: The corresponding Nodes
+ :param generator: Whether to evaluate the Nodes lazily
:type generator: bool
:param remove: remove files/folders that do not exist (True by default)
:type remove: bool
:param quiet: disable build directory traversal warnings (verbose mode)
:type quiet: bool
- :returns: Whether to evaluate the Nodes lazily, alters the type of the returned value
+ :returns: The corresponding Node objects as a list or as a generator object (generator=True)
:rtype: by default, list of :py:class:`waflib.Node.Node` instances
"""
src = kw.get('src', True)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Scott Newton, 2005 (scottn)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
import heapq, traceback
try:
- from queue import Queue
+ from queue import Queue, PriorityQueue
except ImportError:
from Queue import Queue
+ try:
+ from Queue import PriorityQueue
+ except ImportError:
+ class PriorityQueue(Queue):
+ def _init(self, maxsize):
+ self.maxsize = maxsize
+ self.queue = []
+ def _put(self, item):
+ heapq.heappush(self.queue, item)
+ def _get(self):
+ return heapq.heappop(self.queue)
+
from waflib import Utils, Task, Errors, Logs
GAP = 5
def append(self, task):
heapq.heappush(self.lst, task)
def appendleft(self, task):
+ "Deprecated, do not use"
heapq.heappush(self.lst, task)
def pop(self):
return heapq.heappop(self.lst)
self.incomplete = set()
"""List of :py:class:`waflib.Task.Task` waiting for dependent tasks to complete (DAG)"""
- self.ready = Queue(0)
+ self.ready = PriorityQueue(0)
"""List of :py:class:`waflib.Task.Task` ready to be executed by consumers"""
self.out = Queue(0)
:type tsk: :py:attr:`waflib.Task.Task`
"""
if getattr(tsk, 'more_tasks', None):
- # TODO recompute priorities globally?
+ more = set(tsk.more_tasks)
+ groups_done = set()
+ def iteri(a, b):
+ for x in a:
+ yield x
+ for x in b:
+ yield x
+
+ # Update the dependency tree
+ # this assumes that task.run_after values were updated
+ for x in iteri(self.outstanding, self.incomplete):
+ for k in x.run_after:
+ if isinstance(k, Task.TaskGroup):
+ if k not in groups_done:
+ groups_done.add(k)
+ for j in k.prev & more:
+ self.revdeps[j].add(k)
+ elif k in more:
+ self.revdeps[k].add(x)
+
ready, waiting = self.prio_and_split(tsk.more_tasks)
self.outstanding.extend(ready)
self.incomplete.update(waiting)
reverse = self.revdeps
+ groups_done = set()
for x in tasks:
for k in x.run_after:
if isinstance(k, Task.TaskGroup):
- if k.done:
- pass
- else:
- k.done = True
+ if k not in groups_done:
+ groups_done.add(k)
for j in k.prev:
reverse[j].add(k)
else:
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
v = v() # dependency is a function, call it
upd(v)
+ def sig_deep_inputs(self):
+ """
+ Enable rebuilds on input files task signatures. Not used by default.
+
+ Example: hashes of output programs can be unchanged after being re-linked,
+ despite the libraries being different. This method can thus prevent stale unit test
+ results (waf_unit_test.py).
+
+ Hashing input file timestamps is another possibility for the implementation.
+ This may cause unnecessary rebuilds when input tasks are frequently executed.
+ Here is an implementation example::
+
+ lst = []
+ for node in self.inputs + self.dep_nodes:
+ st = os.stat(node.abspath())
+ lst.append(st.st_mtime)
+ lst.append(st.st_size)
+ self.m.update(Utils.h_list(lst))
+
+ The downside of the implementation is that it absolutely requires all build directory
+ files to be declared within the current build.
+ """
+ bld = self.generator.bld
+ lst = [bld.task_sigs[bld.node_sigs[node]] for node in (self.inputs + self.dep_nodes) if node.is_bld()]
+ self.m.update(Utils.h_list(lst))
+
def sig_vars(self):
"""
Used by :py:meth:`waflib.Task.Task.signature`; it hashes :py:attr:`waflib.Task.Task.env` variables/values
return cls
+def deep_inputs(cls):
+ """
+ Task class decorator to enable rebuilds on input files task signatures
+ """
+ def sig_explicit_deps(self):
+ Task.sig_explicit_deps(self)
+ Task.sig_deep_inputs(self)
+ cls.sig_explicit_deps = sig_explicit_deps
+ return cls
+
TaskBase = Task
"Provided for compatibility reasons, TaskBase should not be used"
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
* stderr: standard error, set to None to prevent waf from capturing the text
* timeout: timeout for command execution (Python 3)
* always: whether to always run the command (False by default)
+ * deep_inputs: whether the task must depend on the input file tasks too (False by default)
"""
if not getattr(self, 'rule', None):
return
cls_str = getattr(self, 'cls_str', None)
cls_keyword = getattr(self, 'cls_keyword', None)
use_cache = getattr(self, 'cache_rule', 'True')
+ deep_inputs = getattr(self, 'deep_inputs', False)
scan_val = has_deps = hasattr(self, 'deps')
if scan:
scan_val = id(scan)
- key = Utils.h_list((name, self.rule, chmod, shell, color, cls_str, cls_keyword, scan_val, _vars))
+ key = Utils.h_list((name, self.rule, chmod, shell, color, cls_str, cls_keyword, scan_val, _vars, deep_inputs))
cls = None
if use_cache:
if cls_keyword:
setattr(cls, 'keyword', self.cls_keyword)
+ if deep_inputs:
+ Task.deep_inputs(cls)
+
if scan:
cls.scan = self.scan
elif has_deps:
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2008-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# John O'Meara, 2006
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy 2008-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2016-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
node = self.path.find_resource(self.defs)
if not node:
raise Errors.WafError('invalid def file %r' % self.defs)
- if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME):
- self.env.append_value('LINKFLAGS', '/def:%s' % node.path_from(self.get_cwd()))
+ if self.env.def_PATTERN:
+ self.env.append_value('LINKFLAGS', self.env.def_PATTERN % node.path_from(self.get_cwd()))
self.link_task.dep_nodes.append(node)
else:
- #gcc for windows takes *.def file a an input without any special flag
+ # gcc for windows takes *.def file as input without any special flag
self.link_task.inputs.append(node)
# where to put the import library
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Krzysztof Kosiński 2014
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy 2009-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Matthias Jahn jahn dôt matthias ât freenet dôt de, 2007 (pmarat)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Matthias Jahn jahn dôt matthias ât freenet dôt de 2007 (pmarat)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2007 (dv)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2007 (dv)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2016-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2016-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007
self.meths.append('process_dbus')
self.dbus_lst.append([filename, prefix, mode])
-@before_method('apply_core')
+@before_method('process_source')
def process_dbus(self):
"""
Processes the dbus files stored in the attribute *dbus_lst* to create :py:class:`waflib.Tools.dbus.dbus_binding_tool` instances.
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2007 (dv)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# John O'Meara, 2006
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# KWS 2010
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2008-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2007 (dv)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Stian Selnes 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy 2009-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# imported from samba
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Alex Rønne Petersen, 2012 (alexrp/Zor)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Sebastian Schlingmann, 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2006 (dv)
"""
Microsoft Visual C++/Intel C++ compiler support
+If you get detection problems, first try any of the following::
+
+ chcp 65001
+ set PYTHONIOENCODING=...
+ set PYTHONLEGACYWINDOWSSTDIO=1
+
Usage::
$ waf configure --msvc_version="msvc 10.0,msvc 9.0" --msvc_target="x64"
return
if sys.version_info[0] < 3:
- try:
- txt = txt.decode(sys.stdout.encoding or 'cp1252')
- except UnicodeError:
- txt = txt.decode('utf-8', 'replace')
+ txt = txt.decode(Utils.console_encoding())
+
arr = json.loads(txt)
arr.sort(key=lambda x: x['installationVersion'])
for entry in arr:
v.cprogram_PATTERN = v.cxxprogram_PATTERN = '%s.exe'
+ v.def_PATTERN = '/def:%s'
+
#######################################################################################################
##### conf above, build below
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2008-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# andersg at 0x63.nu 2007
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2007-2015 (ita)
Check if the python interpreter is found matching a given minimum version.
minver should be a tuple, eg. to check for python >= 2.4.2 pass (2,4,2) as minver.
- If successful, PYTHON_VERSION is defined as 'MAJOR.MINOR'
- (eg. '2.4') of the actual python version found, and PYTHONDIR is
- defined, pointing to the site-packages directory appropriate for
+ If successful, PYTHON_VERSION is defined as 'MAJOR.MINOR' (eg. '2.4')
+ of the actual python version found, and PYTHONDIR and PYTHONARCHDIR
+ are defined, pointing to the site-packages directories appropriate for
this python version, where modules/packages/extensions should be
installed.
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
names.append(x)
return (nodes, names)
+ def quote_flag(self, x):
+ """
+ Override Task.quote_flag. QT parses the argument files
+ differently than cl.exe and link.exe
+
+ :param x: flag
+ :type x: string
+ :return: quoted flag
+ :rtype: string
+ """
+ return x
+
+
class moc(Task.Task):
"""
Creates ``.moc`` files
color = 'BLUE'
run_str = '${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}'
+ def quote_flag(self, x):
+ """
+ Override Task.quote_flag. QT parses the argument files
+ differently than cl.exe and link.exe
+
+ :param x: flag
+ :type x: string
+ :return: quoted flag
+ :rtype: string
+ """
+ return x
+
+
class ui5(Task.Task):
"""
Processes ``.ui`` files
for k in ('', '5') if Utils.is_win32 else ['']:
for p in ('lib', ''):
yield (p, name, k, x)
- raise StopIteration
for tup in lib_names():
k = ''.join(tup)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# daniel.svensson at purplescout.se 2008
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2006
except AttributeError:
self.bld.utest_results = [tup]
+@Task.deep_inputs
class utest(Task.Task):
"""
Execute a unit test
def get_cwd(self):
return getattr(self.generator, 'ut_cwd', self.inputs[0].parent)
- def sig_explicit_deps(self):
- lst = [os.stat(node.abspath()).st_mtime for node in self.inputs]
- self.m.update(str(lst))
- return super(utest, self).sig_explicit_deps()
-
def summary(bld):
"""
Display an execution summary::
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Brant Young, 2007
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
it = self.it = self.fun(*self.params)
return next(it)
+ next = __next__
+
is_win32 = os.sep == '\\' or sys.platform == 'win32' # msys2
"""
Whether this system is a Windows series
else:
return val
+def console_encoding():
+ try:
+ import ctypes
+ except ImportError:
+ pass
+ else:
+ try:
+ codepage = ctypes.windll.kernel32.GetConsoleCP()
+ except AttributeError:
+ pass
+ else:
+ if codepage:
+ return 'cp%d' % codepage
+ return sys.stdout.encoding or ('cp1252' if is_win32 else 'latin-1')
+
def split_path_unix(path):
return path.split('/')
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# per rosengren 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Michal Proszek, 2014 (poxip)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Yannick LM 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
#
from waflib.Configure import conf
from waflib.TaskGen import feature, after_method
-BOOST_LIBS = ['/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu',
- '/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
+BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
BOOST_VERSION_FILE = 'boost/version.hpp'
BOOST_VERSION_CODE = '''
int main() { boost::system::error_code c; }
'''
+PTHREAD_CODE = '''
+#include <pthread.h>
+static void* f(void*) { return 0; }
+int main() {
+ pthread_t th;
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_create(&th, &attr, &f, 0);
+ pthread_join(th, 0);
+ pthread_cleanup_push(0, 0);
+ pthread_cleanup_pop(0);
+ pthread_attr_destroy(&attr);
+}
+'''
+
BOOST_THREAD_CODE = '''
#include <boost/thread.hpp>
int main() { boost::thread t; }
return path.abspath(), match_libs(kw.get('lib'), False), match_libs(kw.get('stlib'), True)
+@conf
+def _check_pthread_flag(self, *k, **kw):
+ '''
+ Computes which flags should be added to CXXFLAGS and LINKFLAGS to compile in multi-threading mode
+
+ Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
+ boost/thread.hpp will trigger a #error if -pthread isn't used:
+ boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
+ is not turned on. Please set the correct command line options for
+ threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
+
+ Based on _BOOST_PTHREAD_FLAG(): https://github.com/tsuna/boost.m4/blob/master/build-aux/boost.m4
+ '''
+
+ var = kw.get('uselib_store', 'BOOST')
+
+ self.start_msg('Checking the flags needed to use pthreads')
+
+ # The ordering *is* (sometimes) important. Some notes on the
+ # individual items follow:
+ # (none): in case threads are in libc; should be tried before -Kthread and
+ # other compiler flags to prevent continual compiler warnings
+ # -lpthreads: AIX (must check this before -lpthread)
+ # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+ # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+ # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+ # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
+ # -pthreads: Solaris/GCC
+ # -mthreads: MinGW32/GCC, Lynx/GCC
+ # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+ # doesn't hurt to check since this sometimes defines pthreads too;
+ # also defines -D_REENTRANT)
+ # ... -mt is also the pthreads flag for HP/aCC
+ # -lpthread: GNU Linux, etc.
+ # --thread-safe: KAI C++
+ if Utils.unversioned_sys_platform() == "sunos":
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+ boost_pthread_flags = ["-pthreads", "-lpthread", "-mt", "-pthread"]
+ else:
+ boost_pthread_flags = ["", "-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
+ "-pthreads", "-mthreads", "-lpthread", "--thread-safe", "-mt"]
+
+ for boost_pthread_flag in boost_pthread_flags:
+ try:
+ self.env.stash()
+ self.env.append_value('CXXFLAGS_%s' % var, boost_pthread_flag)
+ self.env.append_value('LINKFLAGS_%s' % var, boost_pthread_flag)
+ self.check_cxx(code=PTHREAD_CODE, msg=None, use=var, execute=False)
+
+ self.end_msg(boost_pthread_flag)
+ return
+ except self.errors.ConfigurationError:
+ self.env.revert()
+ self.end_msg('None')
@conf
def check_boost(self, *k, **kw):
var = kw.get('uselib_store', 'BOOST')
+ self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
+ if self.env.DPKG_ARCHITECTURE:
+ deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
+ BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())
+
self.start_msg('Checking boost includes')
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
versions = self.boost_get_version(inc)
Logs.pprint('CYAN', ' shared libs : %s' % libs)
Logs.pprint('CYAN', ' static libs : %s' % stlibs)
+ def has_shlib(lib):
+ return params['lib'] and lib in params['lib']
+ def has_stlib(lib):
+ return params['stlib'] and lib in params['stlib']
+ def has_lib(lib):
+ return has_shlib(lib) or has_stlib(lib)
+ if has_lib('thread'):
+ # not inside try_link to make check visible in the output
+ self._check_pthread_flag(k, kw)
def try_link():
- if (params['lib'] and 'system' in params['lib']) or \
- params['stlib'] and 'system' in params['stlib']:
+ if has_lib('system'):
self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
- if (params['lib'] and 'thread' in params['lib']) or \
- params['stlib'] and 'thread' in params['stlib']:
+ if has_lib('thread'):
self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)
-
- def is_log_mt():
- '''Check if found boost_log library is multithread-safe'''
- for lib in libs:
- if lib.startswith('boost_log'):
- lib_log = lib
- break
- return '-mt' in lib_log
-
- if params['lib'] and 'log' in params['lib']:
- self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
- if not is_log_mt():
- self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
- self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
- if params['stlib'] and 'log' in params['stlib']:
- # Static linking is assumed by default
- if not is_log_mt():
+ if has_lib('log'):
+ if not has_lib('thread'):
self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
+ if has_shlib('log'):
+ self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
if params.get('linkage_autodetect', False):
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2015
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2013 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Calle Rosenquist, 2017 (xbreak)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# -*- coding: utf-8 vi:ts=4:noexpandtab
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Anton Feldmann, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Tool to extend c_config.check_cfg()
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Christoph Koke, 2013
Task.Task.keep_last_cmd = True
-if sys.hexversion >= 0x3030000:
- quote = shlex.quote
-else:
- quote = pipes.quote
-
@TaskGen.feature('c', 'cxx')
@TaskGen.after_method('process_use')
def collect_compilation_db_tasks(self):
directory = getattr(task, 'cwd', ctx.variant_dir)
f_node = task.inputs[0]
filename = os.path.relpath(f_node.abspath(), directory)
- cmd = " ".join(map(quote, cmd))
entry = {
"directory": directory,
- "command": cmd,
+ "arguments": cmd,
"file": filename,
}
clang_db[filename] = entry
setattr(t, 'old_runnable_status', getattr(t, 'runnable_status', None))
setattr(t, 'runnable_status', runnable_status)
-
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# CodeLite Project
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# Michel Mooij, michel.mooij7@gmail.com
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
#
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# -*- coding: utf-8 vi:ts=4:noexpandtab
# Tool to provide dedicated variables for cross-compilation
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010-2015
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Jérôme Carretero, 2011 (zougloub)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
if x.pkgname == self.myproject:
continue
yield x
- raise StopIteration
def execute(self):
self.compute_dependencies()
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: UTF-8
# Thomas Nagy 2008-2010 (ita)
@feature('doxygen')
def process_doxy(self):
if not getattr(self, 'doxyfile', None):
- self.generator.bld.fatal('no doxyfile??')
+ self.bld.fatal('no doxyfile variable specified??')
node = self.doxyfile
if not isinstance(node, Node.Node):
node = self.path.find_resource(node)
if not node:
- raise ValueError('doxygen file not found')
+ self.bld.fatal('doxygen file %s not found' % self.doxyfile)
# the task instance
dsk = self.create_task('doxygen', node)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Matt Clarkson, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Eclipse CDT 5.0 generator for Waf
cdt_mk = oe_cdt + '.make.core'
cdt_core = oe_cdt + '.core'
cdt_bld = oe_cdt + '.build.core'
+extbuilder_dir = '.externalToolBuilders'
+extbuilder_name = 'Waf_Builder.launch'
class eclipse(Build.BuildContext):
cmd = 'eclipse'
appname = getattr(Context.g_module, Context.APPNAME, os.path.basename(self.srcnode.abspath()))
self.create_cproject(appname, pythonpath=self.env['ECLIPSE_PYTHON_PATH'])
+ # Helper to dump the XML document content to XML with UTF-8 encoding
+ def write_conf_to_xml(self, filename, document):
+ self.srcnode.make_node(filename).write(document.toprettyxml(encoding='UTF-8'), flags='wb')
+
def create_cproject(self, appname, workspace_includes=[], pythonpath=[]):
"""
Create the Eclipse CDT .project and .cproject files
source_dirs = []
cpppath = self.env['CPPPATH']
javasrcpath = []
+ javalibpath = []
includes = STANDARD_INCLUDES
if sys.platform != 'win32':
cc = self.env.CC or self.env.CXX
if not isinstance(tg, TaskGen.task_gen):
continue
+ tg.post()
+
# Add local Python modules paths to configuration so object resolving will work in IDE
+ # This may also contain generated files (ie. pyqt5 or protoc) that get picked from build
if 'py' in tg.features:
pypath = tg.path.relpath()
py_installfrom = getattr(tg, 'install_from', None)
- if py_installfrom:
- pypath += os.sep + py_installfrom
- pythonpath.append(pypath)
+ if isinstance(py_installfrom, Node.Node):
+ pypath = py_installfrom.path_from(self.root.make_node(self.top_dir))
+ if pypath not in pythonpath:
+ pythonpath.append(pypath)
haspython = True
-
# Add Java source directories so object resolving works in IDE
- if 'java' in tg.features:
+ # This may also contain generated files (ie. protoc) that get picked from build
+ if 'javac' in tg.features:
java_src = tg.path.relpath()
- java_srcdir = getattr(tg, 'srcdir', None)
+ java_srcdir = getattr(tg.javac_task, 'srcdir', None)
if java_srcdir:
if isinstance(java_srcdir, Node.Node):
java_srcdir = [java_srcdir]
for x in Utils.to_list(java_srcdir):
- if isinstance(x, Node.Node):
- x = x.name
- if java_src == '.':
- this_src = x
- else:
- this_src = java_src + os.sep + x
- javasrcpath.append(this_src)
+ x = x.path_from(self.root.make_node(self.top_dir))
+ if x not in javasrcpath:
+ javasrcpath.append(x)
else:
- javasrcpath.append(java_src)
+ if java_src not in javasrcpath:
+ javasrcpath.append(java_src)
hasjava = True
- tg.post()
+ # Check if there are external dependencies and add them as external jar so they will be resolved by Eclipse
+ usedlibs=getattr(tg, 'use', [])
+ for x in Utils.to_list(usedlibs):
+ for cl in Utils.to_list(tg.env['CLASSPATH_'+x]):
+ if cl not in javalibpath:
+ javalibpath.append(cl)
+
if not getattr(tg, 'link_task', None):
continue
hasc = True
- project = self.impl_create_project(sys.executable, appname, hasc, hasjava, haspython)
- self.srcnode.make_node('.project').write(project.toprettyxml())
+ waf_executable = os.path.abspath(sys.argv[0])
+ project = self.impl_create_project(sys.executable, appname, hasc, hasjava, haspython, waf_executable)
+ self.write_conf_to_xml('.project', project)
if hasc:
- waf = os.path.abspath(sys.argv[0])
- project = self.impl_create_cproject(sys.executable, waf, appname, workspace_includes, cpppath, source_dirs)
- self.srcnode.make_node('.cproject').write(project.toprettyxml())
+ project = self.impl_create_cproject(sys.executable, waf_executable, appname, workspace_includes, cpppath, source_dirs)
+ self.write_conf_to_xml('.cproject', project)
if haspython:
project = self.impl_create_pydevproject(sys.path, pythonpath)
- self.srcnode.make_node('.pydevproject').write(project.toprettyxml())
+ self.write_conf_to_xml('.pydevproject', project)
if hasjava:
- project = self.impl_create_javaproject(javasrcpath)
- self.srcnode.make_node('.classpath').write(project.toprettyxml())
+ project = self.impl_create_javaproject(javasrcpath, javalibpath)
+ self.write_conf_to_xml('.classpath', project)
- def impl_create_project(self, executable, appname, hasc, hasjava, haspython):
+ def impl_create_project(self, executable, appname, hasc, hasjava, haspython, waf_executable):
doc = Document()
projectDescription = doc.createElement('projectDescription')
self.add(doc, projectDescription, 'name', appname)
self.add(doc, projectDescription, 'projects')
buildSpec = self.add(doc, projectDescription, 'buildSpec')
buildCommand = self.add(doc, buildSpec, 'buildCommand')
- self.add(doc, buildCommand, 'name', oe_cdt + '.managedbuilder.core.genmakebuilder')
self.add(doc, buildCommand, 'triggers', 'clean,full,incremental,')
arguments = self.add(doc, buildCommand, 'arguments')
- # the default make-style targets are overwritten by the .cproject values
- dictionaries = {
- cdt_mk + '.contents': cdt_mk + '.activeConfigSettings',
- cdt_mk + '.enableAutoBuild': 'false',
- cdt_mk + '.enableCleanBuild': 'true',
- cdt_mk + '.enableFullBuild': 'true',
- }
+ dictionaries = {}
+
+ # If CDT is present, instruct this one to call waf as it is more flexible (separate build/clean ...)
+ if hasc:
+ self.add(doc, buildCommand, 'name', oe_cdt + '.managedbuilder.core.genmakebuilder')
+ # the default make-style targets are overwritten by the .cproject values
+ dictionaries = {
+ cdt_mk + '.contents': cdt_mk + '.activeConfigSettings',
+ cdt_mk + '.enableAutoBuild': 'false',
+ cdt_mk + '.enableCleanBuild': 'true',
+ cdt_mk + '.enableFullBuild': 'true',
+ }
+ else:
+ # Otherwise for Java/Python an external builder tool is created that will call waf build
+ self.add(doc, buildCommand, 'name', 'org.eclipse.ui.externaltools.ExternalToolBuilder')
+ dictionaries = {
+ 'LaunchConfigHandle': '<project>/%s/%s'%(extbuilder_dir, extbuilder_name),
+ }
+ # The definition is in a separate directory XML file
+ try:
+ os.mkdir(extbuilder_dir)
+ except OSError:
+ pass # Ignore error if already exists
+
+ # Populate here the external builder XML calling waf
+ builder = Document()
+ launchConfiguration = doc.createElement('launchConfiguration')
+ launchConfiguration.setAttribute('type', 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType')
+ self.add(doc, launchConfiguration, 'booleanAttribute', {'key': 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'false'})
+ self.add(doc, launchConfiguration, 'booleanAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', 'value': 'true'})
+ self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': waf_executable})
+ self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'full,incremental,'})
+ self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': 'build'})
+ self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': '${project_loc}'})
+ builder.appendChild(launchConfiguration)
+ # And write the XML to the file references before
+ self.write_conf_to_xml('%s%s%s'%(extbuilder_dir, os.path.sep, extbuilder_name), builder)
+
+
for k, v in dictionaries.items():
self.addDictionary(doc, arguments, k, v)
doc.appendChild(projectDescription)
return doc
- def impl_create_cproject(self, executable, waf, appname, workspace_includes, cpppath, source_dirs=[]):
+ def impl_create_cproject(self, executable, waf_executable, appname, workspace_includes, cpppath, source_dirs=[]):
doc = Document()
doc.appendChild(doc.createProcessingInstruction('fileVersion', '4.0.0'))
cconf_id = cdt_core + '.default.config.1'
self.add(doc, toolChain, 'targetPlatform', {'binaryParser': 'org.eclipse.cdt.core.ELF', 'id': cdt_bld + '.prefbase.toolchain.1', 'name': ''})
- waf_build = '"%s" %s'%(waf, eclipse.fun)
- waf_clean = '"%s" clean'%(waf)
+ waf_build = '"%s" %s'%(waf_executable, eclipse.fun)
+ waf_clean = '"%s" clean'%(waf_executable)
self.add(doc, toolChain, 'builder',
{'autoBuildTarget': waf_build,
'command': executable,
buildTargets = self.add(doc, storageModule, 'buildTargets')
def addTargetWrap(name, runAll):
return self.addTarget(doc, buildTargets, executable, name,
- '"%s" %s'%(waf, name), runAll)
+ '"%s" %s'%(waf_executable, name), runAll)
addTargetWrap('configure', True)
addTargetWrap('dist', False)
addTargetWrap('install', False)
doc.appendChild(pydevproject)
return doc
- def impl_create_javaproject(self, javasrcpath):
+ def impl_create_javaproject(self, javasrcpath, javalibpath):
# create a .classpath file for java usage
doc = Document()
javaproject = doc.createElement('classpath')
self.add(doc, javaproject, 'classpathentry',
{'kind': 'src', 'path': i})
+ if javalibpath:
+ for i in javalibpath:
+ self.add(doc, javaproject, 'classpathentry',
+ {'kind': 'lib', 'path': i})
+
self.add(doc, javaproject, 'classpathentry', {'kind': 'con', 'path': 'org.eclipse.jdt.launching.JRE_CONTAINER'})
self.add(doc, javaproject, 'classpathentry', {'kind': 'output', 'path': self.bldnode.name })
doc.appendChild(javaproject)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2017-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Tool to embed file into objects
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# encoding: utf-8
# Grygoriy Fuchedzhy 2009
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
#
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2008-2010 (ita)
--- /dev/null
+#!/usr/bin/env python
+# encoding: utf-8
+# Copyright Garmin International or its subsidiaries, 2018
+#
+# Heavily based on dbus.py
+
+"""
+Compiles dbus files with **gdbus-codegen**
+Typical usage::
+ def options(opt):
+ opt.load('compiler_c gdbus')
+ def configure(conf):
+ conf.load('compiler_c gdbus')
+ def build(bld):
+ tg = bld.program(
+ includes = '.',
+ source = bld.path.ant_glob('*.c'),
+ target = 'gnome-hello')
+ tg.add_gdbus_file('test.xml', 'com.example.example.', 'Example')
+"""
+
+from waflib import Task, Errors, Utils
+from waflib.TaskGen import taskgen_method, before_method
+
+@taskgen_method
+def add_gdbus_file(self, filename, prefix, namespace, export=False):
+ """
+ Adds a dbus file to the list of dbus files to process. Store them in the attribute *dbus_lst*.
+ :param filename: xml file to compile
+ :type filename: string
+ :param prefix: interface prefix (--interface-prefix=prefix)
+ :type prefix: string
+ :param mode: C namespace (--c-namespace=namespace)
+ :type mode: string
+ :param export: Export Headers?
+ :type export: boolean
+ """
+ if not hasattr(self, 'gdbus_lst'):
+ self.gdbus_lst = []
+ if not 'process_gdbus' in self.meths:
+ self.meths.append('process_gdbus')
+ self.gdbus_lst.append([filename, prefix, namespace, export])
+
+@before_method('process_source')
+def process_gdbus(self):
+ """
+ Processes the dbus files stored in the attribute *gdbus_lst* to create :py:class:`gdbus_binding_tool` instances.
+ """
+ output_node = self.path.get_bld().make_node(['gdbus', self.get_name()])
+ sources = []
+
+ for filename, prefix, namespace, export in getattr(self, 'gdbus_lst', []):
+ node = self.path.find_resource(filename)
+ if not node:
+ raise Errors.WafError('file not found ' + filename)
+ c_file = output_node.find_or_declare(node.change_ext('.c').name)
+ h_file = output_node.find_or_declare(node.change_ext('.h').name)
+ tsk = self.create_task('gdbus_binding_tool', node, [c_file, h_file])
+ tsk.cwd = output_node.abspath()
+
+ tsk.env.GDBUS_CODEGEN_INTERFACE_PREFIX = prefix
+ tsk.env.GDBUS_CODEGEN_NAMESPACE = namespace
+ tsk.env.GDBUS_CODEGEN_OUTPUT = node.change_ext('').name
+ sources.append(c_file)
+
+ if sources:
+ output_node.mkdir()
+ self.source = Utils.to_list(self.source) + sources
+ self.includes = [output_node] + self.to_incnodes(getattr(self, 'includes', []))
+ if export:
+ self.export_includes = [output_node] + self.to_incnodes(getattr(self, 'export_includes', []))
+
+class gdbus_binding_tool(Task.Task):
+ """
+ Compiles a dbus file
+ """
+ color = 'BLUE'
+ ext_out = ['.h', '.c']
+ run_str = '${GDBUS_CODEGEN} --interface-prefix ${GDBUS_CODEGEN_INTERFACE_PREFIX} --generate-c-code ${GDBUS_CODEGEN_OUTPUT} --c-namespace ${GDBUS_CODEGEN_NAMESPACE} --c-generate-object-manager ${SRC[0].abspath()}'
+ shell = True
+
+def configure(conf):
+ """
+ Detects the program gdbus-codegen and sets ``conf.env.GDBUS_CODEGEN``
+ """
+ conf.find_program('gdbus-codegen', var='GDBUS_CODEGEN')
+
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Halide code generation tool
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Federico Pellegrin, 2017 (fedepell)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# Issue 1185 ultrix gmail com
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Copyright Garmin International or its subsidiaries, 2012-2013
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Avalanche Studios 2009-2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011-2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# Grygoriy Fuchedzhy 2010
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2007-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Alexander Afanasyev (UCLA), 2014
if getattr(self, 'name', None):
try:
- task = self.bld.pch_tasks[self.name]
- self.bld.fatal("Duplicated 'pch' task with name %r" % self.name)
+ task = self.bld.pch_tasks["%s.%s" % (self.name, self.idx)]
+ self.bld.fatal("Duplicated 'pch' task with name %r" % "%s.%s" % (self.name, self.idx))
except KeyError:
pass
self.pch_task = task
if getattr(self, 'name', None):
- self.bld.pch_tasks[self.name] = task
+ self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] = task
@TaskGen.feature('cxx')
@TaskGen.after_method('process_source', 'propagate_uselib_vars')
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
#
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Antoine Dechaume 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Antoine Dechaume 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# per rosengren 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Philipp Bender, 2012
names.append(dep)
parse_node(node)
+ # Add also dependencies path to INCPATHS so protoc will find the included file
+ for deppath in nodes:
+ self.env.append_value('INCPATHS', deppath.parent.bldpath())
return (nodes, names)
@extension('.proto')
nodename += javacn + '.java'
else:
if self.env.PROTOC_MAJOR > '2' and node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() in messages:
- nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() + 'OuterClass.java'
+ nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + 'OuterClass.java'
else:
- nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() + '.java'
+ nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + '.java'
java_node = node.parent.find_or_declare(nodename)
out_nodes.append(java_node)
# For C++ standard include files dirs are used,
# but this doesn't apply to Python for example
for incpath in getattr(self, 'protoc_includes', []):
- incdirs.append(self.bld.path.find_node(incpath).bldpath())
+ incdirs.append(self.path.find_node(incpath).bldpath())
tsk.env.PROTOC_INCPATHS = incdirs
+ # PR2115: protoc generates output of .proto files in nested
+ # directories by canonicalizing paths. To avoid this we have to pass
+ # as first include the full directory file of the .proto file
+ tsk.env.prepend_value('INCPATHS', node.parent.bldpath())
+
use = getattr(self, 'use', '')
if not 'PROTOBUF' in use:
self.use = self.to_list(use) + ['PROTOBUF']
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Federico Pellegrin, 2016-2018 (fedepell) adapted for Python
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Calle Rosenquist, 2016-2018 (xbreak)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Jérôme Carretero 2011 (zougloub)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Remote Builds tool using rsync+ssh
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Laurent Birtz, 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Jérôme Carretero, 2013 (zougloub)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Mark Coggeshall, 2010
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# encoding: utf-8
# vim: tabstop=4 noexpandtab
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# Thomas Nagy, 2011 (ita)
@extension(*waflib.Tools.qt4.EXT_QT4)
def cxx_hook(self, node):
- self.create_compiled_task('cxx_qt', node)
+ return self.create_compiled_task('cxx_qt', node)
class cxx_qt(Task.classes['cxx']):
def runnable_status(self):
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# per rosengren 2011
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: UTF-8
# Thomas Nagy, 2006-2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2015 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: UTF-8
# Petar Forai
c_tsk.set_run_after(self)
- ge = self.generator.bld.producer
- ge.outstanding.append(c_tsk)
- ge.total += 1
+ # transfer weights from swig task to c task
+ if getattr(self, 'weight', None):
+ c_tsk.weight = self.weight
+ if getattr(self, 'tree_weight', None):
+ c_tsk.tree_weight = self.tree_weight
+
+ try:
+ self.more_tasks.append(c_tsk)
+ except AttributeError:
+ self.more_tasks = [c_tsk]
try:
ltask = self.generator.link_task
else:
ltask.set_run_after(c_tsk)
# setting input nodes does not declare the build order
- # because the build already started
+ # because the build already started, but it sets
+ # the dependency to enable rebuilds
ltask.inputs.append(c_tsk.outputs[0])
- # set the build order after the build started:
- ge.revdeps[c_tsk].add(ltask)
self.outputs.append(out_node)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# coding=utf-8
# Mathieu Courtois - EDF R&D, 2013 - http://www.code-aster.org
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: UTF-8
# Nicolas Joseph 2009
--- /dev/null
+#! /usr/bin/env python
+# encoding: utf-8
+
+"""
+Use extended attributes instead of database files
+
+1. Input files will be made writable
+2. This is only for systems providing extended filesystem attributes
+3. By default, hashes are calculated only if timestamp/size change (HASH_CACHE below)
+4. The module enables "deep_inputs" on all tasks by propagating task signatures
+5. This module also skips task signature comparisons for task code changes due to point 4.
+6. This module is for Python3/Linux only, but it could be extended to Python2/other systems
+ using the xattr library
+7. For projects in which tasks always declare output files, it should be possible to
+ store the rest of build context attributes on output files (imp_sigs, raw_deps and node_deps)
+ but this is not done here
+
+On a simple C++ project benchmark, the variations before and after adding waf_xattr.py were observed:
+total build time: 20s -> 22s
+no-op build time: 2.4s -> 1.8s
+pickle file size: 2.9MB -> 2.6MB
+"""
+
+import os
+from waflib import Logs, Node, Task, Utils, Errors
+from waflib.Task import SKIP_ME, RUN_ME, CANCEL_ME, ASK_LATER, SKIPPED, MISSING
+
+HASH_CACHE = True
+SIG_VAR = 'user.waf.sig'
+SEP = ','.encode()
+TEMPLATE = '%b%d,%d'.encode()
+
+try:
+ PermissionError
+except NameError:
+ PermissionError = IOError
+
+def getxattr(self):
+ return os.getxattr(self.abspath(), SIG_VAR)
+
+def setxattr(self, val):
+ os.setxattr(self.abspath(), SIG_VAR, val)
+
+def h_file(self):
+ try:
+ ret = getxattr(self)
+ except OSError:
+ if HASH_CACHE:
+ st = os.stat(self.abspath())
+ mtime = st.st_mtime
+ size = st.st_size
+ else:
+ if len(ret) == 16:
+ # for build directory files
+ return ret
+
+ if HASH_CACHE:
+ # check if timestamp and mtime match to avoid re-hashing
+ st = os.stat(self.abspath())
+ mtime, size = ret[16:].split(SEP)
+ if int(1000 * st.st_mtime) == int(mtime) and st.st_size == int(size):
+ return ret[:16]
+
+ ret = Utils.h_file(self.abspath())
+ if HASH_CACHE:
+ val = TEMPLATE % (ret, int(1000 * st.st_mtime), int(st.st_size))
+ try:
+ setxattr(self, val)
+ except PermissionError:
+ os.chmod(self.abspath(), st.st_mode | 128)
+ setxattr(self, val)
+ return ret
+
+def runnable_status(self):
+ bld = self.generator.bld
+ if bld.is_install < 0:
+ return SKIP_ME
+
+ for t in self.run_after:
+ if not t.hasrun:
+ return ASK_LATER
+ elif t.hasrun < SKIPPED:
+ # a dependency has an error
+ return CANCEL_ME
+
+ # first compute the signature
+ try:
+ new_sig = self.signature()
+ except Errors.TaskNotReady:
+ return ASK_LATER
+
+ if not self.outputs:
+ # compare the signature to a signature computed previously
+ # this part is only for tasks with no output files
+ key = self.uid()
+ try:
+ prev_sig = bld.task_sigs[key]
+ except KeyError:
+ Logs.debug('task: task %r must run: it was never run before or the task code changed', self)
+ return RUN_ME
+ if new_sig != prev_sig:
+ Logs.debug('task: task %r must run: the task signature changed', self)
+ return RUN_ME
+
+ # compare the signatures of the outputs to make a decision
+ for node in self.outputs:
+ try:
+ sig = node.h_file()
+ except EnvironmentError:
+ Logs.debug('task: task %r must run: an output node does not exist', self)
+ return RUN_ME
+ if sig != new_sig:
+ Logs.debug('task: task %r must run: an output node is stale', self)
+ return RUN_ME
+
+ return (self.always_run and RUN_ME) or SKIP_ME
+
+def post_run(self):
+ bld = self.generator.bld
+ sig = self.signature()
+ for node in self.outputs:
+ if not node.exists():
+ self.hasrun = MISSING
+ self.err_msg = '-> missing file: %r' % node.abspath()
+ raise Errors.WafError(self.err_msg)
+ os.setxattr(node.abspath(), 'user.waf.sig', sig)
+ if not self.outputs:
+ # only for task with no outputs
+ bld.task_sigs[self.uid()] = sig
+ if not self.keep_last_cmd:
+ try:
+ del self.last_cmd
+ except AttributeError:
+ pass
+
+try:
+ os.getxattr
+except AttributeError:
+ pass
+else:
+ h_file.__doc__ = Node.Node.h_file.__doc__
+
+ # keep file hashes as file attributes
+ Node.Node.h_file = h_file
+
+ # enable "deep_inputs" on all tasks
+ Task.Task.runnable_status = runnable_status
+ Task.Task.post_run = post_run
+ Task.Task.sig_deep_inputs = Utils.nada
+
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/python
# encoding: utf-8
# vim: tabstop=4 noexpandtab
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# XCode 3/XCode 4/XCode 6/Xcode 7 generator for Waf
# Some build settings are required to be present by XCode. We will supply default values
# if user hasn't defined any.
defaults_required = [('PRODUCT_NAME', '$(TARGET_NAME)')]
- for cfgname,settings in self.env.PROJ_CONFIGURATION.iteritems():
+ for cfgname,settings in self.env.PROJ_CONFIGURATION.items():
for default_var, default_val in defaults_required:
if default_var not in settings:
settings[default_var] = default_val
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010-2018 (ita)
-#! /usr/bin/env python
-# encoding: utf-8
-# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
-
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2016-2018 (ita)