mbuild: .pdb files are created only when debug symbols are enabled

This is the same fix as the one in #10800 for shared libraries but
applied to executables instead.
pull/11213/merge
Daniele Nicolodi 2 years ago committed by Eli Schwartz
parent 3bc2236c59
commit 285e0d3c59
  1. 14
      mesonbuild/build.py

@ -1893,9 +1893,13 @@ class Executable(BuildTarget):
else: else:
self.import_filename = self.gcc_import_filename self.import_filename = self.gcc_import_filename
if machine.is_windows() and ('cs' in self.compilers or create_debug_file = (
self.uses_rust() or machine.is_windows()
self.get_using_msvc()): and ('cs' in self.compilers or self.uses_rust() or self.get_using_msvc())
# .pdb file is created only when debug symbols are enabled
and self.environment.coredata.get_option(OptionKey("debug"))
)
if create_debug_file:
self.debug_filename = self.name + '.pdb' self.debug_filename = self.name + '.pdb'
def get_default_install_dir(self) -> T.Tuple[str, str]: def get_default_install_dir(self) -> T.Tuple[str, str]:
@ -2139,14 +2143,14 @@ class SharedLibrary(BuildTarget):
prefix = '' prefix = ''
# Import library is called foo.dll.lib # Import library is called foo.dll.lib
self.import_filename = f'{self.name}.dll.lib' self.import_filename = f'{self.name}.dll.lib'
# Debug files(.pdb) is only created with debug buildtype # .pdb file is only created when debug symbols are enabled
create_debug_file = self.environment.coredata.get_option(OptionKey("debug")) create_debug_file = self.environment.coredata.get_option(OptionKey("debug"))
elif self.get_using_msvc(): elif self.get_using_msvc():
# Shared library is of the form foo.dll # Shared library is of the form foo.dll
prefix = '' prefix = ''
# Import library is called foo.lib # Import library is called foo.lib
self.import_filename = self.vs_import_filename self.import_filename = self.vs_import_filename
# Debug files(.pdb) is only created with debug buildtype # .pdb file is only created when debug symbols are enabled
create_debug_file = self.environment.coredata.get_option(OptionKey("debug")) create_debug_file = self.environment.coredata.get_option(OptionKey("debug"))
# Assume GCC-compatible naming # Assume GCC-compatible naming
else: else:

Loading…
Cancel
Save