-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
65 lines (58 loc) · 1.73 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
from pathlib import Path
# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup
_DIR = Path(__file__).parent
_FRONTEND_DIR = _DIR / "tensorflow" / "lite" / "experimental" / "microfrontend" / "lib"
_KISSFFT_DIR = _DIR / "kissfft"
_INCLUDE_DIR = _DIR
__version__ = "1.0.0"
sources = []
sources.extend(
_FRONTEND_DIR / f
for f in [
"kiss_fft_int16.cc",
"fft.cc",
"fft_util.cc",
"filterbank.c",
"filterbank_util.c",
"frontend.c",
"frontend_util.c",
"log_lut.c",
"log_scale.c",
"log_scale_util.c",
"noise_reduction.c",
"noise_reduction_util.c",
"pcan_gain_control.c",
"pcan_gain_control_util.c",
"window.c",
"window_util.c",
]
)
sources.append(_KISSFFT_DIR / "kiss_fft.c")
sources.append(_KISSFFT_DIR / "tools" / "kiss_fftr.c")
flags = ["-DFIXED_POINT=16"]
ext_modules = [
Pybind11Extension(
name="micro_features_cpp",
language="c++",
extra_compile_args=flags,
sources=sorted([str(p) for p in sources] + [str(_DIR / "python.cpp")]),
define_macros=[("VERSION_INFO", __version__)],
include_dirs=[str(_INCLUDE_DIR), str(_KISSFFT_DIR)],
),
]
setup(
name="pymicro_features",
version=__version__,
author="Michael Hansen",
author_email="[email protected]",
url="https://github.com/rhasspy/pymicro-features",
description="Speech features using TFLite Micro audio frontend",
long_description="",
packages=["pymicro_features"],
ext_modules=ext_modules,
zip_safe=False,
python_requires=">=3.7",
classifiers=["License :: OSI Approved :: MIT License"],
)