Re: Compiled resources



On 8/4/2011 5:33 PM, George Brink wrote:
I'd like to insert some files into my binary. For example application
icons, glade definitions of primary windows etc...
In Qt such task is done by utilizing QRC:
http://doc.qt.nokia.com/latest/resources.html
Does GLib/GTK have something similar? If not, what external
libraries/tools do you use for such a task?


for now I decided to go with this solution:
-------- makefile --------------
$(BUILD_DIR)/%.inc : ui/%.glade
	@echo Converting $< to $@
	@echo /\* autogenerated file, do not modify! \*/> $@
	@echo /\* souce file: $< \*/>> $@
	@echo const gchar \* $(subst .,_,$(<F))=>> $@
	@sed -e 's/"/\\"/g' -e 's/.*/"&"/' $< >> $@
	@echo \;>> $@

$(BUILD_DIR)/%.inc : images/%.png
	@echo Converting $< to $@
	@gdk-pixbuf-csource --raw --name=$(subst .,_,$(<F)) $< > $@
-----------------------------------

--- main.c -----------
#include "build/Window.inc"
#include "build/Icon.inc"

gtk_builder_add_from_string(builder, Window_glade, -1, &error);
pixbuf = gdk_pixbuf_new_from_inline(-1, Icon_png, FALSE, &error);
----------------------

Works fine...



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