Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Update spin to accept arguments of meson compile and meson install #256

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions spin/cmds/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def build(
quiet=False,
build_dir=None,
prefix=None,
meson_compile_args=tuple(),
meson_install_args=tuple(),
):
"""🔧 Build package with Meson/ninja

Expand Down Expand Up @@ -328,12 +330,12 @@ def build(
)
return

meson_args = list(meson_args)
meson_args_setup = list(meson_args)

if gcov:
meson_args = meson_args + ["-Db_coverage=true"]
meson_args_setup = meson_args_setup + ["-Db_coverage=true"]

setup_cmd = _meson_cli() + ["setup", build_dir, f"--prefix={prefix}"] + meson_args
setup_cmd = _meson_cli() + ["setup", build_dir, f"--prefix={prefix}"] + meson_args_setup

if clean:
print(f"Removing `{build_dir}`")
Expand All @@ -360,15 +362,18 @@ def build(

# Any other conditions that warrant a reconfigure?

meson_compile_args = list(meson_compile_args)
compile_flags = ["-v"] if verbose else []
if jobs:
compile_flags += ["-j", str(jobs)]

p = _run(
_meson_cli() + ["compile"] + compile_flags + ["-C", build_dir],
_meson_cli() + ["compile"] + compile_flags + ["-C", build_dir] + meson_compile_args,
sys_exit=True,
output=not quiet,
)

meson_install_args = list(meson_install_args)
p = _run(
_meson_cli()
+ [
Expand All @@ -380,7 +385,7 @@ def build(
install_dir
if os.path.isabs(install_dir)
else os.path.relpath(abs_install_dir, abs_build_dir),
],
] + meson_install_args,
output=(not quiet) and verbose,
)

Expand Down
Loading