diff options
author | Daniele Nicolodi <daniele@grinta.net> | 2023-04-08 02:23:08 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-04-21 13:29:15 +0530 |
commit | 35085adaf74b8c683fb82292f4095942efc8c204 (patch) | |
tree | 4f966d24884bffa28137b50049cda67913c10347 | |
parent | 387d47f6e1a7a002ba5d2275466bbde6e905ae2e (diff) | |
download | meson-35085adaf74b8c683fb82292f4095942efc8c204.tar.gz |
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.
-rw-r--r-- | mesonbuild/build.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 216a483c1..22ae57b92 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1860,9 +1860,13 @@ class Executable(BuildTarget): else: self.import_filename = self.gcc_import_filename - if machine.is_windows() and ('cs' in self.compilers or - self.uses_rust() or - self.get_using_msvc()): + create_debug_file = ( + machine.is_windows() + 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' def get_default_install_dir(self) -> T.Tuple[str, str]: @@ -2081,14 +2085,14 @@ class SharedLibrary(BuildTarget): prefix = '' # Import library is called foo.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")) elif self.get_using_msvc(): # Shared library is of the form foo.dll prefix = '' # Import library is called foo.lib 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")) # Assume GCC-compatible naming else: |