Improve CMake and LIT support for Windows
This patch contains multiple cleanups and fixes to better support building on Windows. * [Test] Fix handling of library runtime search paths by correctly adding them to the PATH variable when running the tests. * [Test] Don't explicitly force "--target=i686-pc-windows" when running the test suite. Clang++ seems to deduce the correct target. * [Test] Fix `.sh.cpp` tests on Windows by properly escaping flags used in shell commands. Specifically windows style paths which included spaces were causing these tests to fail. * [CMake] Add "vcruntime" to the list of supported C++ ABI libraries in CMake, and teach the test suite how to handle it. For now libc++ defaults to using "vcruntime" on Windows except when libc++abi is in tree; That is probably a bug and should be changed to always use vcruntime, at least for now. * [Misc] Move the "c++-build" include directory to the libc++ binary dir instead of the top level project dir and rename it "c++build". This is just misc cleanup. Libc++ shouldn't be creating internal build files and directories at the top-level projects root. * [Misc] Build type_info's destructor when building for MSVC. This is a temporary work around to prevent link errors until we have a proper type_info implementation. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -11,6 +11,7 @@ import locale
|
||||
import os
|
||||
import platform
|
||||
import pkgutil
|
||||
import pipes
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
@@ -218,8 +219,7 @@ class Configuration(object):
|
||||
|
||||
def _configure_clang_cl(self, clang_path):
|
||||
assert self.cxx_is_clang_cl
|
||||
# FIXME: don't hardcode the target
|
||||
flags = ['--target=i686-pc-windows']
|
||||
flags = []
|
||||
compile_flags = []
|
||||
link_flags = []
|
||||
if 'INCLUDE' in os.environ:
|
||||
@@ -227,8 +227,12 @@ class Configuration(object):
|
||||
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()]
|
||||
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)
|
||||
@@ -472,7 +476,7 @@ class Configuration(object):
|
||||
self.cxx.compile_flags += ['-I' + cxx_headers]
|
||||
if self.libcxx_obj_root is not None:
|
||||
cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include',
|
||||
'c++-build')
|
||||
'c++build')
|
||||
if os.path.isdir(cxxabi_headers):
|
||||
self.cxx.compile_flags += ['-I' + cxxabi_headers]
|
||||
|
||||
@@ -677,6 +681,10 @@ class Configuration(object):
|
||||
self.cxx.link_flags += ['-lc++abi']
|
||||
elif cxx_abi == 'libcxxrt':
|
||||
self.cxx.link_flags += ['-lcxxrt']
|
||||
elif cxx_abi == 'vcruntime':
|
||||
debug_suffix = 'd' if self.debug_build else ''
|
||||
self.cxx.link_flags += ['-l%s%s' % (lib, debug_suffix) for lib in
|
||||
['vcruntime', 'ucrt', 'msvcrt']]
|
||||
elif cxx_abi == 'none' or cxx_abi == 'default':
|
||||
if self.is_windows:
|
||||
debug_suffix = 'd' if self.debug_build else ''
|
||||
@@ -854,9 +862,9 @@ class Configuration(object):
|
||||
# Configure compiler substitutions
|
||||
sub.append(('%cxx', self.cxx.path))
|
||||
# Configure flags substitutions
|
||||
flags_str = ' '.join(self.cxx.flags)
|
||||
compile_flags_str = ' '.join(self.cxx.compile_flags)
|
||||
link_flags_str = ' '.join(self.cxx.link_flags)
|
||||
flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags])
|
||||
compile_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.compile_flags])
|
||||
link_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.link_flags])
|
||||
all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
|
||||
sub.append(('%flags', flags_str))
|
||||
sub.append(('%compile_flags', compile_flags_str))
|
||||
@@ -883,9 +891,11 @@ class Configuration(object):
|
||||
sub.append(('%link', link_str))
|
||||
sub.append(('%build', build_str))
|
||||
# Configure exec prefix substitutions.
|
||||
exec_env_str = 'env ' if len(self.exec_env) != 0 else ''
|
||||
for k, v in self.exec_env.items():
|
||||
exec_env_str += ' %s=%s' % (k, v)
|
||||
exec_env_str = ''
|
||||
if not self.is_windows and len(self.exec_env) != 0:
|
||||
exec_env_str = 'env '
|
||||
for k, v in self.exec_env.items():
|
||||
exec_env_str += ' %s=%s' % (k, v)
|
||||
# Configure run env substitution.
|
||||
exec_str = exec_env_str
|
||||
if self.lit_config.useValgrind:
|
||||
|
||||
@@ -140,6 +140,7 @@ class LibcxxTestFormat(object):
|
||||
# We can't run ShTest tests with a executor yet.
|
||||
# For now, bail on trying to run them
|
||||
return lit.Test.UNSUPPORTED, 'ShTest format not yet supported'
|
||||
test.config.enviroment = dict(self.exec_env)
|
||||
return lit.TestRunner._runShTest(test, lit_config,
|
||||
self.execute_external, script,
|
||||
tmpBase)
|
||||
|
||||
Reference in New Issue
Block a user