-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
from setuptools.command.build_ext import build_ext | ||
from setuptools import setup, Extension | ||
import numpy | ||
|
||
# Check if Cython is available | ||
try: | ||
from Cython.Build import cythonize | ||
except ImportError: | ||
def cythonize(module_list): | ||
return module_list | ||
|
||
# Define the extension module | ||
ext = Extension( | ||
'mamonca', | ||
sources=["mamonca/mc.pyx"], | ||
language="c++", | ||
include_dirs=[numpy.get_include()], | ||
extra_compile_args=['-std=c++11'], | ||
) | ||
|
||
|
@@ -23,12 +32,12 @@ | |
author_email='[email protected]', | ||
license='BSD', | ||
cmdclass={"build_ext": build_ext}, | ||
ext_modules=[ext], | ||
ext_modules=cythonize([ext]), | ||
options={'build': {'build_lib': 'mamonca'}}, | ||
setup_requires=[ | ||
# Setuptools 18.0 properly handles Cython extensions. | ||
'setuptools>=18.0', | ||
'cython', | ||
'numpy', | ||
], | ||
) | ||
|