Beispiel #1
0
def configure():
    debug = value('debug', False)
    yield cpp.find_cxx(debug=debug)

    inc = get_includes()
    inc.append('/usr/include')
    cli = cpp.CompilerCli(cpp.DEFAULT_COMPILER)
    cflags = [cli.position_independent_code, '-DPIC', '-pthread', cli.enable_exceptions, '-std=gnu++14']
    if debug:
        cflags += ['-g', '-O0', '-DDEBUG', '-DQT_QML_DEBUG']
    else:
        cflags += ['-O3', '-DNDEBUG']
    node(':config').write({
        'includes': inc,
        'debug': debug,
        'libraries': ['capnp', 'kj', 'zmq'],
        'cflags': cflags
    })
    name = re.compile('libpython3\.(?P<minor>[0-9]).*?\.so')
    yield find(name, dirs='/usr/lib', argprefix='libraries').produce(':python-lib')
    name = re.compile('python3\.(?P<minor>[0-9]).*?$')
    yield find(name, dirs='/usr/include', argprefix='includes').produce(':python-includes')
    node(':python-pybind11').write({
        'includes': 'submodules/pybind11/include'
    })
    yield collect(':python-lib', ':python-includes', ':python-pybind11').produce(':python')
Beispiel #2
0
def configure():
    debug = value('debug', False)
    build_type = 'debug' if debug else 'release'
    native_arch = 'x64' if osinfo.x64 else 'x86'
    arch = value('msvc_arch') or native_arch
    capnpdir = directory('3rdparty/capnproto/windows/')
    capnplibdir = capnpdir.join(arch + '-' + build_type)
    inc = get_includes()
    inc.append('submodules/capnproto/c++/src')
    cli = cpp.CompilerCli(cpp.DEFAULT_COMPILER)

    node(':config').write({
        'includes': inc,
        'debug': debug,
        'libraries': [capnplibdir.join('capnp.lib'), capnplibdir.join('kj.lib')],
        'defines': 'CAPNP_LITE',
        'cflags': cli.default_flags(debug=debug, arch=arch)
    })
    python_dir = value('python_dir')
    if python_dir is None:
        raise CommandFailedError("Be sure to specify the `python_dir` argument somewhere!")
    python_dir = directory(python_dir)
    node(':python').write({
        'includes': python_dir.join('include'),
        'libraries': python_dir.join('libs/python35.lib'),
        })
Beispiel #3
0
 def __init__(self, source, target=None):
     f = file(source)
     if target is None:
         target = node(':cpp/{0}'.format(str(f)))
     super().__init__(sources=f, targets=target)
     self._target_node = target
     self._f = f
     self.arguments.add(includes=[])
Beispiel #4
0
 def value(self):
     n = node(':latch/' + self._key)
     if ctx.options[self._on_option].value:
         n.write({
             'value': True
         })
     elif ctx.options[self._off_option].value:
         n.write({
             'value': False
         })
     return n.read().value('value', self._default)
Beispiel #5
0
 def _init(self):
     self._compilername = DEFAULT_COMPILER
     if self._compilername == 'msvc':
         self._printer = MsvcCompilerPrinter(self)
     for src in self.sources:
         if not isinstance(src, FileNode):
             continue
         is_csrc = [str(src).endswith(ext) for ext in self.extensions]
         if any(is_csrc):
             self.arguments['csource'] = str(src)
             headers = node(':cpp/{0}'.format(src)).read().value('headers', [])
             self.sources.extend(nodes(headers))
             return