Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions gum/fast/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
all: fast.c
# Use 'cython2' if present on this system; otherwise fall back to 'cython'.
CYTHON := $(if $(shell command -v cython2 2>/dev/null), cython2, cython)

fast.c: fast.pyx
cython2 fast.pyx
all: fast.so

fast.so: fast.c
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \
-I/usr/include/python2.5 -I/usr/include/python2.6 \
-I/usr/include/python2.7 \
-lcairo -o fast.so fast.c
`pkg-config --cflags cairo` \
-o fast.so fast.c \
`pkg-config --libs cairo`
if [ ! -e ../fast.so ]; then ln -s fast/fast.so ../; fi

fast.c: fast.pyx
$(CYTHON) fast.pyx

clean:
rm -f fast.so fast.c
8 changes: 0 additions & 8 deletions gum/fast/fast.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ typedef struct {
void *ctx;
} PycairoContext;

void cairo_move_to (void *cr, double x, double y);
void cairo_line_to (void *cr, double x, double y);
void cairo_rectangle(void *cr, double x, double ymin,
double w, double h);
void cairo_set_source_rgb (void *cr, double r, double g, double b);
void cairo_stroke (void *cr);
void cairo_fill (void *cr);
void cairo_set_line_width(void *cr, double w);
2 changes: 2 additions & 0 deletions gum/fast/fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cdef extern from "math.h":
cdef extern from "fast.h":
ctypedef struct PycairoContext:
void *ctx

cdef extern from "<cairo.h>":
void cairo_move_to (void *cr, double x, double y) nogil
void cairo_line_to (void *cr, double x, double y) nogil
void cairo_rectangle(void *cr, double x, double ymin,
Expand Down
11 changes: 9 additions & 2 deletions gum/fx/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
all:
cython2 _svf.pyx
# Use 'cython2' if present on this system; otherwise fall back to 'cython'.
CYTHON := $(if $(shell command -v cython2 2>/dev/null), cython2, cython)

all: _svf.so

_svf.so: _svf.c
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \
-I/usr/include/python2.5 -I/usr/include/python2.6 \
-I/usr/include/python2.7 \
-o _svf.so _svf.c

_svf.c: _svf.pyx
$(CYTHON) _svf.pyx

clean:
rm -f _svf.so _svf.c