[libcamera-devel] meson: Provide options to disable test/docs

Message ID 20190320154748.27326-1-kieran.bingham@ideasonboard.com
State Accepted
Commit 945478dbc0198fed27ce885d3ec33c95c77bc69f
Headers show
Series
  • [libcamera-devel] meson: Provide options to disable test/docs
Related show

Commit Message

Kieran Bingham March 20, 2019, 3:47 p.m. UTC
It can be desirable to disable the compilation and processing of both
the test suite and documentation for use cases such as packaging to an
embedded target.

Provide a new meson_options.txt file to allow disabling either or both
of the tests and documentation components of libcamera.

These options can be provided at the initial configuration time, for
example:

  meson build -Dtests=false -Ddocumentation=false

or by reconfiguring an existing build tree:

  cd build
  meson configure -Ddocumentation=false
  meson configure -Dtests=false

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 meson.build       | 10 ++++++++--
 meson_options.txt |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 meson_options.txt

Comments

Niklas Söderlund March 20, 2019, 4:17 p.m. UTC | #1
Hi Kieran,

Thanks for your work.

On 2019-03-20 15:47:48 +0000, Kieran Bingham wrote:
> It can be desirable to disable the compilation and processing of both
> the test suite and documentation for use cases such as packaging to an
> embedded target.
> 
> Provide a new meson_options.txt file to allow disabling either or both
> of the tests and documentation components of libcamera.
> 
> These options can be provided at the initial configuration time, for
> example:
> 
>   meson build -Dtests=false -Ddocumentation=false

This seems to work as expected on my system :-)

I'm a bit perplexed that options are enabled by default, my expectations 
looking at the code would be that they would be disabled if not 
explicitly enabled. But I assume this is just me struggling with 
wrapping my head around meson ;-P

> 
> or by reconfiguring an existing build tree:
> 
>   cd build
>   meson configure -Ddocumentation=false
>   meson configure -Dtests=false
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  meson.build       | 10 ++++++++--
>  meson_options.txt |  2 ++
>  2 files changed, 10 insertions(+), 2 deletions(-)
>  create mode 100644 meson_options.txt
> 
> diff --git a/meson.build b/meson.build
> index 4465a3851a30..43d4a57602bb 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
>  
>  subdir('include')
>  subdir('src')
> -subdir('test')
>  subdir('utils')
> -subdir('Documentation')
> +
> +if get_option('tests')
> +	subdir('test')
> +endif
> +
> +if get_option('documentation')
> +	subdir('Documentation')
> +endif
>  
>  pkg_mod = import('pkgconfig')
>  pkg_mod.generate(libraries : libcamera,
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 000000000000..c5df661a2286
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,2 @@
> +option('tests', type : 'boolean')
> +option('documentation', type : 'boolean')
> -- 
> 2.19.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham March 20, 2019, 4:20 p.m. UTC | #2
Hi Niklas,

On 20/03/2019 16:17, Niklas Söderlund wrote:
> Hi Kieran,
> 
> Thanks for your work.
> 
> On 2019-03-20 15:47:48 +0000, Kieran Bingham wrote:
>> It can be desirable to disable the compilation and processing of both
>> the test suite and documentation for use cases such as packaging to an
>> embedded target.
>>
>> Provide a new meson_options.txt file to allow disabling either or both
>> of the tests and documentation components of libcamera.
>>
>> These options can be provided at the initial configuration time, for
>> example:
>>
>>   meson build -Dtests=false -Ddocumentation=false
> 
> This seems to work as expected on my system :-)
> 
> I'm a bit perplexed that options are enabled by default, my expectations 
> looking at the code would be that they would be disabled if not 
> explicitly enabled. But I assume this is just me struggling with 
> wrapping my head around meson ;-P


https://mesonbuild.com/Build-options.html#booleans

> Booleans may have values of either true or false. If no default value is supplied then true will be used as the default.

I can append a " value : true" to the option to make this clearer if you
prefer?

--
Regards

Kieran


>> or by reconfiguring an existing build tree:
>>
>>   cd build
>>   meson configure -Ddocumentation=false
>>   meson configure -Dtests=false
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> 
>> ---
>>  meson.build       | 10 ++++++++--
>>  meson_options.txt |  2 ++
>>  2 files changed, 10 insertions(+), 2 deletions(-)
>>  create mode 100644 meson_options.txt
>>
>> diff --git a/meson.build b/meson.build
>> index 4465a3851a30..43d4a57602bb 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
>>  
>>  subdir('include')
>>  subdir('src')
>> -subdir('test')
>>  subdir('utils')
>> -subdir('Documentation')
>> +
>> +if get_option('tests')
>> +	subdir('test')
>> +endif
>> +
>> +if get_option('documentation')
>> +	subdir('Documentation')
>> +endif
>>  
>>  pkg_mod = import('pkgconfig')
>>  pkg_mod.generate(libraries : libcamera,
>> diff --git a/meson_options.txt b/meson_options.txt
>> new file mode 100644
>> index 000000000000..c5df661a2286
>> --- /dev/null
>> +++ b/meson_options.txt
>> @@ -0,0 +1,2 @@
>> +option('tests', type : 'boolean')
>> +option('documentation', type : 'boolean')
>> -- 
>> 2.19.1
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel@lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel
>
Niklas Söderlund March 20, 2019, 4:25 p.m. UTC | #3
Hi Kieran,

On 2019-03-20 16:20:56 +0000, Kieran Bingham wrote:
> Hi Niklas,
> 
> On 20/03/2019 16:17, Niklas Söderlund wrote:
> > Hi Kieran,
> > 
> > Thanks for your work.
> > 
> > On 2019-03-20 15:47:48 +0000, Kieran Bingham wrote:
> >> It can be desirable to disable the compilation and processing of both
> >> the test suite and documentation for use cases such as packaging to an
> >> embedded target.
> >>
> >> Provide a new meson_options.txt file to allow disabling either or both
> >> of the tests and documentation components of libcamera.
> >>
> >> These options can be provided at the initial configuration time, for
> >> example:
> >>
> >>   meson build -Dtests=false -Ddocumentation=false
> > 
> > This seems to work as expected on my system :-)
> > 
> > I'm a bit perplexed that options are enabled by default, my expectations 
> > looking at the code would be that they would be disabled if not 
> > explicitly enabled. But I assume this is just me struggling with 
> > wrapping my head around meson ;-P
> 
> 
> https://mesonbuild.com/Build-options.html#booleans
> 
> > Booleans may have values of either true or false. If no default value is supplied then true will be used as the default.
> 
> I can append a " value : true" to the option to make this clearer if you
> prefer?

No the default behavior is fine, in fact I prefers to only modify things 
if needed. I was just pointing out that without your example of that 
explicitly disabling the options I would have assumed that we would not 
build tests or documentation by default. Now I know how meson works so 
it's fine from my point of view, thanks :-)

> 
> --
> Regards
> 
> Kieran
> 
> 
> >> or by reconfiguring an existing build tree:
> >>
> >>   cd build
> >>   meson configure -Ddocumentation=false
> >>   meson configure -Dtests=false
> >>
> >> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > 
> >> ---
> >>  meson.build       | 10 ++++++++--
> >>  meson_options.txt |  2 ++
> >>  2 files changed, 10 insertions(+), 2 deletions(-)
> >>  create mode 100644 meson_options.txt
> >>
> >> diff --git a/meson.build b/meson.build
> >> index 4465a3851a30..43d4a57602bb 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
> >>  
> >>  subdir('include')
> >>  subdir('src')
> >> -subdir('test')
> >>  subdir('utils')
> >> -subdir('Documentation')
> >> +
> >> +if get_option('tests')
> >> +	subdir('test')
> >> +endif
> >> +
> >> +if get_option('documentation')
> >> +	subdir('Documentation')
> >> +endif
> >>  
> >>  pkg_mod = import('pkgconfig')
> >>  pkg_mod.generate(libraries : libcamera,
> >> diff --git a/meson_options.txt b/meson_options.txt
> >> new file mode 100644
> >> index 000000000000..c5df661a2286
> >> --- /dev/null
> >> +++ b/meson_options.txt
> >> @@ -0,0 +1,2 @@
> >> +option('tests', type : 'boolean')
> >> +option('documentation', type : 'boolean')
> >> -- 
> >> 2.19.1
> >>
> >> _______________________________________________
> >> libcamera-devel mailing list
> >> libcamera-devel@lists.libcamera.org
> >> https://lists.libcamera.org/listinfo/libcamera-devel
> > 
> 
> -- 
> Regards
> --
> Kieran
Laurent Pinchart March 21, 2019, 8:35 a.m. UTC | #4
Hi Kieran,

Thank you for the patch.

On Wed, Mar 20, 2019 at 03:47:48PM +0000, Kieran Bingham wrote:
> It can be desirable to disable the compilation and processing of both
> the test suite and documentation for use cases such as packaging to an
> embedded target.
> 
> Provide a new meson_options.txt file to allow disabling either or both
> of the tests and documentation components of libcamera.
> 
> These options can be provided at the initial configuration time, for
> example:
> 
>   meson build -Dtests=false -Ddocumentation=false
> 
> or by reconfiguring an existing build tree:
> 
>   cd build
>   meson configure -Ddocumentation=false
>   meson configure -Dtests=false
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  meson.build       | 10 ++++++++--
>  meson_options.txt |  2 ++
>  2 files changed, 10 insertions(+), 2 deletions(-)
>  create mode 100644 meson_options.txt
> 
> diff --git a/meson.build b/meson.build
> index 4465a3851a30..43d4a57602bb 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
>  
>  subdir('include')
>  subdir('src')
> -subdir('test')
>  subdir('utils')
> -subdir('Documentation')
> +
> +if get_option('tests')
> +	subdir('test')
> +endif

meson.build files use spaces for indentation.

> +
> +if get_option('documentation')
> +	subdir('Documentation')
> +endif

I would have kept these alphabetically sorted.

>  pkg_mod = import('pkgconfig')
>  pkg_mod.generate(libraries : libcamera,
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 000000000000..c5df661a2286
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,2 @@
> +option('tests', type : 'boolean')
> +option('documentation', type : 'boolean')

Shouldn't this be sorted alphabetically ? Please also add descriptions
to those options.

It seems the patch has been pushed already, could you please fix this on
top ?
Kieran Bingham March 22, 2019, 11:49 a.m. UTC | #5
Hi Laurent,

On 21/03/2019 08:35, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Wed, Mar 20, 2019 at 03:47:48PM +0000, Kieran Bingham wrote:
>> It can be desirable to disable the compilation and processing of both
>> the test suite and documentation for use cases such as packaging to an
>> embedded target.
>>
>> Provide a new meson_options.txt file to allow disabling either or both
>> of the tests and documentation components of libcamera.
>>
>> These options can be provided at the initial configuration time, for
>> example:
>>
>>   meson build -Dtests=false -Ddocumentation=false
>>
>> or by reconfiguring an existing build tree:
>>
>>   cd build
>>   meson configure -Ddocumentation=false
>>   meson configure -Dtests=false
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>>  meson.build       | 10 ++++++++--
>>  meson_options.txt |  2 ++
>>  2 files changed, 10 insertions(+), 2 deletions(-)
>>  create mode 100644 meson_options.txt
>>
>> diff --git a/meson.build b/meson.build
>> index 4465a3851a30..43d4a57602bb 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
>>  
>>  subdir('include')
>>  subdir('src')
>> -subdir('test')
>>  subdir('utils')
>> -subdir('Documentation')
>> +
>> +if get_option('tests')
>> +	subdir('test')
>> +endif
> 
> meson.build files use spaces for indentation.

Argh, yes - is it feasible to get that into our checkstyle script?


>> +
>> +if get_option('documentation')
>> +	subdir('Documentation')
>> +endif
> 
> I would have kept these alphabetically sorted.

Do you mean keep it in the subdir block above? I moved them out because
they were now optional.

Oh or ... D before T at least :-)


>>  pkg_mod = import('pkgconfig')
>>  pkg_mod.generate(libraries : libcamera,
>> diff --git a/meson_options.txt b/meson_options.txt
>> new file mode 100644
>> index 000000000000..c5df661a2286
>> --- /dev/null
>> +++ b/meson_options.txt
>> @@ -0,0 +1,2 @@
>> +option('tests', type : 'boolean')
>> +option('documentation', type : 'boolean')
> 
> Shouldn't this be sorted alphabetically ? Please also add descriptions
> to those options.

Aha - Yes, I didn't see they could have descriptions added.

I'll put that in.


> 
> It seems the patch has been pushed already, could you please fix this on
> top ?


An initial fix up sent as part of a cleanup series :)
Laurent Pinchart March 22, 2019, 10:19 p.m. UTC | #6
Hi Kieran,

On Fri, Mar 22, 2019 at 11:49:19AM +0000, Kieran Bingham wrote:
> On 21/03/2019 08:35, Laurent Pinchart wrote:
> > On Wed, Mar 20, 2019 at 03:47:48PM +0000, Kieran Bingham wrote:
> >> It can be desirable to disable the compilation and processing of both
> >> the test suite and documentation for use cases such as packaging to an
> >> embedded target.
> >>
> >> Provide a new meson_options.txt file to allow disabling either or both
> >> of the tests and documentation components of libcamera.
> >>
> >> These options can be provided at the initial configuration time, for
> >> example:
> >>
> >>   meson build -Dtests=false -Ddocumentation=false
> >>
> >> or by reconfiguring an existing build tree:
> >>
> >>   cd build
> >>   meson configure -Ddocumentation=false
> >>   meson configure -Dtests=false
> >>
> >> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> >> ---
> >>  meson.build       | 10 ++++++++--
> >>  meson_options.txt |  2 ++
> >>  2 files changed, 10 insertions(+), 2 deletions(-)
> >>  create mode 100644 meson_options.txt
> >>
> >> diff --git a/meson.build b/meson.build
> >> index 4465a3851a30..43d4a57602bb 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -27,9 +27,15 @@ libcamera_includes = include_directories('include')
> >>  
> >>  subdir('include')
> >>  subdir('src')
> >> -subdir('test')
> >>  subdir('utils')
> >> -subdir('Documentation')
> >> +
> >> +if get_option('tests')
> >> +	subdir('test')
> >> +endif
> > 
> > meson.build files use spaces for indentation.
> 
> Argh, yes - is it feasible to get that into our checkstyle script?

Sure. Feel free to propose a patch ;-) checkstyle.py currently ignores
non C(++) files. It shouldn't be difficult to add languages to
available_formatters (probably in the form of a language class that
would provide an identification function, which can be based on file
names), and then run all available formatters that support the language
of the file being checked.

> >> +
> >> +if get_option('documentation')
> >> +	subdir('Documentation')
> >> +endif
> > 
> > I would have kept these alphabetically sorted.
> 
> Do you mean keep it in the subdir block above? I moved them out because
> they were now optional.
> 
> Oh or ... D before T at least :-)

I think I just wouldn't move them out.

> >>  pkg_mod = import('pkgconfig')
> >>  pkg_mod.generate(libraries : libcamera,
> >> diff --git a/meson_options.txt b/meson_options.txt
> >> new file mode 100644
> >> index 000000000000..c5df661a2286
> >> --- /dev/null
> >> +++ b/meson_options.txt
> >> @@ -0,0 +1,2 @@
> >> +option('tests', type : 'boolean')
> >> +option('documentation', type : 'boolean')
> > 
> > Shouldn't this be sorted alphabetically ? Please also add descriptions
> > to those options.
> 
> Aha - Yes, I didn't see they could have descriptions added.
> 
> I'll put that in.
> 
> > It seems the patch has been pushed already, could you please fix this on
> > top ?
> 
> An initial fix up sent as part of a cleanup series :)

Thank you.

Patch

diff --git a/meson.build b/meson.build
index 4465a3851a30..43d4a57602bb 100644
--- a/meson.build
+++ b/meson.build
@@ -27,9 +27,15 @@  libcamera_includes = include_directories('include')
 
 subdir('include')
 subdir('src')
-subdir('test')
 subdir('utils')
-subdir('Documentation')
+
+if get_option('tests')
+	subdir('test')
+endif
+
+if get_option('documentation')
+	subdir('Documentation')
+endif
 
 pkg_mod = import('pkgconfig')
 pkg_mod.generate(libraries : libcamera,
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 000000000000..c5df661a2286
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@ 
+option('tests', type : 'boolean')
+option('documentation', type : 'boolean')