-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
53 lines (40 loc) · 1.12 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
import setuptools
import sys
import platform
# NOTE: If accelerated.cpp does not exist:
# cython -3 --fast-fail -v --cplus tinybrain/accelerated.pyx
class NumpyImport:
def __repr__(self):
import numpy as np
return np.get_include()
__fspath__ = __repr__
extra_compile_args = []
if sys.platform == 'win32':
extra_compile_args += [
'/std:c++11', '/O2'
]
if platform.machine() == "x86_64":
extra_compile_args += [ "/arch:SSE3" ]
else:
extra_compile_args += [
'-std=c++11', '-O3' # '-DCYTHON_TRACE=1'
]
if platform.machine() == "x86_64":
extra_compile_args += [ '-msse3' ]
if sys.platform == 'darwin':
extra_compile_args += [ '-stdlib=libc++', '-mmacosx-version-min=10.9' ]
setuptools.setup(
setup_requires=['pbr', 'numpy','cython'],
install_requires=['numpy'],
python_requires=">=3.8",
ext_modules=[
setuptools.Extension(
'tinybrain.accelerated',
sources=[ 'tinybrain/accelerated.pyx' ],
language='c++',
include_dirs=[ str(NumpyImport()) ],
extra_compile_args=extra_compile_args,
)
],
long_description_content_type='text/markdown',
pbr=True)