Updated Cython compilation and version

This commit is contained in:
Kenneth Jao 2021-12-02 22:41:28 -05:00
parent 85d5486141
commit 9e25496f4d
2 changed files with 41 additions and 23 deletions

View File

@ -1,6 +1,6 @@
[metadata]
name = squish
version = 0.1.4
version = 0.1.5
author = Kenneth Jao
author_email = ksjdragon@gmail.com
description = squish is Python program which perform simulations for the flow of 'soft' or 'compressible' objects under some energy in a periodic domain.

View File

@ -2,30 +2,48 @@ from setuptools import Extension, setup
import numpy
try:
from Cython.Build import cythonize
USE_CYTHON = True
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
USE_CYTHON = False
if USE_CYTHON:
ext_modules = cythonize([
Extension(
"_squish",
["squish/_squish/_squish.pyx"],
extra_compile_args=['-fopenmp'],
extra_link_args=['-fopenmp']
)
],
compiler_directives={
'language_level': 3, 'boundscheck' : False, 'wraparound': False, 'cdivision' : True
})
ext_modules = cythonize(
[
Extension(
"squish.core",
["squish/core.pyx"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
),
Extension(
"squish.voronoi",
["squish/voronoi.pyx"],
extra_compile_args=["-fopenmp"],
extra_link_args=["-fopenmp"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
),
Extension(
"squish.energy",
["squish/energy.pyx"],
extra_compile_args=["-fopenmp"],
extra_link_args=["-fopenmp"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
),
],
annotate=False,
compiler_directives={
"language_level": 3,
"boundscheck": False,
"wraparound": False,
"cdivision": True,
},
)
else:
ext_modules = [
Extension('squish._squish', ["squish/_squish/_squish.c"])
]
ext_modules = [
Extension("squish.core", ["squish/core.c"]),
Extension("squish.voronoi", ["squish/voronoi.c"]),
Extension("squish.energy", ["squish/energy.c"]),
]
#annotate='fullc'
setup(
ext_modules = ext_modules,
include_dirs = [numpy.get_include()]
)
setup(ext_modules=ext_modules, include_dirs=[numpy.get_include()])