glib-compile-resources
GLib resource file compiler
TLDR
Compile resources to a binary bundle
SYNOPSIS
glib-compile-resources [OPTIONS] FILE
DESCRIPTION
glib-compile-resources compiles application resources (images, UI files, CSS, icons, data) into binary bundles or C source for embedding in GLib/GTK applications. Resources are described in XML files (typically with .gresource.xml extension) that list files to include and optional preprocessing.
The GResource system enables applications to access embedded resources through a virtual filesystem path (e.g., /org/myapp/data.txt) without external file dependencies. This simplifies deployment and improves load times.
PARAMETERS
--target=TARGET
Output file path. Defaults to basename of input with appropriate extension.--sourcedir=DIR
Directory containing resource files referenced in the XML.--generate-source
Generate C source file instead of binary bundle.--generate-header
Generate C header file for use with generated source.--generate-dependencies
Print list of referenced files to stdout.--c-name=PREFIX
Prefix for C identifiers in generated code.--manual-register
Generate manual register/unregister functions instead of auto-initialization.--internal
Generate internal symbols (not exported).
CAVEATS
Resource paths in the XML must match actual file locations relative to sourcedir. The xmllint tool may be required for XML preprocessing options. Large resources increase binary size significantly.
HISTORY
glib-compile-resources was introduced with GLib 2.32 in March 2012 as part of the GResource API. It replaced ad-hoc methods for embedding resources in GTK applications, providing a standardized approach that integrates with the GNOME build system.
SEE ALSO
glib-genmarshal(1), glib-mkenums(1), gtk4-builder-tool(1)
