forked from ashvardanian/SimSIMD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
84 lines (70 loc) · 2.4 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
import os
import sys
from os.path import dirname
from setuptools import setup, Extension
import numpy
__version__ = open("VERSION", "r").read().strip()
__lib_name__ = "simsimd"
compile_args = []
link_args = []
macros_args = []
if sys.platform == "linux":
compile_args.append("-std=c11")
compile_args.append("-O3")
compile_args.append("-ffast-math")
compile_args.append("-fdiagnostics-color=always")
# Disable warnings
compile_args.append("-w")
# Enable OpenMP for Linux
compile_args.append("-fopenmp")
link_args.append("-lgomp")
# Add vectorized `logf` implementation from the `glibc`
link_args.append("-lm")
if sys.platform == "darwin":
compile_args.append("-std=c11")
compile_args.append("-O3")
compile_args.append("-ffast-math")
# Disable warnings
compile_args.append("-w")
if sys.platform == "win32":
compile_args.append("/std:c11")
compile_args.append("/O2")
compile_args.append("/fp:fast")
# Dealing with MinGW linking errors
# https://cibuildwheel.readthedocs.io/en/stable/faq/#windows-importerror-dll-load-failed-the-specific-module-could-not-be-found
compile_args.append("/d2FH4-")
ext_modules = [
Extension(
"simsimd",
sources=["python/lib.c"],
include_dirs=["include", numpy.get_include()],
extra_compile_args=compile_args,
extra_link_args=link_args,
define_macros=macros_args,
),
]
this_directory = os.path.abspath(dirname(__file__))
with open(os.path.join(this_directory, "README.md"), "r", encoding="utf8") as f:
long_description = f.read()
setup(
name=__lib_name__,
version=__version__,
author="Ash Vardanian",
author_email="[email protected]",
url="https://github.com/ashvardanian/simsimd",
description="Fastest SIMD-Accelerated Vector Similarity Functions for x86 and Arm",
long_description=long_description,
long_description_content_type="text/markdown",
license="Apache-2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: C",
"Programming Language :: Python :: Implementation :: CPython",
],
ext_modules=ext_modules,
zip_safe=False,
)