def template_task(self, node): out = node.change_ext("") target = node.parent.declare(out.name) task = Task("template", inputs=[node], outputs=[target]) task.func = template task.env_vars = VARS["template"] task.env = self.env return [task]
def template_task(self, node): base = os.path.splitext(node)[0] target = os.path.join(self.env["BLDDIR"], base) task = Task("template", inputs=node, outputs=target) task.func = template task.env_vars = VARS["template"] task.env = self.env return [task]
def link_task(self, name): objects = [tsk.outputs[0] for tsk in self.object_tasks] target = os.path.join(self.env["BLDDIR"], name + ".so") ensure_dir(target) task = Task("cc_link", inputs=objects, outputs=target) task.env = self.env task.func = cshlink task.env_vars = cshlink_vars return [task]
def pycxx_task(self, node): base = self.env["CXX_OBJECT_FMT"] % node.name target = node.parent.declare(base) ensure_dir(target.abspath()) task = Task("pycxx", inputs=[node], outputs=[target]) task.gen = self task.env_vars = pycxx_vars task.env = self.env task.func = pycxx return [task]
def cython_task(self, node): base = os.path.splitext(node)[0] target = os.path.join(self.env["BLDDIR"], base + ".c") ensure_dir(target) task = Task("cython", inputs=node, outputs=target) task.env_vars = [] task.env = self.env task.func = compile_fun("cython", "cython ${SRC} -o ${TGT}", False)[0] compile_task = get_extension_hook(".c") ctask = compile_task(self, target) return [task] + ctask
def fcompile_task(self, node): base = "%s.o" % node.name target = node.parent.declare(base) ensure_dir(target.abspath()) task = Task("f77", inputs=[node], outputs=[target]) task.gen = self task.env_vars = f77_vars task.env = self.env task.func = f77_compile self.object_tasks.append(task) return [task]
def static_link_task(self, name): objects = [tsk.outputs[0] for tsk in self.object_tasks] folder, base = os.path.split(name) tmp = folder + os.path.sep + self.env["STATICLIB_FMT"] % base target = self.bld.bld_root.declare(tmp) ensure_dir(target.abspath()) task = Task("cc_link", inputs=objects, outputs=[target]) task.gen = self task.env = self.env task.func = clink task.env_vars = clink_vars return [task]
def ccompile_task(self, node): base = self.env["CC_OBJECT_FMT"] % node.name target = node.parent.declare(base) ensure_dir(target.abspath()) task = Task("cc", inputs=[node], outputs=[target]) task.gen = self task.env_vars = cc_vars #print find_deps("foo.c", ["."]) #task.scan = lambda : find_deps(node, ["."]) #task.deps.extend(task.scan()) task.env = self.env task.func = ccompile return [task]
def pycc_task(self, node): base = os.path.splitext(node)[0] # XXX: hack to avoid creating build/build/... when source is # generated. Dealing with this most likely requires a node concept if not os.path.commonprefix([self.env["BLDDIR"], base]): target = os.path.join(self.env["BLDDIR"], base + ".o") else: target = base + ".o" ensure_dir(target) task = Task("pycc", inputs=node, outputs=target) task.env_vars = pycc_vars task.env = self.env task.func = pycc return [task]
def cython_task(self, node): out = node.change_ext(".c") target = node.parent.declare(out.name) ensure_dir(target.name) task = Task("cython", inputs=[node], outputs=[target]) task.gen = self task.env_vars = [] task.env = self.env self.env["CYTHON_INCPATH"] = ["-I%s" % p for p in self.env["CYTHON_CPPPATH"]] task.func = compile_fun("cython", "${CYTHON} ${SRC} -o ${TGT} ${CYTHON_INCPATH}", False)[0] return [task]
def ccprogram_task(self, name): objects = [tsk.outputs[0] for tsk in self.object_tasks] def declare_target(): folder, base = os.path.split(name) tmp = folder + os.path.sep + self.env["PROGRAM_FMT"] % base return self.bld.bld_root.declare(tmp) target = declare_target() ensure_dir(target.abspath()) task = Task("ccprogram", inputs=objects, outputs=[target]) task.gen = self task.env = self.env task.func = ccprogram task.env_vars = ccprogram_vars return [task]
def swig_hook(self, name): # FIXME: only handle C extension (no C++) base = os.path.splitext(name)[0] target = os.path.join(self.env["BLDDIR"], base) targets = [target + "_wrap.c", target + ".py"] for t in targets: ensure_dir(t) task = Task("swig", inputs=name, outputs=targets) task.func = swig_func task.env_vars = swig_vars task.env = self.env compile_task = get_extension_hook(".c") ctask = compile_task(self, targets[0]) return [task] + ctask
def ccompile_task(self, node): base = os.path.splitext(node)[0] # XXX: hack to avoid creating build/build/... when source is # generated. Dealing with this most likely requires a node concept if not os.path.commonprefix([self.env["BLDDIR"], base]): target = os.path.join(self.env["BLDDIR"], base + ".o") else: target = base + ".o" ensure_dir(target) task = Task("cc", inputs=node, outputs=target) task.env_vars = cc_vars #print find_deps("foo.c", ["."]) #task.scan = lambda : find_deps(node, ["."]) #task.deps.extend(task.scan()) task.env = self.env task.func = ccompile return [task]
def fortran_task(self, node): base = os.path.splitext(node)[0] # XXX: hack to avoid creating build/build/... when source is # generated. Dealing with this most likely requires a node concept if not base.startswith(self.env["BLDDIR"]): target = os.path.join(self.env["BLDDIR"], base + ".o") else: target = base + ".o" ensure_dir(target) func, env_vars = compile_fun("f77", "${F77} ${F77FLAGS} -c ${SRC} -o ${TGT[0]}", False) task = Task("f77", inputs=node, outputs=target) task.env_vars = env_vars task.env = self.env task.func = func self.object_tasks.append(task) return [task]