-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·51 lines (40 loc) · 1.74 KB
/
setup.py
File metadata and controls
executable file
·51 lines (40 loc) · 1.74 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
#!/usr/bin/env python
# Copyright 2008-2024 Michael M. Hoffman <michael.hoffman@utoronto.ca>
from setuptools import Extension, setup
from pathlib import Path
AWFMINDEX_BUILD_DIR = (Path("AvxWindowFmIndex") / "build").resolve()
generate_index_source_files = ["src/newmap-generate-index.c"]
count_kmers_source_files = ["src/newmap-count.c"]
dynamic_libraries = ["gomp"] # for OpenMP
# Libraries exist in git submodules
library_dirnames = list(map(str, [AWFMINDEX_BUILD_DIR]))
include_dirnames = list(map(str, [AWFMINDEX_BUILD_DIR]))
static_libraries = list(map(str,
[AWFMINDEX_BUILD_DIR / "libawfmindex_static.a",
AWFMINDEX_BUILD_DIR / "libfastavector_static.a",
AWFMINDEX_BUILD_DIR / "libdivsufsort64.a"]))
# Build against the stable ABI to support 3.9 onwards
c_define_macros = [("Py_LIMITED_API", "0x03090000")]
generate_index_module = Extension(
'_c_newmap_generate_index', # needs to match C file PyInit definition
sources=generate_index_source_files,
include_dirs=include_dirnames,
library_dirs=library_dirnames,
libraries=dynamic_libraries,
extra_objects=static_libraries,
define_macros=c_define_macros,
py_limited_api=True)
count_kmers_module = Extension(
'_c_newmap_count_kmers', # needs to match C file PyInit definition
sources=count_kmers_source_files,
include_dirs=include_dirnames,
library_dirs=library_dirnames,
libraries=dynamic_libraries,
extra_objects=static_libraries,
define_macros=c_define_macros,
py_limited_api=True)
if __name__ == "__main__":
# place extension in the base umap package
setup(ext_package="newmap",
ext_modules=[generate_index_module,
count_kmers_module])