|
1 | | -# setup.py |
2 | 1 | import sys |
3 | 2 | from setuptools import setup, Extension |
4 | 3 | from setuptools.command.build_ext import build_ext |
5 | 4 | from Cython.Build import cythonize |
6 | 5 |
|
7 | | - |
8 | 6 | class CustomBuildExt(build_ext): |
9 | 7 | def finalize_options(self): |
10 | 8 | super().finalize_options() |
11 | 9 | import numpy as np |
12 | 10 | self.include_dirs.append(np.get_include()) |
13 | 11 |
|
14 | | - |
15 | 12 | if sys.platform == "win32": |
16 | 13 | c_args = ["/O2"] |
17 | 14 | else: |
18 | 15 | c_args = ["-O3"] |
19 | 16 |
|
20 | | - |
21 | | -ext_modules = [ |
| 17 | +pyx_extensions = [ |
22 | 18 | Extension("classix.aggregate_ed_c", ["classix/aggregate_ed_c.pyx"], extra_compile_args=c_args), |
23 | 19 | Extension("classix.aggregate_ed_cm", ["classix/aggregate_ed_cm.pyx"], extra_compile_args=c_args), |
24 | 20 | Extension("classix.merge_ed_cm", ["classix/merge_ed_cm.pyx"], extra_compile_args=c_args), |
25 | 21 | Extension("classix.merge_ed_cm_win", ["classix/merge_ed_cm_win.pyx"], extra_compile_args=c_args), |
26 | | - |
27 | 22 | Extension("classix.aggregate_md_cm", ["classix/aggregate_md_cm.pyx"], extra_compile_args=c_args), |
28 | 23 | Extension("classix.merge_md_cm", ["classix/merge_md_cm.pyx"], extra_compile_args=c_args), |
29 | | - |
30 | 24 | Extension( |
31 | 25 | "classix.aggregate_td_cm", |
32 | 26 | ["classix/aggregate_td_cm.pyx"], |
33 | 27 | language="c++", |
34 | 28 | extra_compile_args=c_args, |
35 | 29 | ), |
36 | | - |
37 | 30 | Extension("classix.merge_td_cm", ["classix/merge_td_cm.pyx"], extra_compile_args=c_args), |
| 31 | +] |
38 | 32 |
|
| 33 | +c_extensions = [ |
39 | 34 | Extension("spmv", ["classix/spmv.c"], extra_compile_args=c_args), |
40 | 35 | ] |
41 | 36 |
|
42 | | - |
43 | 37 | setup( |
44 | 38 | ext_modules=cythonize( |
45 | | - ext_modules, |
| 39 | + pyx_extensions, |
46 | 40 | compiler_directives={"language_level": "3"}, |
47 | 41 | annotate=False, |
48 | | - ), |
| 42 | + ) + c_extensions, |
49 | 43 | cmdclass={"build_ext": CustomBuildExt}, |
50 | 44 | ) |
51 | | - |
0 commit comments