-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
57 lines (43 loc) · 1.38 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
import sys
from setuptools import setup, Extension
class get_pybind_include(object):
"""Helper class to determine the pybind11 include path
The purpose of this class is to postpone importing pybind11
until it is actually installed, so that the ``get_include()``
method can be invoked. """
def __init__(self, user=False):
self.user = user
def __str__(self):
import pybind11
return pybind11.get_include(self.user)
sources = [
'src/distance_from_polygon.cpp',
'src/grid_coding_range.cpp',
'src/pyextension/gridcodingrange_module.cpp',
]
compile_args = ["-std=c++14"]
link_args = []
debug_mode = False
if debug_mode:
compile_args += ["-O0", "-D NTA_ASSERTIONS_ON"]
else:
compile_args += ["-g0"]
if sys.platform == "darwin":
compile_args += ["-std=c++14", "-mmacosx-version-min=10.10"]
link_args += ["-stdlib=libc++", "-mmacosx-version-min=10.10"]
module = Extension(
'_gridcodingrange',
sources=sources,
extra_compile_args=compile_args,
extra_link_args=link_args,
include_dirs=['./src/',
'./src/external',
get_pybind_include(),
get_pybind_include(user=True)]
)
setup(name='gridcodingrange',
version='1.0',
description='This is a demo package',
packages=['gridcodingrange'],
setup_requires=["pybind11"],
ext_modules=[module])