示例#1
0
 def configure_cxx(self):
     # Gather various compiler parameters.
     cxx = self.get_lit_conf('cxx_under_test')
     self.cxx_is_clang_cl = cxx is not None and \
                            os.path.basename(cxx).startswith('clang-cl')
     # If no specific cxx_under_test was given, attempt to infer it as
     # clang++.
     if cxx is None or self.cxx_is_clang_cl:
         search_paths = self.config.environment['PATH']
         if cxx is not None and os.path.isabs(cxx):
             search_paths = os.path.dirname(cxx)
         clangxx = libcxx.util.which('clang++', search_paths)
         if clangxx:
             cxx = clangxx
             self.lit_config.note(
                 "inferred cxx_under_test as: %r" % cxx)
         elif self.cxx_is_clang_cl:
             self.lit_config.fatal('Failed to find clang++ substitution for'
                                   ' clang-cl')
     if not cxx:
         self.lit_config.fatal('must specify user parameter cxx_under_test '
                               '(e.g., --param=cxx_under_test=clang++)')
     self.cxx = CXXCompiler(self, cxx) if not self.cxx_is_clang_cl else \
                self._configure_clang_cl(cxx)
     self.cxx.compile_env = dict(os.environ)
示例#2
0
    def configure_cxx(self):
        # Gather various compiler parameters.
        cxx = self.get_lit_conf('cxx_under_test')

        # If no specific cxx_under_test was given, attempt to infer it as
        # clang++.
        if cxx is None:
            clangxx = lit.util.which('clang++',
                                     self.config.environment['PATH'])
            if clangxx:
                cxx = clangxx
                self.lit_config.note(
                    "inferred cxx_under_test as: %r" % cxx)
        if not cxx:
            self.lit_config.fatal('must specify user parameter cxx_under_test '
                                  '(e.g., --param=cxx_under_test=clang++)')
        self.cxx = CXXCompiler(cxx)
        cxx_type = self.cxx.type
        if cxx_type is not None:
            assert self.cxx.version is not None
            maj_v, min_v, _ = self.cxx.version
            self.config.available_features.add(cxx_type)
            self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
            self.config.available_features.add('%s-%s.%s' % (
                cxx_type, maj_v, min_v))
示例#3
0
 def configure_cxx(self):
     # Gather various compiler parameters.
     cxx = self.get_lit_conf('cxx_under_test')
     self.cxx_is_clang_cl = cxx is not None and \
                            os.path.basename(cxx) == 'clang-cl.exe'
     # If no specific cxx_under_test was given, attempt to infer it as
     # clang++.
     if cxx is None or self.cxx_is_clang_cl:
         clangxx = lit.util.which('clang++',
                                  self.config.environment['PATH'])
         if clangxx:
             cxx = clangxx
             self.lit_config.note("inferred cxx_under_test as: %r" % cxx)
         elif self.cxx_is_clang_cl:
             self.lit_config.fatal('Failed to find clang++ substitution for'
                                   ' clang-cl')
     if not cxx:
         self.lit_config.fatal('must specify user parameter cxx_under_test '
                               '(e.g., --param=cxx_under_test=clang++)')
     self.cxx = CXXCompiler(cxx) if not self.cxx_is_clang_cl else \
                self._configure_clang_cl(cxx)
     cxx_type = self.cxx.type
     if cxx_type is not None:
         assert self.cxx.version is not None
         maj_v, min_v, _ = self.cxx.version
         self.config.available_features.add(cxx_type)
         self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
         self.config.available_features.add('%s-%s.%s' %
                                            (cxx_type, maj_v, min_v))
     self.cxx.compile_env = dict(os.environ)
     # 'CCACHE_CPP2' prevents ccache from stripping comments while
     # preprocessing. This is required to prevent stripping of '-verify'
     # comments.
     self.cxx.compile_env['CCACHE_CPP2'] = '1'
示例#4
0
    def _configure_clang_cl(self, clang_path):
        def _split_env_var(var):
            return [p.strip() for p in os.environ.get(var, '').split(';') if p.strip()]

        def _prefixed_env_list(var, prefix):
            from itertools import chain
            return list(chain.from_iterable((prefix, path) for path in _split_env_var(var)))

        assert self.cxx_is_clang_cl
        flags = []
        compile_flags = []
        link_flags = _prefixed_env_list('LIB', '-L')
        return CXXCompiler(self, clang_path, flags=flags,
                           compile_flags=compile_flags,
                           link_flags=link_flags)
示例#5
0
文件: config.py 项目: exbibyte/libcxx
 def _configure_clang_cl(self, clang_path):
     assert self.cxx_is_clang_cl
     # FIXME: don't hardcode the target
     flags = ['--target=i686-pc-windows']
     compile_flags = []
     link_flags = ['-fuse-ld=lld']
     if 'INCLUDE' in os.environ:
         compile_flags += ['-isystem %s' % p.strip()
                           for p in os.environ['INCLUDE'].split(';')
                           if p.strip()]
     if 'LIB' in os.environ:
         link_flags += ['-L%s' % p.strip()
                        for p in os.environ['LIB'].split(';') if p.strip()]
     return CXXCompiler(clang_path, flags=flags,
                        compile_flags=compile_flags,
                        link_flags=link_flags)
示例#6
0
 def _configure_clang_cl(self, clang_path):
     assert self.cxx_is_clang_cl
     flags = []
     compile_flags = []
     link_flags = []
     if 'INCLUDE' in os.environ:
         compile_flags += [
             '-isystem %s' % p.strip()
             for p in os.environ['INCLUDE'].split(';') if p.strip()
         ]
     if 'LIB' in os.environ:
         for p in os.environ['LIB'].split(';'):
             p = p.strip()
             if not p:
                 continue
             link_flags += ['-L%s' % p]
             self.add_path(self.exec_env, p)
     return CXXCompiler(clang_path,
                        flags=flags,
                        compile_flags=compile_flags,
                        link_flags=link_flags)