Skip to content

Commit dd70141

Browse files
committed
Windows complex
See GraphBLAS#64
1 parent 28c3b04 commit dd70141

File tree

5 files changed

+80995
-13
lines changed

5 files changed

+80995
-13
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
push:
5-
branches: [ main ]
5+
# branches: [ main ]
66
pull_request:
77

88
jobs:

setup.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,45 @@
5353
extra_compile_args=["/d2FH4-", "/std:c11"] if sys.platform == "win32" else [],
5454
)
5555
for name in glob(f"suitesparse_graphblas/**/*{suffix}", recursive=True)
56+
if not name.endswith("_graphblas.c")
5657
]
58+
5759
if use_cython:
5860
ext_modules = cythonize(ext_modules, include_path=include_dirs)
5961

62+
if is_win:
63+
include_dirs = [os.path.join(sys.prefix, "include")]
64+
library_dirs = [os.path.join(sys.prefix, "lib")]
65+
66+
include_dirs.append(os.path.join(sys.prefix, "Library", "include"))
67+
library_dirs.append(os.path.join(sys.prefix, "Library", "lib"))
68+
69+
# suitesparse.sh installs GraphBLAS.h here
70+
include_dirs.append(os.path.join("C:\\", "Program Files (x86)", "include"))
71+
# graphblas.lib and graphblas.dll.a
72+
library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "lib"))
73+
# graphblas.dll
74+
library_dirs.append(os.path.join("C:\\", "Program Files (x86)", "bin"))
75+
76+
ext_modules.append(
77+
Extension(
78+
"suitesparse_graphblas._graphblas",
79+
["suitesparse_graphblas\\_graphblas.c"],
80+
include_dirs=include_dirs,
81+
library_dirs=library_dirs,
82+
libraries=["graphblas"],
83+
# /d2FH4- flag needed only for early Python 3.8 builds on Windows.
84+
# See https://cibuildwheel.readthedocs.io/en/stable/faq/
85+
# (Search for flag on page. Full link causes the linter to fail the tests.)
86+
#
87+
# The /std:c11 flag is because the MSVC default is C89.
88+
extra_compile_args=["/d2FH4-", "/std:c11"],
89+
)
90+
)
91+
print("ext_modules:")
92+
for e in ext_modules:
93+
print(f"{e.name}: {e.sources}")
94+
6095
with open("README.md") as f:
6196
long_description = f.read()
6297

@@ -76,7 +111,7 @@
76111
author_email="michel@graphegon.com,jim22k@gmail.com,erik.n.welch@gmail.com",
77112
url="https://github.com/GraphBLAS/python-suitesparse-graphblas",
78113
ext_modules=ext_modules,
79-
cffi_modules=["suitesparse_graphblas/build.py:ffibuilder"],
114+
cffi_modules=["suitesparse_graphblas/build.py:ffibuilder"] if not is_win else [],
80115
python_requires=">=3.8",
81116
install_requires=["cffi>=1.0.0", "numpy>=1.19"],
82117
setup_requires=["cffi>=1.0.0", "pytest-runner"],

0 commit comments

Comments
 (0)