def build(self, filenames, cl_args=None, link_args=None,
              x64=False, out_dir=''):
        """
        Compile source files and link object files.
        """
        if not cl_args:
            cl_args = []
        if not link_args:
            link_args = []
        msvc, lib = self.vc.get_bin_and_lib(x64)
        lib = self.make_lib(lib)
        if out_dir:
            cl_args.append('/Fo:' + out_dir + '\\')
        include = self.make_inc(self.vc.inc + self.sdk.inc)
        cl_args.extend(include + filenames)
        try:
            msvc.run_cl('/c', *cl_args)
        except CalledProcessError as error:
            logging.error(_('failed to compile: %s'), filenames)
            logging.error(_('cl.exe returned:\n%s'), error.output)
            return False
        link_args.extend(lib + self.make_objs(filenames, out_dir))
        try:
            msvc.run_link(*link_args)
        except CalledProcessError as error:
            logging.error(_('failed to link: %s'), filenames)
            logging.error(_('link.exe returned:\n%s'), error.output)
            return False
        return True
def build ( self , filenames , cl_args = None , link_args = None , x64 = False , out_dir = '' ) : if not cl_args : cl_args = [ ] if not link_args : link_args = [ ] msvc , lib = self . vc . get_bin_and_lib ( x64 ) lib = self . make_lib ( lib ) if out_dir : cl_args . append ( '/Fo:' + out_dir + '\\' ) include = self . make_inc ( self . vc . inc + self . sdk . inc ) cl_args . extend ( include + filenames ) try : msvc . run_cl ( '/c' , * cl_args ) except CalledProcessError as error : logging . error ( _ ( 'failed to compile: %s' ) , filenames ) logging . error ( _ ( 'cl.exe returned:\n%s' ) , error . output ) return False link_args . extend ( lib + self . make_objs ( filenames , out_dir ) ) try : msvc . run_link ( * link_args ) except CalledProcessError as error : logging . error ( _ ( 'failed to link: %s' ) , filenames ) logging . error ( _ ( 'link.exe returned:\n%s' ) , error . output ) return False return True
Compile source files and link object files.