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

fri.cpp: fri.pyx server.pyx libfri.h libfri.cpp
 cython fri.pyx -I. -I../api --cplus fri.cpp
 g++ -shared -o fri.cpp libfri.cpp friremote.cpp friudp.cpp -I/usr/include/python2.6 -DHAVE_TIME_STAMP_RECEIVE $(CFLAGS)
 rm -f fri.cpp

 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.


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s