Compiling cython code as c++ (PySim)

Use following makefile as template:

CURDIR=$(shell pwd)../
PYXFLAGS=-I$(CURDIR)/api -I$(CURDIR)/include
CFLAGS+=-I$(CURDIR)/include -I$(CURDIR)/api
CFLAGS+=-Wno-write-strings -Wall -O2 -Os -fno-strict-aliasing -g
default: fri.so

fri.cpp: fri.pyx server.pyx libfri.h libfri.cpp
 cython fri.pyx -I. -I../api --cplus

fri.so: fri.cpp
 g++ -shared -o fri.so fri.cpp libfri.cpp friremote.cpp friudp.cpp -I/usr/include/python2.6 -DHAVE_TIME_STAMP_RECEIVE $(CFLAGS)
 rm -f fri.cpp

clean:
 rm -f frifirstapp frisecondapp test_fri
 rm -f *.o *.so fri.cpp

The “cython fri.pyx -I. -I../api –cplus” line creates fri.cpp.

Remember to use proper $(CFLAGS) as above.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s