Skip to content

Commit a160d29

Browse files
committed
Get PyPIC to compile also on systems that are not exclusively Ubuntu - such as e.g. OpenSUSE...
1 parent 58c1589 commit a160d29

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

setup.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1-
from distutils.core import setup, Extension
1+
import numpy as np
2+
3+
from setuptools import setup, Extension
4+
5+
from Cython.Distutils import build_ext
26
from Cython.Build import cythonize
37

4-
setup(ext_modules = cythonize(Extension(
5-
"CyFPPS", # the extesion name
6-
sources=['FPPS/CyFPPS.pyx', 'FPPS/FPPSWrapper.cc',
7-
'FPPS/ChangeCoord.cc', 'FPPS/ElectricFieldSolver.cc', 'FPPS/Mesh.cc',
8-
'FPPS/ChangeCoord_Frac.cc', 'FPPS/FastPolarPoissonSolver.cc', 'FPPS/NonLinearMesh.cc',
9-
'FPPS/ChangeCoord_Tanh.cc', 'FPPS/PolarBeamRepresentation.cc',
10-
'FPPS/ChargeDistribution.cc', 'FPPS/FunctionsFPPS.cc'], # the Cython source and additional C++ source files generate and compile C++ code
11-
language="c++", libraries=[ 'fftw3']
12-
)))
8+
9+
cy_ext_options = {"compiler_directives": {"profile": True}, "annotate": True}
10+
cy_ext = [
11+
Extension(
12+
"CyFPPS",
13+
sources=[ # the Cython source and additional C++ source files generate and compile C++ code
14+
'FPPS/CyFPPS.pyx', 'FPPS/FPPSWrapper.cc',
15+
'FPPS/ChangeCoord.cc', 'FPPS/ElectricFieldSolver.cc', 'FPPS/Mesh.cc',
16+
'FPPS/ChangeCoord_Frac.cc', 'FPPS/FastPolarPoissonSolver.cc', 'FPPS/NonLinearMesh.cc',
17+
'FPPS/ChangeCoord_Tanh.cc', 'FPPS/PolarBeamRepresentation.cc',
18+
'FPPS/ChargeDistribution.cc', 'FPPS/FunctionsFPPS.cc'],
19+
language="c++", include_dirs=[np.get_include()], libraries=['fftw3', 'm'])
20+
]
21+
22+
23+
setup(
24+
name='PyPIC',
25+
description='Collection of Python Particle-In-Cell solvers.',
26+
url='http://github.com/PyCOMPLETE/PyPIC',
27+
packages=['PyPIC'],
28+
cmdclass={'build_ext': build_ext},
29+
ext_modules=cythonize(cy_ext, **cy_ext_options),
30+
install_requires=[
31+
'numpy',
32+
'cython'
33+
]
34+
)

0 commit comments

Comments
 (0)