本文整理汇总了Python中libcxx.compiler.CXXCompiler类的典型用法代码示例。如果您正苦于以下问题:Python CXXCompiler类的具体用法?Python CXXCompiler怎么用?Python CXXCompiler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CXXCompiler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure_cxx
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'
示例2: configure_cxx
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: Configuration
#.........这里部分代码省略.........
selt.lit_config.fatal("Cannot infer how to create a Valgrind "
" executor.")
else:
te = LocalExecutor()
if self.lit_config.useValgrind:
te = ValgrindExecutor(self.lit_config.valgrindArgs, te)
self.executor = te
def configure_target_info(self):
default = "libcxx.test.target_info.LocalTI"
info_str = self.get_lit_conf('target_info', default)
mod_path, _, info = info_str.rpartition('.')
mod = importlib.import_module(mod_path)
self.target_info = getattr(mod, info)()
if info_str != default:
self.lit_config.note("inferred target_info as: %r" % info_str)
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.%s' % (
cxx_type, maj_v, min_v))
def configure_src_root(self):
self.libcxx_src_root = self.get_lit_conf(
'libcxx_src_root', os.path.dirname(self.config.test_source_root))
def configure_obj_root(self):
self.libcxx_obj_root = self.get_lit_conf('libcxx_obj_root')
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf('cxx_library_root',
self.libcxx_obj_root)
def configure_use_system_cxx_lib(self):
# This test suite supports testing against either the system library or
# the locally built one; the former mode is useful for testing ABI
# compatibility between the current headers and a shipping dynamic
# library.
self.use_system_cxx_lib = self.get_lit_bool('use_system_cxx_lib')
if self.use_system_cxx_lib is None:
# Default to testing against the locally built libc++ library.
self.use_system_cxx_lib = False
self.lit_config.note(
"inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib)
def configure_use_clang_verify(self):
示例4: Configuration
#.........这里部分代码省略.........
# that the user wants it at the end, but we have no
# way of getting at that easily.
selt.lit_config.fatal("Cannot infer how to create a Valgrind " " executor.")
else:
te = LocalExecutor()
if self.lit_config.useValgrind:
te = ValgrindExecutor(self.lit_config.valgrindArgs, te)
self.executor = te
def configure_target_info(self):
default = "libcxx.test.target_info.LocalTI"
info_str = self.get_lit_conf("target_info", default)
mod_path, _, info = info_str.rpartition(".")
mod = importlib.import_module(mod_path)
self.target_info = getattr(mod, info)()
if info_str != default:
self.lit_config.note("inferred target_info as: %r" % info_str)
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.%s" % (cxx_type, maj_v, min_v))
def configure_src_root(self):
self.libcxx_src_root = self.get_lit_conf("libcxx_src_root", os.path.dirname(self.config.test_source_root))
def configure_obj_root(self):
self.libcxx_obj_root = self.get_lit_conf("libcxx_obj_root")
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf("cxx_library_root", self.libcxx_obj_root)
def configure_use_system_cxx_lib(self):
# This test suite supports testing against either the system library or
# the locally built one; the former mode is useful for testing ABI
# compatibility between the current headers and a shipping dynamic
# library.
self.use_system_cxx_lib = self.get_lit_bool("use_system_cxx_lib")
if self.use_system_cxx_lib is None:
# Default to testing against the locally built libc++ library.
self.use_system_cxx_lib = False
self.lit_config.note("inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib)
def configure_use_clang_verify(self):
"""If set, run clang with -verify on failing tests."""
self.use_clang_verify = self.get_lit_bool("use_clang_verify")
if self.use_clang_verify is None:
# NOTE: We do not test for the -verify flag directly because
示例5: Configuration
#.........这里部分代码省略.........
te = eval(exec_str)
if te:
self.lit_config.note("Using executor: %r" % exec_str)
if self.lit_config.useValgrind:
# We have no way of knowing where in the chain the
# ValgrindExecutor is supposed to go. It is likely
# that the user wants it at the end, but we have no
# way of getting at that easily.
selt.lit_config.fatal("Cannot infer how to create a Valgrind " " executor.")
else:
te = LocalExecutor()
if self.lit_config.useValgrind:
te = ValgrindExecutor(self.lit_config.valgrindArgs, te)
self.executor = te
def configure_target_info(self):
self.target_info = make_target_info(self)
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.%s" % (cxx_type, maj_v, min_v))
def configure_src_root(self):
self.libcxx_src_root = self.get_lit_conf("libcxx_src_root", os.path.dirname(self.config.test_source_root))
def configure_obj_root(self):
self.project_obj_root = self.get_lit_conf("project_obj_root")
self.libcxx_obj_root = self.get_lit_conf("libcxx_obj_root")
if not self.libcxx_obj_root and self.project_obj_root is not None:
possible_root = os.path.join(self.project_obj_root, "projects", "libcxx")
if os.path.isdir(possible_root):
self.libcxx_obj_root = possible_root
else:
self.libcxx_obj_root = self.project_obj_root
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf("cxx_library_root", self.libcxx_obj_root)
self.cxx_runtime_root = self.get_lit_conf("cxx_runtime_root", self.cxx_library_root)
def configure_use_system_cxx_lib(self):
# This test suite supports testing against either the system library or
# the locally built one; the former mode is useful for testing ABI
# compatibility between the current headers and a shipping dynamic
# library.
self.use_system_cxx_lib = self.get_lit_bool("use_system_cxx_lib")
if self.use_system_cxx_lib is None:
# Default to testing against the locally built libc++ library.
示例6: Configuration
#.........这里部分代码省略.........
# that the user wants it at the end, but we have no
# way of getting at that easily.
selt.lit_config.fatal("Cannot infer how to create a Valgrind "
" executor.")
else:
te = LocalExecutor()
if self.lit_config.useValgrind:
te = ValgrindExecutor(self.lit_config.valgrindArgs, te)
self.executor = te
def configure_target_info(self):
self.target_info = make_target_info(self)
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'
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)
示例7: Configuration
#.........这里部分代码省略.........
self.lit_config.note("Using executor: %r" % exec_str)
if self.lit_config.useValgrind:
# We have no way of knowing where in the chain the
# ValgrindExecutor is supposed to go. It is likely
# that the user wants it at the end, but we have no
# way of getting at that easily.
selt.lit_config.fatal("Cannot infer how to create a Valgrind "
" executor.")
else:
te = LocalExecutor()
if self.lit_config.useValgrind:
te = ValgrindExecutor(self.lit_config.valgrindArgs, te)
self.executor = te
def configure_target_info(self):
self.target_info = make_target_info(self)
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.%s' % (
cxx_type, maj_v, min_v))
def configure_src_root(self):
self.libcxx_src_root = self.get_lit_conf(
'libcxx_src_root', os.path.dirname(self.config.test_source_root))
def configure_obj_root(self):
self.project_obj_root = self.get_lit_conf('project_obj_root')
self.libcxx_obj_root = self.get_lit_conf('libcxx_obj_root')
if not self.libcxx_obj_root and self.project_obj_root is not None:
possible_root = os.path.join(self.project_obj_root, 'projects', 'libcxx')
if os.path.isdir(possible_root):
self.libcxx_obj_root = possible_root
else:
self.libcxx_obj_root = self.project_obj_root
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf('cxx_library_root',
self.libcxx_obj_root)
def configure_use_system_cxx_lib(self):
# This test suite supports testing against either the system library or
# the locally built one; the former mode is useful for testing ABI
# compatibility between the current headers and a shipping dynamic
# library.
self.use_system_cxx_lib = self.get_lit_bool('use_system_cxx_lib')