forked from landlab/landlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
31 lines (25 loc) · 798 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env python
import os
import pathlib
import numpy
from Cython.Build import cythonize
from setuptools import Extension
from setuptools import setup
def find_extensions(path="."):
extensions = pathlib.Path(path).rglob("*.pyx")
return [
Extension(
str(ext.with_suffix("")).replace(os.path.sep, "."),
[str(ext)],
extra_compile_args=["-fopenmp"] if "WITH_OPENMP" in os.environ else [],
extra_link_args=["-fopenmp"] if "WITH_OPENMP" in os.environ else [],
)
for ext in extensions
]
setup(
include_dirs=[numpy.get_include()],
ext_modules=cythonize(
find_extensions("landlab") + find_extensions("tests"),
compiler_directives={"embedsignature": True, "language_level": 3},
),
)