Repository: mesonbuild/meson

Issue:
intro-install-plan.json does not match with intro-installed.json
**Describe the bug**

The files listed in the intro-install-plan.json do not match with the files installed (listed in intro-installed.json). 
This causes problems for meson-python, which uses intro-install-plan.json to find installed files.

In particular, on Windows, when building in release mode, pdb files will be listed in the install-plan but not installed, with a message like
```
File 'pandas\\_libs\\window\\indexers.cp38-win_amd64.pdb' not found, skipping
```

In addition, folders installed with install_subdir are not listed in the install-plan.

**To Reproduce**
Please include your `meson.build` files, preferably as a minimal toy example showing the issue.
You may need to create simple source code files (don't include private/proprietary code).

I found this problem while trying to port pandas to meson. Here is the code to reproduce.
```
git clone https://github.com/lithomas1/pandas.git@meson-poc
cd pandas
python -m build
```

It should be reproducible without pandas, though. I'll try to make a MRE when I have some time.
**Expected behavior**
A clear and concise description of what you expected to happen.

files listed in intro-install-plan should match files in intro-installed.

**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)?
native
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
Windows
* what Python version are you using e.g. 
3.8.0
* what `meson --version`
0.63.0
* what `ninja --version` if it's a Ninja build



Discussion:
@FFY00, you originally implemented #9130 for your PEP 517 backend, what's the story here?
I think the issue is that we don't install pdb files in release mode, but install-plan doesn't take that into account and still lists it.
The issue with missing install subdirs can probably be fixed just by adding ``'subdirs': installdata.subdirs`` here.
https://github.com/mesonbuild/meson/blob/f8ebfdf7b1f33f88007d107791a661a17827be43/mesonbuild/mintro.py#L136-L140

I'm still not sure about the pdb files, though. The band-aid fix would be to just skip targets that don't exist on the file-system, but there seems to be a bigger issue here. @eli-schwartz Do you happen to know why the pdb files seem to be listed as install targets even in release mode?

Resolving patch:
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -2075,13 +2075,15 @@ def determine_filenames(self):
                 prefix = ''
                 # Import library is called foo.dll.lib
                 self.import_filename = f'{self.name}.dll.lib'
-                create_debug_file = True
+                # Debug files(.pdb) is only created with debug buildtype
+                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
-                create_debug_file = True
+                # Debug files(.pdb) is only created with debug buildtype
+                create_debug_file = self.environment.coredata.get_option(OptionKey("debug"))
             # Assume GCC-compatible naming
             else:
                 # Shared library is of the form libfoo.dll


Test patch: