summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-06-29 12:36:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-29 12:36:12 +0100
commit5ba4ac2988eb42cf2414b0f29e73fcb83c8f96ae (patch)
treec174a376e81799effc5a5be45dae4a4e1d8b1350
parentf839f87f55059fc958a52702aa13afdce57024de (diff)
Autoinclude poppler based on presence of poppler-glib
-rw-r--r--Makefile9
-rw-r--r--spiral-demo.c7
2 files changed, 11 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 941bdbc..1d863b2 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,12 @@ else
DEFINES+=-DHAVE_GLX=0
endif
-all: spiral-demo poppler-demo
+all: spiral-demo
+
+ifeq ($(shell pkg-config --exists poppler-glib && echo 1), 1)
+all: poppler-demo
+REQUIRES+=poppler-glib
+endif
CFLAGS:=$(shell pkg-config --cflags $(REQUIRES)) -Wall -g3
LIBS:=$(shell pkg-config --libs $(REQUIRES))
@@ -37,7 +42,7 @@ LIBS:=$(shell pkg-config --libs $(REQUIRES))
spiral-demo: spiral-demo.c $(SOURCES) demo.h Makefile
$(CC) $(DEFINES) $(CFLAGS) -o $@ spiral-demo.c $(SOURCES) $(LIBS)
poppler-demo: poppler-demo.c $(SOURCES) demo.h Makefile
- $(CC) $(DEFINES) $(CFLAGS) $(shell pkg-config --cflags poppler-glib) -o $@ poppler-demo.c $(SOURCES) $(LIBS) $(shell pkg-config --libs poppler-glib)
+ $(CC) $(DEFINES) $(CFLAGS) -o $@ poppler-demo.c $(SOURCES) $(LIBS)
clean:
rm -f *-demo
diff --git a/spiral-demo.c b/spiral-demo.c
index f1fa0c5..cda0815 100644
--- a/spiral-demo.c
+++ b/spiral-demo.c
@@ -10,8 +10,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "demo.h"
-#define SHOW_PATH 1
-
struct source{
cairo_surface_t *surface;
int width, height;
@@ -178,6 +176,7 @@ int main(int argc, char **argv)
float sincos_lut[360];
struct timeval start, last, now;
int theta, frames, n;
+ int show_path = 1;
device = device_open(argc, argv);
@@ -185,6 +184,8 @@ int main(int argc, char **argv)
if (strcmp (argv[n], "--images") == 0) {
path = argv[n+1];
n++;
+ } else if (strcmp (argv[n], "--hide-path") == 0) {
+ show_path = 0;
}
}
@@ -224,7 +225,7 @@ int main(int argc, char **argv)
cairo_push_group_with_content(cr, CAIRO_CONTENT_COLOR);
#endif
- if (SHOW_PATH) {
+ if (show_path) {
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_set_line_width(cr, 5);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);