7.6 KiB
GNOME module
This module provides helper tools for build operations needed when building Gnome/GLib programs.
Note: the compilation commands here might not work properly when you change the source files. This is a bug in the respective compilers which do not expose the required dependency information. This has been reported upstream in this bug. Until this is fixed you need to be careful when changing your source files.
Usage
To use this module, just do: gnome = import('gnome')
. The following functions will then be available as methods on the object with the name gnome
. You can, of course, replace the name gnome
with anything else.
gnome.compile_resources()
This function compiles resources specified in an XML file into code that can be embedded inside the main binary. Similar a build target it takes two positional arguments. The first one is the name of the resource and the second is the XML file containing the resource definitions. If the name is foobar
, Meson will generate a header file called foobar.h
, which you can then include in your sources.
source_dir
: a list of subdirectories where the resource compiler should look up the files, relative to the location of the XML filec_name
: passed to the resource compiler as an argument after--c-name
dependencies
: extra targets to depend upon for buildingexport
: (Added 0.37.0) if true, export the symbols of the generated sourcesgresource_bundle
: (Added 0.37.0) if true, output a.gresource
file instead of sourceinstall_header
: (Added 0.37.0) if true, install the header fileinstall
: (Added 0.37.0) if true, install the gresource fileinstall_dir
: (Added 0.37.0) location to install the header or bundle depending on previous optionsextra_args
: extra command line arguments to pass to the resource compiler
Returns an array containing: [c_source, header_file]
or [gresource_bundle]
gnome.generate_gir()
Generates GObject introspection data. Takes one positional argument, the build target you want to build gir data for. There are several keyword arguments. Many of these map directly to the g-ir-scanner
tool so see its documentation for more information.
sources
: the list of sources to be scanned for gir datansversion
: namespace versionnamespace
: the namespace for this gir object which determines output filessymbol_prefix
: the symbol prefix for the gir object, e.g.gtk
identifier_prefix
: the identifier prefix for the gir object, e.g.Gtk
export_packages
: extra packages the gir file exportsincludes
: list of gir names to be included, can also be a GirTargetdependencies
: deps to use during introspection scanninglink_with
: list of libraries to link withinclude_directories
: extra include paths to look for gir filesinstall
: if true, install the generated filesinstall_dir_gir
: (Added 0.35.0) which directory to install the gir file intoinstall_dir_typelib
: (Added 0.35.0) which directory to install the typelib file intoextra_args
: command line arguments to pass to gir compiler
Returns an array of two elements which are: [gir_target, typelib_target]
gnome.genmarshal()
Generates a marshal file using the glib-genmarshal
tool. The first argument is the basename of
the output files.
sources
: the list of sources to use as inputsprefix
: the prefix to use for symbolsinstall_header
: if true, install the generated headerinstall_dir
: directory to install header tostdinc
: if true, include the standard marshallers from glibnostdinc
: if true, don't include the standard marshallers from glibinternal
: if true, mark generated sources as internalskip_source
: if true, skip source location commentsvalist_marshallers
: if true, generate va_list marshallers
Added 0.35.0
Returns an array of two elements which are: [c_source, header_file]
gnome.mkenums()
Generates enum files for GObject using the glib-mkenums
tool. 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
.
sources
: the list of sources to make enums withc_template
: template to use for generating the sourceh_template
: template to use for generating the headerinstall_header
: if true, install the generated headerinstall_dir
: directory to install the headercomments
: comment passed to the commandidentifier_prefix
: prefix to use for the identifierssymbol_prefix
: prefix to use for the symbolseprod
: enum textfhead
: file headerfprod
: file textftail
: file tailvhead
: value textvtail
: value tail
Added 0.35.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 for installing schemas and is only useful when running the application locally for example during tests.
gnome.gdbus_codegen()
Compiles the given XML schema into gdbus source code. Takes two positional arguments, the first one specifies the name of the source files and the second specifies the XML file name. There are three keyword arguments. interface_prefix
and namespace
map to corresponding features of the compiler while object_manager
(since 0.40.0), when set to true, generates object manager code.
Returns an opaque object containing the source files. Add it to a top level target's source list.
gnome.generate_vapi()
Creates a VAPI file from gir. The first argument is the name of the library.
sources
: the gir source to generate the VAPI frompackages
: VAPI packages that are depended uponmetadata_dirs
: extra directories to include for metadata filesgir_dirs
: extra directories to include for gir filesvapi_dirs
: extra directories to include for VAPI files
Returns a custom dependency that can be included when building other VAPI or Vala binaries.
Added 0.36.0
gnome.yelp()
Installs help documentation using Yelp. The first argument is the project id.
This also creates two targets for translations help-$project-update-po
and help-$project-pot
.
sources
: list of pagesmedia
: list of media such as imagessymlink_media
: if media should be symlinked (requires newish yelp) defaults tofalse
languages
: list of languages for translations
Added 0.36.0
gnome.gtkdoc()
Compiles and installs gtkdoc documentation. Takes one positional arguments; The name of the module.
main_xml
: specifies the main XML filemain_sgml
: equal tomain_xml
src_dir
: include_directories to includedependencies
: a list of dependenciesinstall
: if true, installs the generated docsinstall_dir
: the directory to install the generated docsscan_args
: a list of arguments to pass togtkdoc-scan
scanobjs_args
: a list of arguments to pass togtkdoc-scangobj
gobject_typesfile
: a list of type filesfixxref_args
: a list of arguments to pass togtkdoc-fixxref
html_args
a list of arguments to pass togtkdoc-mkhtml
html_assets
: a list of assets for the HTML pagescontent_files
: a list of content files
gnome.gtkdoc_html_dir()
Takes as argument a module name and returns the path where that module's HTML files will be installed. Usually used with install_data
to install extra files, such as images, to the output directory.