aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-05-14 12:12:57 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-14 19:40:36 +0300
commit4e476c82f34d46e3fd1358b46220bff74826b3e4 (patch)
treee143c4abe78e0199a184756c7fe57019699fa40b /docs
parentc69a4aee1eb8f78770d59afec6dd12ebea9bfbd1 (diff)
downloadmeson-4e476c82f34d46e3fd1358b46220bff74826b3e4.zip
meson-4e476c82f34d46e3fd1358b46220bff74826b3e4.tar.gz
meson-4e476c82f34d46e3fd1358b46220bff74826b3e4.tar.bz2
gnome: add mkenums_simple()
99% of all mkenums uses in C libraries use the same basic template, so add a mkenums_simple() function that takes care of everything for us based on that template. Features: - optional function declaration decorator such as GLIB_AVAILABLE - optional extra header prefix (e.g. for include needed for decorator) - optional extra body prefix (e.g. for additional includes) - optional function name prefix (e.g. to add leading underscores) Fixes issue #1384
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/Gnome-module.md49
-rw-r--r--docs/markdown/Release-notes-for-0.42.0.md7
2 files changed, 56 insertions, 0 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 038f1ea..0e24bb0 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -72,6 +72,12 @@ Returns an array of two elements which are: `[c_source, header_file]`
Generates enum files for GObject using the `glib-mkenums` tool. The first argument is the base name of the output files.
+This method is essentially a wrapper around the `glib-mkenums` tool's command line API. It is the most featureful method for enum creation.
+
+Typically you either provide template files or you specify the various template sections manually as strings.
+
+Most libraries and applications will be using the same standard template with only minor tweaks, in which case the `gnome.mkenums_simple()` convenience method can be used instead.
+
Note that if you `#include` the generated header in any of the sources for a build target, you must add the generated header to the build target's list of sources to codify the dependency. This is true for all generated sources, not just `mkenums`.
* `sources`: the list of sources to make enums with
@@ -93,6 +99,49 @@ Note that if you `#include` the generated header in any of the sources for a bui
Returns an array of two elements which are: `[c_source, header_file]`
+### gnome.mkenums_simple()
+
+Generates enum `.c` and `.h` files for GObject using the `glib-mkenums` tool
+with the standard template used by most GObject-based C libraries. The first
+argument is the base name of the output files.
+
+Note that if you `#include` the generated header in any of the sources for a
+build target, you must add the generated header to the build target's list of
+sources to codify the dependency. This is true for all generated sources, not
+just `mkenums_simple`.
+
+* `sources`: the list of sources to make enums with
+* `install_header`: if true, install the generated header
+* `install_dir`: directory to install the header
+* `identifier_prefix`: prefix to use for the identifiers
+* `symbol_prefix`: prefix to use for the symbols
+* `header_prefix`: additional prefix at the top of the header file, e.g. for extra includes (which may be needed if you specify a decorator for the function declarations)
+* `decorator`: optional decorator for the function declarations, e.g. `GTK_AVAILABLE` or `GST_EXPORT`
+* `function_prefix`: additional prefix for function names, e.g. in case you want to add a leading underscore to functions used only internally
+* `body_prefix`: additional prefix at the top of the body file, e.g. for extra includes
+
+Example:
+
+```meson
+gnome = import('gnome')
+
+my_headers = ['myheader1.h', 'myheader2.h']
+my_sources = ['mysource1.c', 'mysource2.c']
+
+# will generate myenums.c and myenums.h based on enums in myheader1.h and myheader2.h
+enums = gnome.mkenums_simple('myenums', sources : my_headers)
+
+mylib = library('my', my_sources, enums,
+ include_directories: my_incs,
+ dependencies: my_deps,
+ c_args: my_cargs,
+ install: true)
+```
+
+*Added 0.42.0*
+
+Returns an array of two elements which are: `[c_source, header_file]`
+
### gnome.compile_schemas()
When called, this method will compile the gschemas in the current directory. Note that this is not
diff --git a/docs/markdown/Release-notes-for-0.42.0.md b/docs/markdown/Release-notes-for-0.42.0.md
index 1ed74dc..3ba84eb 100644
--- a/docs/markdown/Release-notes-for-0.42.0.md
+++ b/docs/markdown/Release-notes-for-0.42.0.md
@@ -140,3 +140,10 @@ using the `pcap-config` tool. It is used like any other dependency:
```meson
pcap_dep = dependency('pcap', version : '>=1.0')
```
+
+## GNOME module mkenums_simple() addition
+
+Most libraries and applications use the same standard templates for
+glib-mkenums. There is now a new `mkenums_simple()` convenience method
+that passes those default templates to glib-mkenums and allows some tweaks
+such as optional function decorators or leading underscores.