[libcamera-devel] [PATCH v1 1/2] Documentation: Add predefined macros from config.h to Doxyfile

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat May 6 13:10:24 CEST 2023


libcamera creates a config.h file with predefine 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.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 Documentation/Doxyfile.in | 3 ++-
 Documentation/meson.build | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

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..ed581163345e 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', ' '.join(doxygen_predefined))
+
     doxyfile = configure_file(input : 'Doxyfile.in',
                               output : 'Doxyfile',
                               configuration : cdata)
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list