Skip to content

Commit 123a198

Browse files
committed
ENH: adjust default build options
Switch from debug=false, optimization=2 to buildtype=release. Despite what the Meson documentation says, the former does not change the default buildtype=debug, which undesired effects on other settings derived from the value of the buildtype option. Whit the default b_vscrt=from_buildtype option, Meson instructs the MSVC compiler to use the debug version of the VS runtime library when buildtype=debug. This causes the linker look for the debug build of all the linked DLLs. The Python distribution for Windows does not contain a debug version of the python.dll and linking fails. To avoid this issue when the user explicitly asks for a debug build, also set b_vscrt=mt. The b_ndebug=if-release option set by meson-python also looks at the value of the buildtype and not to the value of the debug options. Setting buildtype=release has the desired effect of disabling assertions. The prefix, python.purelibdir, and python.platlibdir build options are no more necessary after the heuristic for determining the location where installed files need to be placer from their installation location has been removed in #280. Remove them. Fixes #381.
1 parent 936eee3 commit 123a198

File tree

3 files changed

+4
-44
lines changed

3 files changed

+4
-44
lines changed

meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ py.install_sources(
1717
'mesonpy/_dylib.py',
1818
'mesonpy/_editable.py',
1919
'mesonpy/_elf.py',
20-
'mesonpy/_introspection.py',
2120
'mesonpy/_tags.py',
2221
'mesonpy/_util.py',
2322
'mesonpy/_wheelfile.py',

mesonpy/__init__.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import mesonpy._compat
4949
import mesonpy._dylib
5050
import mesonpy._elf
51-
import mesonpy._introspection
5251
import mesonpy._tags
5352
import mesonpy._util
5453
import mesonpy._wheelfile
@@ -728,26 +727,15 @@ def _run(self, cmd: Sequence[str]) -> None:
728727

729728
def _configure(self, reconfigure: bool = False) -> None:
730729
"""Configure Meson project."""
731-
sys_paths = mesonpy._introspection.SYSCONFIG_PATHS
732730
setup_args = [
733-
f'--prefix={sys.base_prefix}',
734731
os.fspath(self._source_dir),
735732
os.fspath(self._build_dir),
736733
f'--native-file={os.fspath(self._meson_native_file)}',
737-
# TODO: Allow configuring these arguments
738-
'-Ddebug=false',
734+
# default build options
735+
'-Dbuildtype=release',
739736
'-Db_ndebug=if-release',
740-
'-Doptimization=2',
741-
742-
# XXX: This should not be needed, but Meson is using the wrong paths
743-
# in some scenarios, like on macOS.
744-
# https://github.com/mesonbuild/meson-python/pull/87#discussion_r1047041306
745-
'--python.purelibdir',
746-
sys_paths['purelib'],
747-
'--python.platlibdir',
748-
sys_paths['platlib'],
749-
750-
# user args
737+
'-Db_vscrt=md',
738+
# user build options
751739
*self._meson_args['setup'],
752740
]
753741
if reconfigure:

mesonpy/_introspection.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)