/
setup.py
36 lines (27 loc) · 875 Bytes
/
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
import os
import sys
from setuptools import setup
DEBUG_BUILD = os.environ.get("SOURMASH_DEBUG") == "1"
def build_native(spec):
cmd = ["cargo", "build",
"--manifest-path", "src/core/Cargo.toml",
# "--features", "parallel",
"--lib"]
target = "debug"
if not DEBUG_BUILD:
cmd.append("--release")
target = "release"
build = spec.add_external_build(cmd=cmd, path=".")
rtld_flags = ["NOW"]
if sys.platform == "darwin":
rtld_flags.append("NODELETE")
spec.add_cffi_module(
module_path="sourmash._lowlevel",
dylib=lambda: build.find_dylib("sourmash", in_path="target/%s" % target),
header_filename=lambda: build.find_header("sourmash.h", in_path="include"),
rtld_flags=rtld_flags,
)
setup(
milksnake_tasks=[build_native],
package_dir={"": "src"},
)