inja icon indicating copy to clipboard operation
inja copied to clipboard

Add option to disable tests and benchmarks with Meson

Open bbastin opened this issue 4 years ago • 2 comments

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'
])

bbastin avatar Sep 17 '21 16:09 bbastin

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

pantor avatar Oct 04 '21 07:10 pantor

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.

bbastin avatar Oct 04 '21 18:10 bbastin

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.

eli-schwartz avatar Jan 29 '23 23:01 eli-schwartz