diff --git a/Cython/setup.py b/Cython/setup.py deleted file mode 100644 index 0b852d4..0000000 --- a/Cython/setup.py +++ /dev/null @@ -1,14 +0,0 @@ - -from distutils.core import setup, Extension -from Cython.Build import cythonize - -exts = Extension( - "openGJKpy", - sources = ["openGJK_cython.pyx", "openGJK.c"], - # extra_compile_args = ['-fopenmp'], - # extra_link_args = ['-fopenmp'] - ) - -setup(ext_modules = cythonize( [exts] )) - - diff --git a/openGJK_cython.c b/openGJK_cython.c new file mode 100644 index 0000000..06f2230 --- /dev/null +++ b/openGJK_cython.c @@ -0,0 +1 @@ +#error Do not use this file, it is the result of a failed Cython compilation. diff --git a/Cython/openGJK_cython.pyx b/openGJK_cython.pyx similarity index 84% rename from Cython/openGJK_cython.pyx rename to openGJK_cython.pyx index b9b12e2..3727643 100644 --- a/Cython/openGJK_cython.pyx +++ b/openGJK_cython.pyx @@ -1,25 +1,13 @@ -#cython: language_level=3, boundscheck=False +# distutils: sources = src/openGJK.c +# distutils: include_dirs = include/openGJK +# cython: language_level=3, boundscheck=False + +cimport openGJK_cython import numpy as np from libc.stdlib cimport free, malloc from cpython.mem cimport PyMem_Malloc, PyMem_Free - -# Declare C function and data types -cdef extern from "openGJK.h": - struct bd: - int numpoints - double s[3] - double ** coord - - struct simplex: - int nvrtx - double vrtx[4][3] - int wids[4] - double lambdas[4] - - double gjk(bd bd1, bd bd2, simplex *s) - # Create Python function def pygjk(bod1, bod2): diff --git a/Cython/pygjk_trial.py b/pygjk_trial.py similarity index 74% rename from Cython/pygjk_trial.py rename to pygjk_trial.py index ccca688..4a7ebb0 100644 --- a/Cython/pygjk_trial.py +++ b/pygjk_trial.py @@ -1,5 +1,5 @@ import numpy as np -import openGJKpy as opengjk +import openGJK_cython as opengjk a = np.array([[1.,1.,1.],[1.,1.,1.]]) b = np.array([[11.,1.,1.],[1.,1.,1.]]) d = opengjk.pygjk(a,b) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..11be503 --- /dev/null +++ b/setup.py @@ -0,0 +1,14 @@ +from setuptools import Extension, setup +from Cython.Build import cythonize + +exts = Extension( + "openGJK_cython", + sources = ["openGJK_cython.pyx"], + extra_compile_args=['-Iinclude/','-fopenmp'], + extra_link_args=['-fopenmp'], +) + +setup( + name='openGJK-cython-version', + ext_modules = cythonize( [exts] ) +) \ No newline at end of file