File: setup.py

package info (click to toggle)
python-ewah-bool-utils 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 448 kB
  • sloc: cpp: 1,709; ansic: 926; python: 219; makefile: 16
file content (62 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download
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
import os
from distutils.ccompiler import get_default_compiler

import numpy as np
from Cython.Build import cythonize
from setuptools import Extension, setup

from setupext import check_for_openmp

if check_for_openmp():
    omp_args = ["-fopenmp"]
else:
    omp_args = None

cpp11_args = ["-std=c++11" if get_default_compiler() != "msvc" else "/std:c++11"]

if os.name == "nt":
    std_libs = []
else:
    std_libs = ["m"]

define_macros = [
    ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
    # keep in sync with runtime requirements (pyproject.toml)
    ("NPY_TARGET_VERSION", "NPY_1_19_API_VERSION"),
]

extensions = [
    Extension(
        "ewah_bool_utils.ewah_bool_wrap",
        ["ewah_bool_utils/ewah_bool_wrap.pyx"],
        define_macros=define_macros,
        include_dirs=["ewah_bool_utils", "ewah_bool_utils/cpp", np.get_include()],
        language="c++",
        extra_compile_args=cpp11_args,
    ),
    Extension(
        "ewah_bool_utils.morton_utils",
        ["ewah_bool_utils/morton_utils.pyx"],
        define_macros=define_macros,
        extra_compile_args=omp_args,
        extra_link_args=omp_args,
        libraries=std_libs,
        include_dirs=[np.get_include()],
    ),
    Extension(
        "ewah_bool_utils._testing",
        ["ewah_bool_utils/_testing.pyx"],
        include_dirs=["ewah_bool_utils", "ewah_bool_utils/cpp", np.get_include()],
        define_macros=define_macros,
        extra_compile_args=["-O3"],
        language="c++",
    ),
]


setup(
    ext_modules=cythonize(
        extensions,
        compiler_directives={"language_level": 3},
    ),
)