over.core.types is now using reference cython acceleration

This commit is contained in:
Overwatch 2014-08-13 00:35:21 +02:00
parent 0df57ad386
commit fd984be2f6
6 changed files with 165 additions and 109 deletions

View file

@ -8,56 +8,15 @@ function die() {
exit 1
}
function translate() {
echo -n "Translating from Python to C: "
first=1
for item in ${@}
do
if [ $first -eq 1 ]; then
echo -n "${item}"
first=0
else
echo -n ", ${item}"
fi
cython -3 ${item}.pyx -o ${item}.c || die "translating"
done
echo "."
}
function combobulate() {
name="$1"
echo -n > "$name.pyx"
for part in src/$name.*.pyx
do
# echo "Combobulating $part..."
echo "###############################################################################" >> "$name.pyx"
echo "# Combobulated from file $part" >> "$name.pyx"
echo "###############################################################################\n" >> "$name.pyx"
cat "$part" >> "$name.pyx"
echo >> "$name.pyx"
done
}
CFLAGS=(-Wall -pedantic -std=c99 -fPIC)
LFLAGS=(-shared)
combobulate core
ln -s src/interface/* .
echo "- translating from Python to C"
cython -3 cython_types.pyx -o cython_types.c || die "translating"
# call Cython
translate core
echo "- compiling and linking"
gcc $CFLAGS -I/usr/include/python3.3 -pthread -c cython_types.c || die "compilation"
gcc $LFLAGS -L/usr/lib -lpython3.3 cython_types.o -o cython_types.so || die "linking"
rm -f cython_types.{c,o}
echo -n "Compiling and linking: core"
gcc $CFLAGS -I/usr/include/python3.3 -pthread -c core.c || die "compilation"
gcc $LFLAGS -L/usr/lib -lpython3.3 core.o -o core.so || die "linking"
rm -f core.{c,o}
echo "."
# remove temporary sources
rm -f *.pyx *.pxd
echo "- done"