[libcamera-devel] meson: options: Add a option to control compilation of qcam

Message ID 20200616152724.1292857-1-niklas.soderlund@ragnatech.se
State Superseded
Delegated to: Niklas Söderlund
Headers show
Series
  • [libcamera-devel] meson: options: Add a option to control compilation of qcam
Related show

Commit Message

Niklas Söderlund June 16, 2020, 3:27 p.m. UTC
Add a option to control compilation of the qcam test application. The
default behavior is to compile qcam, no change in behavior without user
intervention.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 meson_options.txt | 5 +++++
 src/meson.build   | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Nicolas Dufresne June 16, 2020, 6:03 p.m. UTC | #1
Le mardi 16 juin 2020 à 17:27 +0200, Niklas Söderlund a écrit :
> Add a option to control compilation of the qcam test application. The
> default behavior is to compile qcam, no change in behavior without user
> intervention.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  meson_options.txt | 5 +++++
>  src/meson.build   | 5 ++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meson_options.txt b/meson_options.txt
> index badace151bb62bc9..9a4edf2a5fde8bcb 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -27,3 +27,8 @@ option('v4l2',
>          type : 'boolean',
>          value : false,
>          description : 'Compile the V4L2 compatibility layer')
> +
> +option('qcam',
> +        type : 'boolean',
> +        value : true,
> +        description : 'Compile the qcam test application')
> diff --git a/src/meson.build b/src/meson.build
> index d69b4c1ea9788f83..3a816fb610a68905 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -19,7 +19,10 @@ endif
>  subdir('libcamera')
>  subdir('ipa')
>  subdir('cam')
> -subdir('qcam')
> +
> +if get_option('qcam')
> +    subdir('qcam')
> +endif

It's much cleaner if you check that option inside the subdir
meson.build and call subdir_done() instead.

(ignore if your required meson version is too ancient)

>  
>  if get_option('v4l2')
>      subdir('v4l2')

And then this could be cleaned up.
Laurent Pinchart June 16, 2020, 6:06 p.m. UTC | #2
Hi Niklas,

Thank you for the patch.

On Tue, Jun 16, 2020 at 05:27:24PM +0200, Niklas Söderlund wrote:
> Add a option to control compilation of the qcam test application. The

s/a option/an option/

> default behavior is to compile qcam, no change in behavior without user
> intervention.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  meson_options.txt | 5 +++++
>  src/meson.build   | 5 ++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meson_options.txt b/meson_options.txt
> index badace151bb62bc9..9a4edf2a5fde8bcb 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -27,3 +27,8 @@ option('v4l2',
>          type : 'boolean',
>          value : false,
>          description : 'Compile the V4L2 compatibility layer')
> +
> +option('qcam',
> +        type : 'boolean',
> +        value : true,
> +        description : 'Compile the qcam test application')

Could we keep the options alphabetically sorted ?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> diff --git a/src/meson.build b/src/meson.build
> index d69b4c1ea9788f83..3a816fb610a68905 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -19,7 +19,10 @@ endif
>  subdir('libcamera')
>  subdir('ipa')
>  subdir('cam')
> -subdir('qcam')
> +
> +if get_option('qcam')
> +    subdir('qcam')
> +endif
>  
>  if get_option('v4l2')
>      subdir('v4l2')
Laurent Pinchart June 16, 2020, 6:11 p.m. UTC | #3
On Tue, Jun 16, 2020 at 02:03:15PM -0400, Nicolas Dufresne wrote:
> Le mardi 16 juin 2020 à 17:27 +0200, Niklas Söderlund a écrit :
> > Add a option to control compilation of the qcam test application. The
> > default behavior is to compile qcam, no change in behavior without user
> > intervention.
> > 
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  meson_options.txt | 5 +++++
> >  src/meson.build   | 5 ++++-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meson_options.txt b/meson_options.txt
> > index badace151bb62bc9..9a4edf2a5fde8bcb 100644
> > --- a/meson_options.txt
> > +++ b/meson_options.txt
> > @@ -27,3 +27,8 @@ option('v4l2',
> >          type : 'boolean',
> >          value : false,
> >          description : 'Compile the V4L2 compatibility layer')
> > +
> > +option('qcam',
> > +        type : 'boolean',
> > +        value : true,
> > +        description : 'Compile the qcam test application')
> > diff --git a/src/meson.build b/src/meson.build
> > index d69b4c1ea9788f83..3a816fb610a68905 100644
> > --- a/src/meson.build
> > +++ b/src/meson.build
> > @@ -19,7 +19,10 @@ endif
> >  subdir('libcamera')
> >  subdir('ipa')
> >  subdir('cam')
> > -subdir('qcam')
> > +
> > +if get_option('qcam')
> > +    subdir('qcam')
> > +endif
> 
> It's much cleaner if you check that option inside the subdir
> meson.build and call subdir_done() instead.
> 
> (ignore if your required meson version is too ancient)

Actually, now that I've sent an Rb tag, I wonder if we should make the
option a feature instead of a boolean, and use

qt5_dep = dependency('qt5',
                     method : 'pkg-config',
                     modules : ['Core', 'Gui', 'Widgets'],
                     required : get_option('qcam'))

like we do for gstreamer. We wouldn't need to use subdir_done().

> >  
> >  if get_option('v4l2')
> >      subdir('v4l2')
> 
> And then this could be cleaned up.

subdir_done() was introduced in 0.46 and we require 0.47 or newer, so
this should indeed be cleaned up.

Patch

diff --git a/meson_options.txt b/meson_options.txt
index badace151bb62bc9..9a4edf2a5fde8bcb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,3 +27,8 @@  option('v4l2',
         type : 'boolean',
         value : false,
         description : 'Compile the V4L2 compatibility layer')
+
+option('qcam',
+        type : 'boolean',
+        value : true,
+        description : 'Compile the qcam test application')
diff --git a/src/meson.build b/src/meson.build
index d69b4c1ea9788f83..3a816fb610a68905 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -19,7 +19,10 @@  endif
 subdir('libcamera')
 subdir('ipa')
 subdir('cam')
-subdir('qcam')
+
+if get_option('qcam')
+    subdir('qcam')
+endif
 
 if get_option('v4l2')
     subdir('v4l2')