Initial commit (Cython implementation)
This commit is contained in:
commit
6f28ac0382
13 changed files with 1616 additions and 0 deletions
63
src-00_core/build.sh
Executable file
63
src-00_core/build.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#! /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
|
Loading…
Add table
Add a link
Reference in a new issue