forked from CHLNDDEV/oceanmesh
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
53 lines (45 loc) · 1.3 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
import sys
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup # , find_packages
import versioneer
sys.path.append(os.path.dirname(__file__))
# https://github.com/pybind/python_example/
is_called = [
"_HamiltonJacobi",
"_delaunay_class",
"_fast_geometry",
]
files = [
"oceanmesh/cpp/HamiltonJacobi.cpp",
"oceanmesh/cpp/delaunay_class.cpp",
"oceanmesh/cpp/fast_geometry.cpp",
]
if os.name == "nt":
home = os.environ["USERPROFILE"].replace("\\", "/")
vcpkg = f"{home}/OceanMesh/vcpkg/installed/x64-windows"
ext_modules = [
Pybind11Extension(
loc,
[fi],
include_dirs=[f"{vcpkg}/include"],
extra_link_args=[f"/LIBPATH:{vcpkg}/lib"],
libraries=["gmp", "mpfr"],
)
for fi, loc in zip(files, is_called)
]
else:
# no CGAL libraries necessary from CGAL 5.0 onwards
ext_modules = [
Pybind11Extension(loc, [fi], libraries=["gmp", "mpfr"])
for fi, loc in zip(files, is_called)
]
cmdclass = versioneer.get_cmdclass()
cmdclass.update({"build_ext": build_ext})
if __name__ == "__main__":
setup(
cmdclass=cmdclass,
version=versioneer.get_version(),
ext_modules=ext_modules,
zip_safe=False,
)