Merge pull request #1444 from mesonbuild/pdbinstall

Install PDB files. Closes #1442.
pull/1446/head
Jussi Pakkanen 8 years ago committed by GitHub
commit 2ecb26c9ae
  1. 6
      mesonbuild/backend/backends.py
  2. 7
      mesonbuild/backend/ninjabackend.py
  3. 35
      mesonbuild/build.py
  4. 5
      mesonbuild/scripts/meson_install.py
  5. 3
      run_project_tests.py
  6. 2
      test cases/windows/1 basic/installed_files.txt
  7. 2
      test cases/windows/1 basic/meson.build
  8. 2
      test cases/windows/8 msvc dll versioning/installed_files.txt

@ -115,12 +115,6 @@ class Backend:
return os.path.join(self.get_target_dir(target), target.get_filename()) return os.path.join(self.get_target_dir(target), target.get_filename())
raise AssertionError('BUG: Tried to link to something that\'s not a library') raise AssertionError('BUG: Tried to link to something that\'s not a library')
def get_target_debug_filename(self, target):
fname = target.get_debug_filename()
if not fname:
raise AssertionError("BUG: Tried to generate debug filename when it doesn't exist")
return os.path.join(self.get_target_dir(target), fname)
def get_target_dir(self, target): def get_target_dir(self, target):
if self.environment.coredata.get_builtin_option('layout') == 'mirror': if self.environment.coredata.get_builtin_option('layout') == 'mirror':
dirname = target.get_subdir() dirname = target.get_subdir()

@ -654,13 +654,6 @@ int dummy;
else: else:
# XXX: Add BuildTarget-specific install dir cases here # XXX: Add BuildTarget-specific install dir cases here
outdir = self.environment.get_libdir() outdir = self.environment.get_libdir()
if isinstance(t, build.SharedLibrary) or isinstance(t, build.Executable):
if t.get_debug_filename():
# Install the debug symbols file in the same place as
# the target itself. It has no aliases, should not be
# stripped, and doesn't have an install_rpath
i = [self.get_target_debug_filename(t), outdir, {}, False, '']
d.targets.append(i)
if isinstance(t, build.BuildTarget): if isinstance(t, build.BuildTarget):
i = [self.get_target_filename(t), outdir, t.get_aliases(), i = [self.get_target_filename(t), outdir, t.get_aliases(),
should_strip, t.install_rpath] should_strip, t.install_rpath]

@ -300,8 +300,6 @@ class BuildTarget(Target):
self.name_prefix_set = False self.name_prefix_set = False
self.name_suffix_set = False self.name_suffix_set = False
self.filename = 'no_name' self.filename = 'no_name'
# The file with debugging symbols
self.debug_filename = None
self.need_install = False self.need_install = False
self.pch = {} self.pch = {}
self.extra_args = {} self.extra_args = {}
@ -686,15 +684,6 @@ class BuildTarget(Target):
def get_outputs(self): def get_outputs(self):
return [self.filename] return [self.filename]
def get_debug_filename(self):
"""
The name of the file that contains debugging symbols for this target
Returns None if there are no debugging symbols or if they are embedded
in the filename itself
"""
return self.debug_filename
def get_extra_args(self, language): def get_extra_args(self, language):
return self.extra_args.get(language, []) return self.extra_args.get(language, [])
@ -1006,10 +995,6 @@ class Executable(BuildTarget):
self.filename = self.name self.filename = self.name
if self.suffix: if self.suffix:
self.filename += '.' + self.suffix self.filename += '.' + self.suffix
# See determine_debug_filenames() in build.SharedLibrary
buildtype = environment.coredata.get_builtin_option('buildtype')
if self.get_using_msvc() and buildtype.startswith('debug'):
self.debug_filename = self.prefix + self.name + '.pdb'
def type_suffix(self): def type_suffix(self):
return "@exe" return "@exe"
@ -1037,10 +1022,6 @@ class StaticLibrary(BuildTarget):
else: else:
self.suffix = 'a' self.suffix = 'a'
self.filename = self.prefix + self.name + '.' + self.suffix self.filename = self.prefix + self.name + '.' + self.suffix
# See determine_debug_filenames() in build.SharedLibrary
buildtype = environment.coredata.get_builtin_option('buildtype')
if self.get_using_msvc() and buildtype.startswith('debug'):
self.debug_filename = self.prefix + self.name + '.pdb'
def type_suffix(self): def type_suffix(self):
return "@sta" return "@sta"
@ -1066,7 +1047,6 @@ class SharedLibrary(BuildTarget):
self.suffix = None self.suffix = None
self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}' self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
self.determine_filenames(is_cross, environment) self.determine_filenames(is_cross, environment)
self.determine_debug_filenames(is_cross, environment)
def determine_filenames(self, is_cross, env): def determine_filenames(self, is_cross, env):
""" """
@ -1156,21 +1136,6 @@ class SharedLibrary(BuildTarget):
self.suffix = suffix self.suffix = suffix
self.filename = self.filename_tpl.format(self) self.filename = self.filename_tpl.format(self)
def determine_debug_filenames(self, is_cross, env):
"""
Determine the debug filename(s) using the prefix/name/etc detected in
determine_filenames() above.
"""
buildtype = env.coredata.get_builtin_option('buildtype')
if self.get_using_msvc() and buildtype.startswith('debug'):
# Currently we only implement separate debug symbol files for MSVC
# since the toolchain does it for us. Other toolchains embed the
# debugging symbols in the file itself by default.
if self.soversion:
self.debug_filename = '{0.prefix}{0.name}-{0.soversion}.pdb'.format(self)
else:
self.debug_filename = '{0.prefix}{0.name}.pdb'.format(self)
def process_kwargs(self, kwargs, environment): def process_kwargs(self, kwargs, environment):
super().process_kwargs(kwargs, environment) super().process_kwargs(kwargs, environment)
# Shared library version # Shared library version

@ -247,6 +247,11 @@ def install_targets(d):
print('Stdout:\n%s\n' % stdo) print('Stdout:\n%s\n' % stdo)
print('Stderr:\n%s\n' % stde) print('Stderr:\n%s\n' % stde)
sys.exit(1) sys.exit(1)
pdb_filename = os.path.splitext(fname)[0] + '.pdb'
if not should_strip and os.path.exists(pdb_filename):
pdb_outname = os.path.splitext(outname)[0] + '.pdb'
print('Installing pdb file %s to %s.' % (pdb_filename, pdb_outname))
do_copyfile(pdb_filename, pdb_outname)
elif os.path.isdir(fname): elif os.path.isdir(fname):
fname = os.path.join(d.build_dir, fname.rstrip('/')) fname = os.path.join(d.build_dir, fname.rstrip('/'))
do_copydir(fname, os.path.dirname(fname), outdir) do_copydir(fname, os.path.dirname(fname), outdir)

@ -181,6 +181,9 @@ def validate_install(srcdir, installdir):
# Check if there are any unexpected files # Check if there are any unexpected files
found = get_relative_files_list_from_dir(installdir) found = get_relative_files_list_from_dir(installdir)
for fname in found: for fname in found:
# Windows-specific tests check for the existence of installed PDB
# files, but common tests do not, for obvious reasons. Ignore any
# extra PDB files found.
if fname not in expected and not fname.endswith('.pdb'): if fname not in expected and not fname.endswith('.pdb'):
ret_msg += 'Extra file {0} found.\n'.format(fname) ret_msg += 'Extra file {0} found.\n'.format(fname)
return ret_msg return ret_msg

@ -0,0 +1,2 @@
usr/bin/prog.exe
usr/bin/prog.pdb

@ -1,4 +1,4 @@
project('wintest', 'c') project('wintest', 'c')
prog = executable('prog', 'prog.c') prog = executable('prog', 'prog.c', install : true)
test('wintest', prog) test('wintest', prog)

@ -1,4 +1,6 @@
usr/bin/some-0.dll usr/bin/some-0.dll
usr/bin/some-0.pdb
usr/lib/some.lib usr/lib/some.lib
usr/bin/noversion.dll usr/bin/noversion.dll
usr/bin/noversion.pdb
usr/lib/noversion.lib usr/lib/noversion.lib

Loading…
Cancel
Save