示例#1
0
文件: cc.py 项目: robionica/b3
 def _link(self, objects, output_dir=None, libraries=None, library_dirs=None,
             debug=False, extra_preargs=None, extra_postargs=None,
             target_lang=None):
   objects, output_dir, libraries, library_dirs = \
       self._setup_link(objects, output_dir, libraries, library_dirs)
   lib_options = self._gen_lib_options(library_dirs, libraries)
   # Finalize linker options
   ld_options = self._gen_ld_options(debug, extra_preargs)
   if extra_postargs:
     ld_options.extend(extra_postargs)
   ld_options += (objects + lib_options + ['-o', self.get_output_filename()])
   if not os.path.exists(self.get_output_dir()):
     os.makedirs(self.get_output_dir())
   try:
     linker = self.get_executable()
     # skip over environment variable settings if /usr/bin/env is used to set
     # up the linker's environment. This is needed on OSX. Note: this
     # assumes that the normal and C++ compiler have the same environment
     # settings.
     i = 0
     if os.path.basename(linker[0]) == "env":
       i = 1
       while "=" in linker[i]:
         i = i + 1
     # TODO: resolve this
     #linker[i] = self.get_executable('compiler_cxx')[i]
     spawn.spawn([linker] + ld_options, debug=self.get_verbosity_level(),
                 dry_run=self.is_dry_run_mode_enabled())
   except Exception, e:
     raise Exception, e
示例#2
0
 def run(self, dry_run=False):
   dry_run = self.is_dry_run_mode_enabled() or dry_run
   exe = self.get_executable()
   try:
     spawn.spawn([exe] + self.get_options(),
                 debug=self.get_verbosity_level(), dry_run=dry_run)
   except spawn.ExecutionError, msg:
     raise Exception(msg)
示例#3
0
文件: cc.py 项目: robionica/b3
 def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
   compiler = self.get_executable()
   try:
     spawn.spawn([compiler] + cc_args + [src, '-o', obj] + extra_postargs,
                 debug=self.get_verbosity_level(),
                 dry_run=self.is_dry_run_mode_enabled())
   except spawn.ExecutionError, msg:
     raise Exception(msg) # CompileError