-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
89 lines (78 loc) · 2.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
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
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
from setuptools import setup, Extension
import os
if 'FORCE_CYTHON' in os.environ:
USE_CYTHON = True
elif 'DISABLE_CYTHON' in os.environ:
USE_CYTHON = False
else:
USE_CYTHON = 'auto'
setup_requires = ['nose>=1.0']
if USE_CYTHON:
try:
from Cython.Distutils import build_ext
except ImportError:
if USE_CYTHON == 'auto':
USE_CYTHON = False
else:
raise
cmdclass = {}
if USE_CYTHON:
source = 'pyx'
cmdclass.update({'build_ext': build_ext})
setup_requires.append('Cython')
else:
source = 'cpp'
with open("README.md", "r") as fh:
long_description = fh.read()
strategies = []
for s in ['TS', 'TSA', 'GUDP', 'LUDP']:
strategies.extend([
'-DPJON_INCLUDE_{}'.format(s),
'-D{}_RESPONSE_TIME_OUT=100000'.format(s)
]
)
setup(
name='pjon_cython',
version='12.0.0',
packages=['pjon_cython'],
url='https://github.com/xlfe/PJON-cython',
license='Apache 2.0',
author='xlfe',
description='Call the PJON C++ library directly from Python',
long_description=long_description,
long_description_content_type="text/markdown",
setup_requires=setup_requires,
test_suite = 'nose.collector',
classifiers = [
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
cmdclass=cmdclass,
ext_modules=[
Extension(
"pjon_cython._pjon_cython",
sources=["pjon_cython/_pjon_cython.{}".format(source)],
language="c++",
extra_compile_args=strategies + [
'-std=c++11',
'-DPJON_INCLUDE_ANY',
'-DPJON_INCLUDE_PACKET_ID=true',
'-DPJON_INCLUDE_ASYNC_ACK=true',
'-DPJON_MAX_PACKETS=100',
'-DPJON_PACKET_MAX_LENGTH=1536',
'-DLINUX',
'-Wno-unneeded-internal-declaration',
'-Wno-logical-op-parentheses',
'-Wno-unused-variable'],
include_dirs=['PJON/src'],
compiler_directives={
'binding':True,
'embedsignature': True
}
)
]
)