Skip to content

Commit 998009b

Browse files
committed
First stab at auto-parsing GraphBLAS.h for cffi
Closes #5
1 parent 57077ce commit 998009b

File tree

8 files changed

+6921
-17285
lines changed

8 files changed

+6921
-17285
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@ dmypy.json
129129
.pyre/
130130

131131
# emacs
132-
*~
132+
*~
133+
134+
# Vim
135+
*.sw?

suitesparse/graphblas/build.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
from cffi import FFI
44

55
is_win = sys.platform.startswith("win")
6+
thisdir = os.path.dirname(__file__)
67

78
ffibuilder = FFI()
89

10+
with open(os.path.join(thisdir, "source.c")) as f:
11+
source = f.read()
12+
913
ffibuilder.set_source(
1014
"suitesparse.graphblas._graphblas",
11-
r"""#include "GraphBLAS.h" """,
15+
source,
1216
libraries=["graphblas"],
1317
include_dirs=[os.path.join(sys.prefix, "include")],
1418
)
1519

16-
thisdir = os.path.dirname(__file__)
17-
18-
header = "suitesparse_graphblas_4.0.3.h"
20+
header = "suitesparse_graphblas.h"
1921
if is_win:
20-
header = "suitesparse_graphblas_no_complex_4.0.3.h"
22+
header = "suitesparse_graphblas_no_complex.h"
2123
gb_cdef = open(os.path.join(thisdir, header))
2224

2325
ffibuilder.cdef(gb_cdef.read())

0 commit comments

Comments
 (0)