forked from jf---/python-fcl
-
Notifications
You must be signed in to change notification settings - Fork 58
/
setup.py
78 lines (60 loc) · 1.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os
import sys
from Cython.Build import cythonize
from setuptools import Extension, setup
INSTALL_PREFIX_WIN = "deps\\install"
def is_nix_platform(platform):
for prefix in ["darwin", "linux", "bsd"]:
if prefix in sys.platform:
return True
return False
def get_include_dirs():
if is_nix_platform(sys.platform):
include_dirs = [
"/usr/include",
"/usr/local/include",
"/usr/include/eigen3",
"/usr/local/include/eigen3",
]
if "CPATH" in os.environ:
include_dirs += os.environ["CPATH"].split(":")
elif sys.platform == "win32":
include_dirs = [
f"{INSTALL_PREFIX_WIN}\\include",
f"{INSTALL_PREFIX_WIN}\\include\\eigen3",
]
else:
raise NotImplementedError(sys.platform)
# get the numpy include path from numpy
import numpy
include_dirs.append(numpy.get_include())
return include_dirs
def get_libraries_dir():
if is_nix_platform(sys.platform):
lib_dirs = ["/usr/lib", "/usr/local/lib"]
if "LD_LIBRARY_PATH" in os.environ:
lib_dirs += os.environ["LD_LIBRARY_PATH"].split(":")
return lib_dirs
if sys.platform == "win32":
return [f"{INSTALL_PREFIX_WIN}\\lib"]
raise NotImplementedError(sys.platform)
def get_libraries():
libraries = ["fcl", "octomap"]
if sys.platform == "win32":
libraries.extend(["octomath", "ccd", "vcruntime"])
return libraries
setup(
ext_modules=cythonize(
[
Extension(
"fcl.fcl",
["src/fcl/fcl.pyx"],
include_dirs=get_include_dirs(),
library_dirs=get_libraries_dir(),
libraries=get_libraries(),
language="c++",
extra_compile_args=["-std=c++11"],
)
],
)
)