def _extension(self, task_gen, name): bld = self.ctx base = name.replace(".", os.sep) tasks = [] old_hook = set_extension_hook(".c", pycc_hook) old_hook_cxx = set_extension_hook(".cxx", pycxx_hook) apply_define(task_gen) apply_cpppath(task_gen) apply_libpath(task_gen) apply_libs(task_gen) apply_frameworks(task_gen) tasks = task_gen.process() ltask = pylink_task(task_gen, base) task_gen.link_task = ltask if task_gen.has_cxx: task_gen.link_task[-1].func = pycxxlink task_gen.link_task[-1].env_vars = pycxxlink_vars tasks.extend(ltask) for t in tasks: t.env = task_gen.env set_extension_hook(".c", old_hook) set_extension_hook(".cxx", old_hook_cxx) return tasks
def _compile(self, task_gen, name): apply_define(task_gen) apply_cpppath(task_gen) tasks = task_gen.process() for t in tasks: t.env = task_gen.env return tasks
def ccompile(self, name, sources, env=None): task_gen = CompiledTaskGen("cxccompile", self.ctx, sources, name) task_gen.env = yaku.tools._merge_env(self.env, env) apply_define(task_gen) apply_cpppath(task_gen) tasks = task_gen.process() for t in tasks: t.env = task_gen.env self.ctx.tasks.extend(tasks) outputs = [] for t in tasks: outputs.extend(t.outputs) return outputs
def program(self, name, sources, env=None): sources = [self.ctx.src_root.find_resource(s) for s in sources] task_gen = CompiledTaskGen("cxxprogram", self.ctx, sources, name) task_gen.env = yaku.tools._merge_env(self.env, env) apply_define(task_gen) apply_cpppath(task_gen) apply_libdir(task_gen) apply_libs(task_gen) tasks = task_gen.process() ltask = cxxprogram_task(task_gen, name) tasks.extend(ltask) for t in tasks: t.env = task_gen.env self.ctx.tasks.extend(tasks) self.link_task = ltask outputs = [] for t in ltask: outputs.extend(t.outputs) return outputs