-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
33 lines (28 loc) · 1.24 KB
/
Copy pathsetup.py
File metadata and controls
33 lines (28 loc) · 1.24 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
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from Cython.Build import cythonize
import numpy as np
class my_build_ext(build_ext):
def build_extensions(self):
if self.compiler.compiler_type == "unix":
for e in self.extensions:
e.extra_compile_args = ["-std=c++20",
"-march=native",
"-O2"]
elif self.compiler.compiler_type == "msvc":
for e in self.extensions:
e.extra_compile_args = ["/std:c++20",
"/arch:SSE", "/arch:SSE2", "/arch:AVX2",
"/source-charset:utf-8",
"-O2"]
build_ext.build_extensions(self)
ext = Extension("pyrev.pyrev",
sources=["pyrev/pyrev.pyx", "pyrev/cpp/config.cpp", "pyrev/cpp/flip.cpp", "pyrev/cpp/mobility.cpp"],
include_dirs=["pyrev/cpp", "pyrev/cpp/utils", np.get_include()], language="c++")
setup(
name="pyrev",
ext_modules=cythonize([ext]),
cmdclass={"build_ext": my_build_ext},
packages=["pyrev"],
package_data={"pyrev": ["py.typed", "*.pyi"]}
)