-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
50 lines (41 loc) · 1.54 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
import os
import sys
import shutil
from distutils.command.build_ext import build_ext
from setuptools import Extension, setup
# from distutils.sysconfig import customize_compiler
PACKAGE_NAME='bfloat16'
import numpy as np
if 'clean' in sys.argv:
curdir = os.path.dirname(os.path.realpath(__file__))
for filepath in ['build', 'dist', f'{PACKAGE_NAME}.egg-info', 'MANIFEST']:
if os.path.exists(filepath):
if os.path.isfile(filepath):
os.remove(filepath)
else:
shutil.rmtree(filepath)
# class my_build_ext(build_ext):
# def build_extensions(self):
# customize_compiler(self.compiler)
# try:
# self.compiler.compiler_so.remove("-Wstrict-prototypes")
# except (AttributeError, ValueError):
# pass
# build_ext.build_extensions(self)
module1 = Extension(PACKAGE_NAME,
sources=['bfloat16.cc'],
include_dirs=[np.get_include(), "eigen/Eigen"],
extra_compile_args=['-std=c++11'])
setup(name=PACKAGE_NAME,
version='1.4.0',
description='Numpy bfloat16 package',
requires=["numpy"],
py_modules=[],
author='GreenWaves Technologies',
author_email='[email protected]',
url='https://github.com/GreenWaves-Technologies/bfloat16',
download_url = 'https://github.com/GreenWaves-Technologies/bfloat16/archive/refs/tags/1.0.tar.gz',
install_requires=[],
ext_modules=[module1])
# ,
# cmdclass={'build_ext': my_build_ext})