[libhandy/wip/exalm/backports: 1/5] enums: let mkenums use the standard template




commit e5ef4ad374252c78f17de5e03ca7fb5915a8bae6
Author: Zander Brown <zbrown gnome org>
Date:   Fri Nov 12 10:15:01 2021 +0000

    enums: let mkenums use the standard template
    
    We don't need to do anything fancy and the manually written file-header
    section was causing confusion when adding new enums
    
    See https://gitlab.gnome.org/GNOME/libadwaita/-/commit/872d942930fe72f45410a2a64155c3df2be94a0c

 src/hdy-enums-private.c.in | 39 ---------------------------------------
 src/hdy-enums-private.h.in | 27 ---------------------------
 src/hdy-enums.c.in         | 46 ----------------------------------------------
 src/hdy-enums.h.in         | 28 ----------------------------
 src/meson.build            | 21 +++++++++++++++------
 5 files changed, 15 insertions(+), 146 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 6f11f27b..318faea3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -48,18 +48,27 @@ libhandy_public_headers = []
 libhandy_public_sources = []
 libhandy_private_sources = []
 
-hdy_public_enums = gnome.mkenums('hdy-enums',
-      h_template: 'hdy-enums.h.in',
-      c_template: 'hdy-enums.c.in',
+hdy_public_enums = gnome.mkenums_simple('hdy-enums',
          sources: hdy_public_enum_headers,
+     body_prefix: '#include "config.h"',
+   header_prefix: '#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)\n' +
+                  '#error "Only <handy.h> can be included directly."\n' +
+                  '#endif\n' +
+                  '\n' +
+                  '#include "hdy-version.h"\n',
+       decorator: 'HDY_AVAILABLE_IN_ALL',
   install_header: true,
      install_dir: libhandy_header_dir,
 )
 
-hdy_private_enums = gnome.mkenums('hdy-enums-private',
-      h_template: 'hdy-enums-private.h.in',
-      c_template: 'hdy-enums-private.c.in',
+hdy_private_enums = gnome.mkenums_simple('hdy-enums-private',
          sources: hdy_private_enum_headers,
+     body_prefix: '#include "config.h"',
+   header_prefix: '#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)\n' +
+                  '#error "Only <handy.h> can be included directly."\n' +
+                  '#endif\n' +
+                  '\n' +
+                  '#include "hdy-enums.h"\n',
   install_header: false,
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]