diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gi/gi-test.py | 8 | ||||
-rw-r--r-- | test/gi/makefile | 26 |
2 files changed, 24 insertions, 10 deletions
diff --git a/test/gi/gi-test.py b/test/gi/gi-test.py index 10cee8bc6..6c775ea0c 100644 --- a/test/gi/gi-test.py +++ b/test/gi/gi-test.py @@ -1,6 +1,12 @@ #!/usr/bin/python -from gi.repository import Gtk +import gi +gi.require_version('Scintilla', '0.1') + +# Scintilla is imported before because it loads Gtk with a specified version +# this avoids a warning when Gtk is imported without version such as below (where +# it is imported without because this script works with gtk2 and gtk3) from gi.repository import Scintilla +from gi.repository import Gtk win = Gtk.Window() win.connect("delete-event", Gtk.main_quit) diff --git a/test/gi/makefile b/test/gi/makefile index 41d200653..44277fbbc 100644 --- a/test/gi/makefile +++ b/test/gi/makefile @@ -1,14 +1,16 @@ all: Scintilla-0.1.typelib ifdef GTK3 -GTKVERSION=gtk+-3.0 +GTKVERSION=3.0 else -GTKVERSION=gtk+-2.0 +GTKVERSION=2.0 endif GI_SCANNER = g-ir-scanner GI_COMPILER = g-ir-compiler -GTK_LIBS = $(shell pkg-config --libs $(GTKVERSION)) +GTK_LIBS = $(shell pkg-config --libs gtk+-$(GTKVERSION)) +GTK_CFLAGS = $(shell pkg-config --cflags gtk+-$(GTKVERSION)) +PWD = $(shell pwd) FORCE: @@ -19,17 +21,23 @@ libscintilla.so: ../../bin/scintilla.a $(CXX) -shared -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive $(GTK_LIBS) Scintilla-0.1.gir: libscintilla.so - LDFLAGS=-Wl,-rpath=$(shell pwd) CFLAGS="-include gtk/gtk.h" \ - $(GI_SCANNER) --warn-all -i Gtk-3.0 -DG_IR_SCANNING -DGTK \ + LDFLAGS=-Wl,-rpath=$(shell pwd) \ + $(GI_SCANNER) --warn-all -i Gtk-$(GTKVERSION) -DG_IR_SCANNING -DGTK \ + --cflags-begin $(GTK_CFLAGS) -include gtk/gtk.h --cflags-end \ --c-include Scintilla.h --c-include ScintillaWidget.h \ - -n Scintilla --nsversion 0.1 --library scintilla ../../include/ScintillaWidget.h \ + -n Scintilla --nsversion 0.1 --library scintilla -L$(PWD) ../../include/ScintillaWidget.h \ -o $@ - @echo Verifing Scintilla-0.1.gir file - @diff $@.good $@ || (echo "GIR FILE MISMATCH!"; exit 1) - Scintilla-0.1.typelib: Scintilla-0.1.gir $(GI_COMPILER) $^ -o $@ clean: rm -f libscintilla.so Scintilla-0.1.gir Scintilla-0.1.typelib + $(MAKE) -C ../../gtk clean + +test: Scintilla-0.1.gir + @echo Verifing Scintilla-0.1.gir file + @diff $^.good $^ || (echo "GIR FILE MISMATCH!"; exit 1) + @echo Launching gi-test.py python program + GI_TYPELIB_PATH=$(PWD) LD_LIBRARY_PATH=$(PWD) \ + python $(PWD)/gi-test.py |