Skip to content

Commit 5e5d1d5

Browse files
committed
ENH: adjust meson install default arguments
The install directory is always a temporary directory, thus passing the --only-changed option does not serve any purpose. When meson install is run the project has been just been built, thus it is not necessary to rebuild it: add the --no-rebuild option.
1 parent fd3ea2d commit 5e5d1d5

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

docs/explanations/default-options.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ The options that ``meson-python`` specifies by default are:
5656

5757
.. option:: buildtype=release
5858

59-
The Meson default is to produce a *debug* build with binaries
59+
The Meson default is to produce a debug build with binaries
6060
compiled with debug symbols and, when compiling with MSVC, linking
6161
to the Visual Studio debug runtime, see below. The main purpose of
6262
``meson-python`` is to build release artifacts, therefore a more
63-
appropriate `build type`__ is selected. A *release* build is
64-
compiled without debug symbols and with compiler
65-
optimizations. Refer to the `Meson documentation`__ for more
66-
details.
63+
appropriate `build type`__ is selected. A release build is compiled
64+
without debug symbols and with compiler optimizations. Refer to the
65+
`Meson documentation`__ for more details.
6766

6867
__ https://mesonbuild.com/Builtin-options.html#details-for-buildtype
6968
__ https://mesonbuild.com/Builtin-options.html#core-options
@@ -74,21 +73,22 @@ __ https://mesonbuild.com/Builtin-options.html#core-options
7473
disable assertions for release builds. For most users this is a
7574
surprising and undesired behavior. This option instructs Meson to
7675
pass the ``-DNDEBUG`` option to the compilers, unless the build
77-
type is set to something else than *release*.
76+
type is set to something else than release.
7877

7978
.. option:: b_vscrt=md
8079

81-
By default, Meson instructs the MSVC compiler to use the debug
82-
version of the VS runtime library when the build type is set to
83-
*debug*. This causes the linker look for the debug build of all the
84-
linked DLLs. The Python distribution for Windows does not contain a
85-
debug version of the Python DLL and linking fails. The linking
86-
failures are hard to diagnose. To avoid this issue when users
87-
explicitly asks for a debug build, ``meson-python`` sets this
88-
options to instruct Meson to compile with version of the Visual
89-
Studio runtime. For more details, refer to the `Meson
90-
documentation`__ and to the `Visual Studio documentation`__ . This
91-
option is ignored when other compilers are used.
80+
With the default options, when compiling a debug build, Meson
81+
instructs the MSVC compiler to use the debug version of the Visual
82+
Studio runtime library. This causes the MSVC linker to look for the
83+
debug build of all the linked DLLs. The Python distribution for
84+
Windows does not contain a debug version of the Python DLL and
85+
linking fails. These linking failures are surprising and hard to
86+
diagnose. To avoid this issue when users explicitly asks for a
87+
debug build, ``meson-python`` sets this options to instruct Meson
88+
to compile with the release version of the Visual Studio
89+
runtime. For more details, refer to the `Meson documentation`__ and
90+
to the `Visual Studio documentation`__ . This option is ignored
91+
when other compilers are used.
9292

9393
__ https://mesonbuild.com/Builtin-options.html#base-options
9494
__ https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170

mesonpy/__init__.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -788,18 +788,11 @@ def _wheel_builder(self) -> _WheelBuilder:
788788
self._install_plan,
789789
)
790790

791-
def build_commands(self, install_dir: Optional[pathlib.Path] = None) -> Sequence[Sequence[str]]:
791+
def build_commands(self) -> Sequence[Sequence[str]]:
792792
assert self._ninja is not None # help mypy out
793793
return (
794794
(self._ninja, *self._meson_args['compile'],),
795-
(
796-
'meson',
797-
'install',
798-
'--only-changed',
799-
'--destdir',
800-
os.fspath(install_dir or self._install_dir),
801-
*self._meson_args['install'],
802-
),
795+
('meson', 'install', '--no-rebuild', '--destdir', os.fspath(self._install_dir), *self._meson_args['install']),
803796
)
804797

805798
@functools.lru_cache(maxsize=None)

0 commit comments

Comments
 (0)