-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
52 lines (40 loc) · 1.08 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
from setuptools import setup, find_packages, Extension
import sys
import os
mytest_version = "0.1.0"
# Build and distribute without cython and .pyx files:
# cf. https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html
try:
from Cython.Build import cythonize
use_cython = True
except ImportError:
use_cython = False
# Sources
Include_dirs = [ "./mytest" ]
extensionParams = {
"language":"c++",
"include_dirs":Include_dirs,
}
extension_names = [
'my_cython_class',
]
use_cython_ext = '.pyx' if use_cython else '.cpp'
extensions = [
Extension('mytest.'+f,
sources = [ 'mytest/'+f+use_cython_ext ],
**extensionParams)
for f in extension_names
]
packages = find_packages(".")
if use_cython:
from Cython.Build import cythonize
extensions = cythonize(extensions,
# language_level=3,
nthreads=8)
## Finally, do the setup
setup(
name = "mytest",
version = mytest_version,
packages = packages,
ext_modules = extensions,
)