コード例 #1
0
ファイル: tools.py プロジェクト: buharin/fastbuild_python
 def __compile_source(self, source):
     input_file_path = join(self.__main_dir, CONST.SRC_DIR, source)
     output_file_path = create_obj_path(self.__main_dir, source)
     command = [CONST.COMPILER, "-c", input_file_path, "-o", output_file_path, "-I" + self.include_path]
     for flag in CONST.COMPILER_FLAGS.split():
         command.append(flag)
     result = Popen(command, stdout=PIPE, stderr=PIPE)
     output = result.communicate()
     if result.returncode != 0:
         logging.error("Compiler error %s: %s", source, output[1].decode('UTF-8'))
         self.was_error()
     else:
         logging.debug("Rebuilding file %s complete", source)
         db_manager.set_rebuild_status(file=source, rebuild_status=False)
コード例 #2
0
ファイル: tools.py プロジェクト: buharin/fastbuild_python
    def link_executable(self):
        # command = "{0} -o {1} {2}".format(CONST.COMPILER, self.binary, ' '.join(output_list))
        command = [CONST.COMPILER, "-o", self.binary, "-L" + self.lib_path]
        lib_names = list()
        for lib_name in self.scanner.scan_for_libs(self.lib_path):
            lib_names.append("-l" + lib_name)
        for source in db_manager.scan_all_sources():
            command.append(create_obj_path(self.__main_dir, source))
        if hasattr(CONST, "LINKER_FLAGS"):
            command.append(CONST.LINKER_FLAGS)
        command.append(" ".join(lib_names))

        result = Popen(command, stdout=PIPE, stderr=PIPE)
        output = result.communicate()
        if result.returncode == 0:
            logging.info("Linking complete %s", self.binary)
            # db_manager.set_linker_status(True)
        else:
            logging.error("Linker error: %s", output[1].decode('UTF-8'))