mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 20:29:39 +08:00
Add hack to get --param=enable_modules=true working with a __config_site header
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -108,6 +108,11 @@ class Configuration(object):
|
|||||||
return check_value(val, env_var)
|
return check_value(val, env_var)
|
||||||
return check_value(conf_val, name)
|
return check_value(conf_val, name)
|
||||||
|
|
||||||
|
def get_modules_enabled(self):
|
||||||
|
return self.get_lit_bool('enable_modules',
|
||||||
|
default=False,
|
||||||
|
env_var='LIBCXX_ENABLE_MODULES')
|
||||||
|
|
||||||
def make_static_lib_name(self, name):
|
def make_static_lib_name(self, name):
|
||||||
"""Return the full filename for the specified library name"""
|
"""Return the full filename for the specified library name"""
|
||||||
if self.is_windows:
|
if self.is_windows:
|
||||||
@@ -602,6 +607,7 @@ class Configuration(object):
|
|||||||
return
|
return
|
||||||
config_site_header = os.path.join(self.libcxx_obj_root, '__config_site')
|
config_site_header = os.path.join(self.libcxx_obj_root, '__config_site')
|
||||||
if not os.path.isfile(config_site_header):
|
if not os.path.isfile(config_site_header):
|
||||||
|
assert False
|
||||||
return
|
return
|
||||||
contained_macros = self.parse_config_site_and_add_features(
|
contained_macros = self.parse_config_site_and_add_features(
|
||||||
config_site_header)
|
config_site_header)
|
||||||
@@ -631,9 +637,19 @@ class Configuration(object):
|
|||||||
# The __config_site header should be non-empty. Otherwise it should
|
# The __config_site header should be non-empty. Otherwise it should
|
||||||
# have never been emitted by CMake.
|
# have never been emitted by CMake.
|
||||||
assert len(feature_macros) > 0
|
assert len(feature_macros) > 0
|
||||||
|
# FIXME: This is a hack that should be fixed using module maps (or something)
|
||||||
|
# If modules are enabled then we have to lift all of the definitions
|
||||||
|
# in __config_site onto the command line.
|
||||||
|
modules_enabled = self.get_modules_enabled()
|
||||||
|
self.cxx.compile_flags += ['-Wno-macro-redefined']
|
||||||
# Transform each macro name into the feature name used in the tests.
|
# Transform each macro name into the feature name used in the tests.
|
||||||
# Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads
|
# Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads
|
||||||
for m in feature_macros:
|
for m in feature_macros:
|
||||||
|
if modules_enabled:
|
||||||
|
define = '-D%s' % m
|
||||||
|
if feature_macros[m]:
|
||||||
|
define += '=%s' % (feature_macros[m])
|
||||||
|
self.cxx.compile_flags += [define]
|
||||||
if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS':
|
if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS':
|
||||||
continue
|
continue
|
||||||
if m == '_LIBCPP_ABI_VERSION':
|
if m == '_LIBCPP_ABI_VERSION':
|
||||||
@@ -976,9 +992,7 @@ class Configuration(object):
|
|||||||
if platform.system() != 'Darwin':
|
if platform.system() != 'Darwin':
|
||||||
modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility']
|
modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility']
|
||||||
supports_modules = self.cxx.hasCompileFlag(modules_flags)
|
supports_modules = self.cxx.hasCompileFlag(modules_flags)
|
||||||
enable_modules = self.get_lit_bool('enable_modules',
|
enable_modules = self.get_modules_enabled()
|
||||||
default=False,
|
|
||||||
env_var='LIBCXX_ENABLE_MODULES')
|
|
||||||
if enable_modules and not supports_modules:
|
if enable_modules and not supports_modules:
|
||||||
self.lit_config.fatal(
|
self.lit_config.fatal(
|
||||||
'-fmodules is enabled but not supported by the compiler')
|
'-fmodules is enabled but not supported by the compiler')
|
||||||
|
|||||||
Reference in New Issue
Block a user