[libcamera-devel,v2.1,1/2] Documentation: Add predefined macros from config.h to Doxyfile
diff mbox series

Message ID 20230705083111.32462-1-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel,v2.1,1/2] Documentation: Add predefined macros from config.h to Doxyfile
Related show

Commit Message

Laurent Pinchart July 5, 2023, 8:31 a.m. UTC
libcamera creates a config.h file with predefined macros, and instructs
the compiler to include it implicitly with the -include argument.
Doxygen has no support for implicit inclusion of headers, but has a
PREDEFINED configuration option for its preprocessor that lists
predefined macros. Populate it with the values from the config_h
configuration data object that is used for generate the config.h file,
to ensure that documentation matches the configuration options libcamera
has been built with.

Bump the minimum meson version to 0.57 to use cfg_data.keys().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
Changes since v2:

- Bump the minimum meson version to 0.57.

Changes since v1:

- Correct indentation and line wrap in the generate Doxyfile
---
 Documentation/Doxyfile.in | 3 ++-
 Documentation/meson.build | 7 +++++++
 meson.build               | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

Comments

Kieran Bingham July 5, 2023, 11:32 a.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2023-07-05 09:31:11)
> libcamera creates a config.h file with predefined macros, and instructs
> the compiler to include it implicitly with the -include argument.
> Doxygen has no support for implicit inclusion of headers, but has a
> PREDEFINED configuration option for its preprocessor that lists
> predefined macros. Populate it with the values from the config_h
> configuration data object that is used for generate the config.h file,
> to ensure that documentation matches the configuration options libcamera
> has been built with.
> 
> Bump the minimum meson version to 0.57 to use cfg_data.keys().
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
> Changes since v2:
> 
> - Bump the minimum meson version to 0.57.
> 
> Changes since v1:
> 
> - Correct indentation and line wrap in the generate Doxyfile
> ---
>  Documentation/Doxyfile.in | 3 ++-
>  Documentation/meson.build | 7 +++++++
>  meson.build               | 2 +-
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> index 1447abdb7d8c..697a14d1dfe2 100644
> --- a/Documentation/Doxyfile.in
> +++ b/Documentation/Doxyfile.in
> @@ -80,6 +80,7 @@ INCLUDE_FILE_PATTERNS  = *.h
>  
>  PREDEFINED             = __DOXYGEN__ \
>                           __cplusplus \
> -                         __attribute__(x)=
> +                         __attribute__(x)= \
> +                        @PREDEFINED@
>  
>  HAVE_DOT               = YES
> diff --git a/Documentation/meson.build b/Documentation/meson.build
> index 186461561f8d..d675f368cf79 100644
> --- a/Documentation/meson.build
> +++ b/Documentation/meson.build
> @@ -16,6 +16,13 @@ if doxygen.found() and dot.found()
>      cdata.set('TOP_BUILDDIR', meson.project_build_root())
>      cdata.set('OUTPUT_DIR', meson.current_build_dir())
>  
> +    doxygen_predefined = []
> +    foreach key : config_h.keys()
> +        doxygen_predefined += '@0@=@1@'.format(key, config_h.get(key))
> +    endforeach
> +
> +    cdata.set('PREDEFINED', ' \\\n\t\t\t '.join(doxygen_predefined))
> +
>      doxyfile = configure_file(input : 'Doxyfile.in',
>                                output : 'Doxyfile',
>                                configuration : cdata)
> diff --git a/meson.build b/meson.build
> index 9c1e708131eb..62db8ed8105d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
>  project('libcamera', 'c', 'cpp',
> -    meson_version : '>= 0.56',
> +    meson_version : '>= 0.57',

Ubuntu LTS is currently 22.04 with meson 0.61.2
Debian Bullseye has 0.56.1 but has 1.0.0 is available in backports
Fedora 37 is at 1.0.1 ...

So ... I think we're easily good up to 0.61 at the moment.

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

>      version : '0.0.5',
>      default_options : [
>          'werror=true',
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart July 5, 2023, 11:40 a.m. UTC | #2
On Wed, Jul 05, 2023 at 12:32:53PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart via libcamera-devel (2023-07-05 09:31:11)
> > libcamera creates a config.h file with predefined macros, and instructs
> > the compiler to include it implicitly with the -include argument.
> > Doxygen has no support for implicit inclusion of headers, but has a
> > PREDEFINED configuration option for its preprocessor that lists
> > predefined macros. Populate it with the values from the config_h
> > configuration data object that is used for generate the config.h file,
> > to ensure that documentation matches the configuration options libcamera
> > has been built with.
> > 
> > Bump the minimum meson version to 0.57 to use cfg_data.keys().
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> > Changes since v2:
> > 
> > - Bump the minimum meson version to 0.57.
> > 
> > Changes since v1:
> > 
> > - Correct indentation and line wrap in the generate Doxyfile
> > ---
> >  Documentation/Doxyfile.in | 3 ++-
> >  Documentation/meson.build | 7 +++++++
> >  meson.build               | 2 +-
> >  3 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> > index 1447abdb7d8c..697a14d1dfe2 100644
> > --- a/Documentation/Doxyfile.in
> > +++ b/Documentation/Doxyfile.in
> > @@ -80,6 +80,7 @@ INCLUDE_FILE_PATTERNS  = *.h
> >  
> >  PREDEFINED             = __DOXYGEN__ \
> >                           __cplusplus \
> > -                         __attribute__(x)=
> > +                         __attribute__(x)= \
> > +                        @PREDEFINED@
> >  
> >  HAVE_DOT               = YES
> > diff --git a/Documentation/meson.build b/Documentation/meson.build
> > index 186461561f8d..d675f368cf79 100644
> > --- a/Documentation/meson.build
> > +++ b/Documentation/meson.build
> > @@ -16,6 +16,13 @@ if doxygen.found() and dot.found()
> >      cdata.set('TOP_BUILDDIR', meson.project_build_root())
> >      cdata.set('OUTPUT_DIR', meson.current_build_dir())
> >  
> > +    doxygen_predefined = []
> > +    foreach key : config_h.keys()
> > +        doxygen_predefined += '@0@=@1@'.format(key, config_h.get(key))
> > +    endforeach
> > +
> > +    cdata.set('PREDEFINED', ' \\\n\t\t\t '.join(doxygen_predefined))
> > +
> >      doxyfile = configure_file(input : 'Doxyfile.in',
> >                                output : 'Doxyfile',
> >                                configuration : cdata)
> > diff --git a/meson.build b/meson.build
> > index 9c1e708131eb..62db8ed8105d 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -1,7 +1,7 @@
> >  # SPDX-License-Identifier: CC0-1.0
> >  
> >  project('libcamera', 'c', 'cpp',
> > -    meson_version : '>= 0.56',
> > +    meson_version : '>= 0.57',
> 
> Ubuntu LTS is currently 22.04 with meson 0.61.2
> Debian Bullseye has 0.56.1 but has 1.0.0 is available in backports
> Fedora 37 is at 1.0.1 ...
> 
> So ... I think we're easily good up to 0.61 at the moment.

And of course the next feature I'd like to use is dependency('dl'),
which requires 0.62 :-)

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> >      version : '0.0.5',
> >      default_options : [
> >          'werror=true',
Kieran Bingham July 5, 2023, 12:31 p.m. UTC | #3
Quoting Laurent Pinchart (2023-07-05 12:40:10)
> On Wed, Jul 05, 2023 at 12:32:53PM +0100, Kieran Bingham wrote:
> > Quoting Laurent Pinchart via libcamera-devel (2023-07-05 09:31:11)
> > > libcamera creates a config.h file with predefined macros, and instructs
> > > the compiler to include it implicitly with the -include argument.
> > > Doxygen has no support for implicit inclusion of headers, but has a
> > > PREDEFINED configuration option for its preprocessor that lists
> > > predefined macros. Populate it with the values from the config_h
> > > configuration data object that is used for generate the config.h file,
> > > to ensure that documentation matches the configuration options libcamera
> > > has been built with.
> > > 
> > > Bump the minimum meson version to 0.57 to use cfg_data.keys().
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > > ---
> > > Changes since v2:
> > > 
> > > - Bump the minimum meson version to 0.57.
> > > 
> > > Changes since v1:
> > > 
> > > - Correct indentation and line wrap in the generate Doxyfile
> > > ---
> > >  Documentation/Doxyfile.in | 3 ++-
> > >  Documentation/meson.build | 7 +++++++
> > >  meson.build               | 2 +-
> > >  3 files changed, 10 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> > > index 1447abdb7d8c..697a14d1dfe2 100644
> > > --- a/Documentation/Doxyfile.in
> > > +++ b/Documentation/Doxyfile.in
> > > @@ -80,6 +80,7 @@ INCLUDE_FILE_PATTERNS  = *.h
> > >  
> > >  PREDEFINED             = __DOXYGEN__ \
> > >                           __cplusplus \
> > > -                         __attribute__(x)=
> > > +                         __attribute__(x)= \
> > > +                        @PREDEFINED@
> > >  
> > >  HAVE_DOT               = YES
> > > diff --git a/Documentation/meson.build b/Documentation/meson.build
> > > index 186461561f8d..d675f368cf79 100644
> > > --- a/Documentation/meson.build
> > > +++ b/Documentation/meson.build
> > > @@ -16,6 +16,13 @@ if doxygen.found() and dot.found()
> > >      cdata.set('TOP_BUILDDIR', meson.project_build_root())
> > >      cdata.set('OUTPUT_DIR', meson.current_build_dir())
> > >  
> > > +    doxygen_predefined = []
> > > +    foreach key : config_h.keys()
> > > +        doxygen_predefined += '@0@=@1@'.format(key, config_h.get(key))
> > > +    endforeach
> > > +
> > > +    cdata.set('PREDEFINED', ' \\\n\t\t\t '.join(doxygen_predefined))
> > > +
> > >      doxyfile = configure_file(input : 'Doxyfile.in',
> > >                                output : 'Doxyfile',
> > >                                configuration : cdata)
> > > diff --git a/meson.build b/meson.build
> > > index 9c1e708131eb..62db8ed8105d 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -1,7 +1,7 @@
> > >  # SPDX-License-Identifier: CC0-1.0
> > >  
> > >  project('libcamera', 'c', 'cpp',
> > > -    meson_version : '>= 0.56',
> > > +    meson_version : '>= 0.57',
> > 
> > Ubuntu LTS is currently 22.04 with meson 0.61.2
> > Debian Bullseye has 0.56.1 but has 1.0.0 is available in backports
> > Fedora 37 is at 1.0.1 ...
> > 
> > So ... I think we're easily good up to 0.61 at the moment.
> 
> And of course the next feature I'd like to use is dependency('dl'),
> which requires 0.62 :-)

It's not 'too' long until 24.04 ... right ?....

> 
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> > >      version : '0.0.5',
> > >      default_options : [
> > >          'werror=true',
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
index 1447abdb7d8c..697a14d1dfe2 100644
--- a/Documentation/Doxyfile.in
+++ b/Documentation/Doxyfile.in
@@ -80,6 +80,7 @@  INCLUDE_FILE_PATTERNS  = *.h
 
 PREDEFINED             = __DOXYGEN__ \
                          __cplusplus \
-                         __attribute__(x)=
+                         __attribute__(x)= \
+			 @PREDEFINED@
 
 HAVE_DOT               = YES
diff --git a/Documentation/meson.build b/Documentation/meson.build
index 186461561f8d..d675f368cf79 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -16,6 +16,13 @@  if doxygen.found() and dot.found()
     cdata.set('TOP_BUILDDIR', meson.project_build_root())
     cdata.set('OUTPUT_DIR', meson.current_build_dir())
 
+    doxygen_predefined = []
+    foreach key : config_h.keys()
+        doxygen_predefined += '@0@=@1@'.format(key, config_h.get(key))
+    endforeach
+
+    cdata.set('PREDEFINED', ' \\\n\t\t\t '.join(doxygen_predefined))
+
     doxyfile = configure_file(input : 'Doxyfile.in',
                               output : 'Doxyfile',
                               configuration : cdata)
diff --git a/meson.build b/meson.build
index 9c1e708131eb..62db8ed8105d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
 project('libcamera', 'c', 'cpp',
-    meson_version : '>= 0.56',
+    meson_version : '>= 0.57',
     version : '0.0.5',
     default_options : [
         'werror=true',