over.core.types is now using reference cython acceleration
This commit is contained in:
parent
0df57ad386
commit
fd984be2f6
6 changed files with 165 additions and 109 deletions
61
m/build.sh
61
m/build.sh
|
@ -1,63 +1,4 @@
|
|||
#! /bin/zsh
|
||||
# encoding: utf-8
|
||||
|
||||
setopt extendedglob
|
||||
|
||||
function die() {
|
||||
echo "\n\n>>> Failed during ${1}, aborting."
|
||||
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/* .
|
||||
|
||||
# call Cython
|
||||
translate core
|
||||
|
||||
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 "- nothing to do"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue