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

Add option to disable tests and benchmarks with Meson #216

Merged
merged 1 commit into from
Jan 28, 2023

Conversation

bbastin
Copy link
Contributor

@bbastin bbastin commented Sep 17, 2021

This adds options to disable building the tests or benchmarks when using inja directly as a subproject in Meson.
By default, both tests and benchmarks will be built.

Changing the values can be done when importing the subproject like this:

inja_proj = subproject('inja', default_options: [
    'build_benchmark=true',
    'build_tests=false'
])

@pantor
Copy link
Owner

pantor commented Oct 4, 2021

Hi @bbastin, thanks for your PR! Is there any chance to get this feature without adding the auxiliary meson_options.txt file?

@bbastin
Copy link
Contributor Author

bbastin commented Oct 4, 2021

Hey, thanks for getting back!

I am no meson expert, but according to the documentation (https://mesonbuild.com/Build-options.html), the options are only located inside the meson_options.txt.

I have tried whether inline options are supported, but it causes the following error:

meson.build:3:0: ERROR: Tried to call option() in build description file. All options must be in the option file.

Unfortunately, it seems like this is the only way to do this. I understand that having another file at top level leads to more clutter. I would still appreciate this change, as I usually run all tests in my projects with meson test and this then also executes all of inja's tests. One other option, if you really disliked the additional file, would be to add the tests to their own suite, I could write another pull request doing that.

@pantor pantor merged commit 44b23f2 into pantor:master Jan 28, 2023
@eli-schwartz
Copy link

I would still appreciate this change, as I usually run all tests in my projects with meson test and this then also executes all of inja's tests.

Note: it is also possible to use --suite projectname and only run the tests for your own project (avoiding all subprojects).

This is independent of whether the test executables are compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants