Fix MSVC builds.

pull/2397/head
Jussi Pakkanen 7 years ago
parent b3362e350a
commit cb64a3f07a
  1. 4
      mesonbuild/backend/backends.py
  2. 8
      run_unittests.py

@ -306,7 +306,7 @@ class Backend:
if len(la) == 1 and la[0].startswith(self.environment.get_source_dir()): if len(la) == 1 and la[0].startswith(self.environment.get_source_dir()):
# The only link argument is an absolute path to a library file. # The only link argument is an absolute path to a library file.
libpath = la[0] libpath = la[0]
if not(libpath.lower().endswith('.dll') or libpath.lower().endswith('.so')): if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so']:
continue continue
absdir = os.path.split(libpath)[0] absdir = os.path.split(libpath)[0]
rel_to_src = absdir[len(self.environment.get_source_dir())+1:] rel_to_src = absdir[len(self.environment.get_source_dir())+1:]
@ -530,6 +530,8 @@ class Backend:
dirseg = os.path.join(self.environment.get_build_dir(), self.get_target_dir(ld)) dirseg = os.path.join(self.environment.get_build_dir(), self.get_target_dir(ld))
if dirseg not in result: if dirseg not in result:
result.append(dirseg) result.append(dirseg)
for deppath in self.rpaths_for_bundled_shared_libraries(target):
result.append(os.path.normpath(os.path.join(self.environment.get_build_dir(), deppath)))
return result return result
def write_benchmark_file(self, datafile): def write_benchmark_file(self, datafile):

@ -1368,7 +1368,7 @@ int main(int argc, char **argv) {
if compiler == 'cl': if compiler == 'cl':
extra_args = [] extra_args = []
shlibfile = os.path.join(tdir, 'alexandria.' + shared_suffix) shlibfile = os.path.join(tdir, 'alexandria.' + shared_suffix)
link_cmd = ['link', '/NOLOGO','/DLL', '/DEBUG', '/IMPLIB:alexandria.lib' '/OUT:' + shlibfile, objectfile] link_cmd = ['link', '/NOLOGO','/DLL', '/DEBUG', '/IMPLIB:' + os.path.join(tdir, 'alexandria.lib'), '/OUT:' + shlibfile, objectfile]
else: else:
extra_args = ['-fPIC'] extra_args = ['-fPIC']
shlibfile = os.path.join(tdir, 'libalexandria.' + shared_suffix) shlibfile = os.path.join(tdir, 'libalexandria.' + shared_suffix)
@ -1384,6 +1384,12 @@ int main(int argc, char **argv) {
self.run_tests() self.run_tests()
finally: finally:
os.unlink(shlibfile) os.unlink(shlibfile)
if mesonbuild.mesonlib.is_windows():
# Clean up all the garbage MSVC writes in the
# source tree.
for fname in glob(os.path.join(tdir, 'alexandria.*')):
if os.path.splitext(fname)[1] not in ['.c', '.h']:
os.unlink(fname)
class FailureTests(BasePlatformTests): class FailureTests(BasePlatformTests):
''' '''

Loading…
Cancel
Save