[libcamera-devel] build: Add project arguments

Message ID 20181126142635.14078-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] build: Add project arguments
Related show

Commit Message

Kieran Bingham Nov. 26, 2018, 2:26 p.m. UTC
Add language specific project arguments and ensure that -Werror is
enabled, enforcing code to be as clean as possible.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

---

This should be kept for development as much as possible, but we may want
to have an automatic relaxation for package builds rather than developer
builds so that external compiler changes do not block users.

 meson.build | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Niklas Söderlund Nov. 26, 2018, 4:21 p.m. UTC | #1
Hi Kieran,

Thanks for your work.

On 2018-11-26 14:26:35 +0000, Kieran Bingham wrote:
> Add language specific project arguments and ensure that -Werror is
> enabled, enforcing code to be as clean as possible.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> 
> ---
> 
> This should be kept for development as much as possible, but we may want
> to have an automatic relaxation for package builds rather than developer
> builds so that external compiler changes do not block users.
> 
>  meson.build | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 494193483079..f1fcb8e20e00 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -7,6 +7,18 @@ project('libcamera - supporting complex camera pipelines', 'c', 'cpp',
>  #	generated from this too.
>  api_version = '0.1'
>  
> +common_arguments = [
> +	'-Wall',
> +	'-Wextra',
> +	'-Werror',
> +]
> +
> +c_arguments = common_arguments
> +cpp_arguments = common_arguments
> +
> +add_project_arguments(c_arguments, language: 'c')
> +add_project_arguments(cpp_arguments, language: 'cpp')
> +
>  inc = include_directories('include')
>  
>  subdir('Documentation')
> -- 
> 2.17.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Nov. 26, 2018, 11:21 p.m. UTC | #2
Hi Kieran,

Thank you for the patch.

On Monday, 26 November 2018 16:26:35 EET Kieran Bingham wrote:
> Add language specific project arguments and ensure that -Werror is
> enabled, enforcing code to be as clean as possible.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> ---
> 
> This should be kept for development as much as possible, but we may want
> to have an automatic relaxation for package builds rather than developer
> builds so that external compiler changes do not block users.
> 
>  meson.build | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 494193483079..f1fcb8e20e00 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -7,6 +7,18 @@ project('libcamera - supporting complex camera pipelines',
> 'c', 'cpp', #	generated from this too.
>  api_version = '0.1'
> 
> +common_arguments = [
> +	'-Wall',
> +	'-Wextra',
> +	'-Werror',

I would already add -Wno-unused-parameter. This could also be done in a 
subsequent patch.

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

> +]
> +
> +c_arguments = common_arguments
> +cpp_arguments = common_arguments
> +
> +add_project_arguments(c_arguments, language: 'c')
> +add_project_arguments(cpp_arguments, language: 'cpp')
> +
>  inc = include_directories('include')
> 
>  subdir('Documentation')

Patch

diff --git a/meson.build b/meson.build
index 494193483079..f1fcb8e20e00 100644
--- a/meson.build
+++ b/meson.build
@@ -7,6 +7,18 @@  project('libcamera - supporting complex camera pipelines', 'c', 'cpp',
 #	generated from this too.
 api_version = '0.1'
 
+common_arguments = [
+	'-Wall',
+	'-Wextra',
+	'-Werror',
+]
+
+c_arguments = common_arguments
+cpp_arguments = common_arguments
+
+add_project_arguments(c_arguments, language: 'c')
+add_project_arguments(cpp_arguments, language: 'cpp')
+
 inc = include_directories('include')
 
 subdir('Documentation')