-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
71 lines (63 loc) · 1.64 KB
/
setup.py
File metadata and controls
71 lines (63 loc) · 1.64 KB
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
import os
import setuptools
import sys
import platform
from pybind11.setup_helpers import Pybind11Extension, build_ext
CRC32C_DIR = os.path.join("third_party", "fastcrc")
extra_compile_args = []
if sys.platform == 'win32':
extra_compile_args += [
'/std:c++20', '/O2', '/arch:AVX2'
]
else:
extra_compile_args += [
'-std=c++2a', '-O3',
]
cibw_archs = os.environ.get("CIBW_ARCHS", "").lower()
archflags = os.environ.get("ARCHFLAGS", "").lower()
if archflags == "":
os.environ["ARCHFLAGS"] = f"-arch {platform.machine()}"
# Apple Silicon arm64 machines cross compile for x86_64,
# but we want to not include these flags for aarch64
if (
"x86_64" in cibw_archs
or "x86_64" in archflags
or platform.machine().lower() in ('x86_64', 'amd64')
):
extra_compile_args += [
'-msse4.2', '-mpclmul' # for x86 and cross compiling x86
]
elif platform.machine().lower() == 'aarch64':
extra_compile_args += [
"-march=armv8-a+crc+simd" # Enable NEON for aarch64
]
setuptools.setup(
setup_requires=['pbr','pybind11','numpy'],
cmdclass={"build_ext": build_ext},
extras_require={
"remote": [
"cloud-files",
],
"ccl": [
"connected-components-3d",
],
"meta": [
"pyarrow",
],
},
ext_modules=[
Pybind11Extension(
"fastcrackle",
["src/fastcrackle.cpp"],
include_dirs=[CRC32C_DIR],
extra_compile_args=extra_compile_args,
language="c++",
),
],
entry_points={
"console_scripts": [
"crackle=crackle_cli:main"
],
},
pbr=True
)