-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
50 lines (44 loc) · 1.26 KB
/
setup.py
File metadata and controls
50 lines (44 loc) · 1.26 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
from Cython.Build import cythonize
from setuptools import setup, Extension
from subprocess import getstatusoutput
def pkgconfig(name):
"""
Run pkg-config for the given package, and add the required flags to our
list of build arguments.
"""
status, output = getstatusoutput(f"pkg-config --libs --cflags {name}")
if status:
sys.exit(f"couldn't find package '{name}'")
for token in output.split():
opt, val = token[:2], token[2:]
if opt == "-I":
include_dirs.append(val)
elif opt == "-l":
libraries.append(val)
elif opt == "-L":
library_dirs.append(val)
include_dirs = []
libraries = []
library_dirs = []
pkgconfig("smf")
setup(
ext_modules=cythonize(
[
Extension(
name="smf",
sources=[
"src/smf.pyx",
],
include_dirs=include_dirs,
libraries=libraries,
library_dirs=library_dirs,
extra_compile_args=[
"-fno-strict-aliasing",
"-Werror-implicit-function-declaration",
"-Wfatal-errors",
],
)
],
language_level=3,
),
)