[02/10] meson: Fix mismatch in controls and properties generated file names
diff mbox series

Message ID 20240809005914.20662-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Improve code generation for controls
Related show

Commit Message

Laurent Pinchart Aug. 9, 2024, 12:59 a.m. UTC
The header for controls and properties are generated from the
control_ids.h.in and property_ids.h.in templates respectively, and the
generated files are named control_ids.h and property_ids.h.

For sources, the templates are named control_ids.cpp.in and
property_ids.cpp.in, but the output files are named controls_ids.cpp and
properties_ids.cpp. This discrepancy causes confusion. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/meson.build | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

Comments

Dan Scally Aug. 14, 2024, 9:51 p.m. UTC | #1
Hi Laurent

On 09/08/2024 01:59, Laurent Pinchart wrote:
> The header for controls and properties are generated from the
> control_ids.h.in and property_ids.h.in templates respectively, and the
> generated files are named control_ids.h and property_ids.h.
>
> For sources, the templates are named control_ids.cpp.in and
> property_ids.cpp.in, but the output files are named controls_ids.cpp and
> properties_ids.cpp. This discrepancy causes confusion. Fix it.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>   src/libcamera/meson.build | 22 +++++++++++++---------
>   1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 79b8cbaf1311..e5e959d9c7bd 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -129,21 +129,25 @@ endif
>   control_sources = []
>   
>   controls_mode_files = {
> -    'controls' : controls_files,
> -    'properties' : properties_files,
> +    'controls': [
> +        controls_files,
> +        'control_ids.cpp',
> +    ],
> +    'properties': [
> +        properties_files,
> +        'property_ids.cpp',
> +    ],
>   }
>   
> -foreach mode, input_files : controls_mode_files
> -    if mode == 'controls'
> -        template_file = files('control_ids.cpp.in')
> -    else
> -        template_file = files('property_ids.cpp.in')
> -    endif
> +foreach mode, inout_files : controls_mode_files
> +    input_files = inout_files[0]
> +    output_file = inout_files[1]
>   
> +    template_file = files(output_file + '.in')
>       ranges_file = files('control_ranges.yaml')
>       control_sources += custom_target(mode + '_cpp',
>                                        input : input_files,
> -                                     output : mode + '_ids.cpp',
> +                                     output : output_file,
>                                        command : [gen_controls, '-o', '@OUTPUT@',
>                                                   '--mode', mode, '-t', template_file,
>                                                   '-r', ranges_file, '@INPUT@'])
Paul Elder Aug. 15, 2024, 1:37 a.m. UTC | #2
On Fri, Aug 09, 2024 at 03:59:06AM +0300, Laurent Pinchart wrote:
> The header for controls and properties are generated from the
> control_ids.h.in and property_ids.h.in templates respectively, and the
> generated files are named control_ids.h and property_ids.h.
> 
> For sources, the templates are named control_ids.cpp.in and
> property_ids.cpp.in, but the output files are named controls_ids.cpp and
> properties_ids.cpp. This discrepancy causes confusion. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/meson.build | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 79b8cbaf1311..e5e959d9c7bd 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -129,21 +129,25 @@ endif
>  control_sources = []
>  
>  controls_mode_files = {
> -    'controls' : controls_files,
> -    'properties' : properties_files,
> +    'controls': [
> +        controls_files,
> +        'control_ids.cpp',
> +    ],
> +    'properties': [
> +        properties_files,
> +        'property_ids.cpp',
> +    ],
>  }
>  
> -foreach mode, input_files : controls_mode_files
> -    if mode == 'controls'
> -        template_file = files('control_ids.cpp.in')
> -    else
> -        template_file = files('property_ids.cpp.in')
> -    endif
> +foreach mode, inout_files : controls_mode_files
> +    input_files = inout_files[0]
> +    output_file = inout_files[1]
>  
> +    template_file = files(output_file + '.in')
>      ranges_file = files('control_ranges.yaml')
>      control_sources += custom_target(mode + '_cpp',
>                                       input : input_files,
> -                                     output : mode + '_ids.cpp',
> +                                     output : output_file,
>                                       command : [gen_controls, '-o', '@OUTPUT@',
>                                                  '--mode', mode, '-t', template_file,
>                                                  '-r', ranges_file, '@INPUT@'])

Patch
diff mbox series

diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 79b8cbaf1311..e5e959d9c7bd 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -129,21 +129,25 @@  endif
 control_sources = []
 
 controls_mode_files = {
-    'controls' : controls_files,
-    'properties' : properties_files,
+    'controls': [
+        controls_files,
+        'control_ids.cpp',
+    ],
+    'properties': [
+        properties_files,
+        'property_ids.cpp',
+    ],
 }
 
-foreach mode, input_files : controls_mode_files
-    if mode == 'controls'
-        template_file = files('control_ids.cpp.in')
-    else
-        template_file = files('property_ids.cpp.in')
-    endif
+foreach mode, inout_files : controls_mode_files
+    input_files = inout_files[0]
+    output_file = inout_files[1]
 
+    template_file = files(output_file + '.in')
     ranges_file = files('control_ranges.yaml')
     control_sources += custom_target(mode + '_cpp',
                                      input : input_files,
-                                     output : mode + '_ids.cpp',
+                                     output : output_file,
                                      command : [gen_controls, '-o', '@OUTPUT@',
                                                 '--mode', mode, '-t', template_file,
                                                 '-r', ranges_file, '@INPUT@'])