Refactor configure_compile_flags. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7819fd7108
commit
fa08adae13
@ -268,28 +268,14 @@ class Configuration(object):
|
|||||||
self.config.available_features.add(std)
|
self.config.available_features.add(std)
|
||||||
# Configure include paths
|
# Configure include paths
|
||||||
self.compile_flags += ['-nostdinc++']
|
self.compile_flags += ['-nostdinc++']
|
||||||
self.compile_flags += ['-I' + self.src_root + '/test/support']
|
self.configure_compile_flags_header_includes()
|
||||||
libcxx_headers = self.get_lit_conf('libcxx_headers',
|
|
||||||
self.src_root + '/include')
|
|
||||||
if not os.path.isdir(libcxx_headers):
|
|
||||||
self.lit_config.fatal("libcxx_headers='%s' is not a directory."
|
|
||||||
% libcxx_headers)
|
|
||||||
self.compile_flags += ['-I' + libcxx_headers]
|
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'):
|
||||||
self.compile_flags += ['-D__STDC_FORMAT_MACROS',
|
self.compile_flags += ['-D__STDC_FORMAT_MACROS',
|
||||||
'-D__STDC_LIMIT_MACROS',
|
'-D__STDC_LIMIT_MACROS',
|
||||||
'-D__STDC_CONSTANT_MACROS']
|
'-D__STDC_CONSTANT_MACROS']
|
||||||
# Configure feature flags.
|
# Configure feature flags.
|
||||||
enable_exceptions = self.get_lit_bool('enable_exceptions', True)
|
self.configure_compile_flags_exceptions()
|
||||||
if enable_exceptions:
|
self.configure_compile_flags_rtti()
|
||||||
self.config.available_features.add('exceptions')
|
|
||||||
else:
|
|
||||||
self.compile_flags += ['-fno-exceptions']
|
|
||||||
enable_rtti = self.get_lit_bool('enable_rtti', True)
|
|
||||||
if enable_rtti:
|
|
||||||
self.config.available_features.add('rtti')
|
|
||||||
else:
|
|
||||||
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
|
||||||
enable_32bit = self.get_lit_bool('enable_32bit', False)
|
enable_32bit = self.get_lit_bool('enable_32bit', False)
|
||||||
if enable_32bit:
|
if enable_32bit:
|
||||||
self.compile_flags += ['-m32']
|
self.compile_flags += ['-m32']
|
||||||
@ -298,12 +284,9 @@ class Configuration(object):
|
|||||||
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock',
|
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock',
|
||||||
True)
|
True)
|
||||||
if not enable_threads:
|
if not enable_threads:
|
||||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
|
self.configure_compile_flags_no_threads()
|
||||||
self.config.available_features.add('libcpp-has-no-threads')
|
|
||||||
if not enable_monotonic_clock:
|
if not enable_monotonic_clock:
|
||||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
|
self.configure_compile_flags_no_monotonic_clock()
|
||||||
self.config.available_features.add(
|
|
||||||
'libcpp-has-no-monotonic-clock')
|
|
||||||
elif not enable_monotonic_clock:
|
elif not enable_monotonic_clock:
|
||||||
self.lit_config.fatal('enable_monotonic_clock cannot be false when'
|
self.lit_config.fatal('enable_monotonic_clock cannot be false when'
|
||||||
' enable_threads is true.')
|
' enable_threads is true.')
|
||||||
@ -313,6 +296,37 @@ class Configuration(object):
|
|||||||
compile_flags_str = self.get_lit_conf('compile_flags', '')
|
compile_flags_str = self.get_lit_conf('compile_flags', '')
|
||||||
self.compile_flags += shlex.split(compile_flags_str)
|
self.compile_flags += shlex.split(compile_flags_str)
|
||||||
|
|
||||||
|
def configure_compile_flags_header_includes(self):
|
||||||
|
self.compile_flags += ['-I' + self.src_root + '/test/support']
|
||||||
|
libcxx_headers = self.get_lit_conf('libcxx_headers',
|
||||||
|
self.src_root + '/include')
|
||||||
|
if not os.path.isdir(libcxx_headers):
|
||||||
|
self.lit_config.fatal("libcxx_headers='%s' is not a directory."
|
||||||
|
% libcxx_headers)
|
||||||
|
self.compile_flags += ['-I' + libcxx_headers]
|
||||||
|
|
||||||
|
def configure_compile_flags_exceptions(self):
|
||||||
|
enable_exceptions = self.get_lit_bool('enable_exceptions', True)
|
||||||
|
if enable_exceptions:
|
||||||
|
self.config.available_features.add('exceptions')
|
||||||
|
else:
|
||||||
|
self.compile_flags += ['-fno-exceptions']
|
||||||
|
|
||||||
|
def configure_compile_flags_rtti(self):
|
||||||
|
enable_rtti = self.get_lit_bool('enable_rtti', True)
|
||||||
|
if enable_rtti:
|
||||||
|
self.config.available_features.add('rtti')
|
||||||
|
else:
|
||||||
|
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
||||||
|
|
||||||
|
def configure_compile_flags_no_threads(self):
|
||||||
|
self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
|
||||||
|
self.config.available_features.add('libcpp-has-no-threads')
|
||||||
|
|
||||||
|
def configure_compile_flags_no_monotonic_clock(self):
|
||||||
|
self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
|
||||||
|
self.config.available_features.add('libcpp-has-no-monotonic-clock')
|
||||||
|
|
||||||
def configure_link_flags(self):
|
def configure_link_flags(self):
|
||||||
self.link_flags += ['-nodefaultlibs']
|
self.link_flags += ['-nodefaultlibs']
|
||||||
libcxx_library = self.get_lit_conf('libcxx_library')
|
libcxx_library = self.get_lit_conf('libcxx_library')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user