build: Use new mkenums_simple() function

As most libraries use the same mkenums templates, meson now added a
mkenums_simple() variant that works without providing the template.

https://bugzilla.gnome.org/show_bug.cgi?id=786343
This commit is contained in:
Florian Müllner 2017-08-15 21:54:48 +02:00
parent 2ae63691e9
commit ab0e98dfdd
6 changed files with 7 additions and 124 deletions

View File

@ -182,10 +182,8 @@ if enable_recorder
endif
libshell_enums = gnome.mkenums('shell-enum-types',
sources: libshell_public_headers,
c_template: 'shell-enum-types.c.in',
h_template: 'shell-enum-types.h.in'
libshell_enums = gnome.mkenums_simple('shell-enum-types',
sources: libshell_public_headers
)
libshell_gir_sources = [

View File

@ -1,30 +0,0 @@
/*** BEGIN file-header ***/
#include "shell-enum-types.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
#include "@filename@"
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void) {
static GType enum_type_id = 0;
if (G_UNLIKELY (!enum_type_id))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
enum_type_id = g_@type@_register_static("@EnumName@", values);
}
return enum_type_id;
}
/*** END value-tail ***/

View File

@ -1,25 +0,0 @@
/*** BEGIN file-header ***/
#ifndef __SHELL_ENUM_TYPES_H__
#define __SHELL_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* !__SHELL_ENUM_TYPES_H__ */
/*** END file-tail ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define SHELL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/

View File

@ -82,10 +82,12 @@ st_sources = [
'st-widget.c'
]
st_enums = gnome.mkenums('st-enum-types',
st_enums = gnome.mkenums_simple('st-enum-types',
sources: st_headers,
c_template: 'st-enum-types.c.in',
h_template: 'st-enum-types.h.in'
header_prefix: '''
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
#error "Only <st/st.h> can be included directly.h"
#endif'''
)
st_gir_sources = st_sources + st_private_headers + st_headers + st_enums

View File

@ -1,33 +0,0 @@
/*** BEGIN file-header ***/
#ifndef ST_COMPILATION
#define ST_COMPILATION
#endif
#include "st-enum-types.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
#include "@filename@"
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void) {
static GType enum_type_id = 0;
if (G_UNLIKELY (!enum_type_id))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
enum_type_id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
}
return enum_type_id;
}
/*** END value-tail ***/

View File

@ -1,29 +0,0 @@
/*** BEGIN file-header ***/
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
#error "Only <st/st.h> can be included directly.h"
#endif
#ifndef __ST_ENUM_TYPES_H__
#define __ST_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* !__ST_ENUM_TYPES_H__ */
/*** END file-tail ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define ST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/