[+] improve meson:setup

1. allow to pass mode;
This commit is contained in:
Siarhei Siniak 2025-08-04 09:52:36 +03:00
parent 3a01fc9e87
commit f87de4d9bf
2 changed files with 10 additions and 6 deletions

@ -5,7 +5,7 @@ project(
).stdout().strip('\n'),
# 'online.fxreader.uv',
# ['c', 'cpp'],
version: '0.1.5.19',
version: '0.1.5.20',
# default_options: [
# 'cpp_std=c++23',
# # 'prefer_static=true',

@ -648,11 +648,15 @@ class CLI(abc.ABC):
force: bool,
argv: Optional[list[str]] = None,
env: Optional[dict[str, str]] = None,
mode: Optional[Literal['meson', 'pyproject']] = None,
# third_party_roots: Optional[list[pathlib.Path]] = None,
) -> None:
from . import cli_bootstrap
from .os import shutil_rmtree
if mode is None:
mode = 'meson'
project = self.projects[project_name]
if argv is None:
@ -668,9 +672,9 @@ class CLI(abc.ABC):
logger.info(dict(env=env))
if force:
if (project.build_dir / 'meson').exists():
logger.info(dict(action='removing build dir', path=project.build_dir / 'meson'))
shutil.rmtree(project.build_dir / 'meson')
if (project.build_dir / mode).exists():
logger.info(dict(action='removing build dir', path=project.build_dir / mode))
shutil.rmtree(project.build_dir / mode)
extra_args: list[str] = []
@ -692,8 +696,8 @@ class CLI(abc.ABC):
'mesonbuild.mesonmain',
'setup',
str(project.source_dir),
str(project.build_dir / 'meson'),
'-Dmodes=["meson"]',
str(project.build_dir / mode),
'-Dmodes=["{}"]'.format(mode),
*extra_args,
# '-Dpkgconfig.relocatable=true',
'-Dprefix=/',