|
10 | 10 |
|
11 | 11 | ffibuilder = FFI() |
12 | 12 |
|
13 | | -include_dirs = [os.path.join(sys.prefix, "include")] |
14 | | -library_dirs = [os.path.join(sys.prefix, "lib")] |
| 13 | +# GraphBLAS_ROOT env var can point to the root directory of GraphBLAS to link against. |
| 14 | +# Expected subdirectories: include/ (contains GraphBLAS.h), lib/, and bin/ (on Windows only) |
| 15 | +# Otherwise fallback to default system folders. |
| 16 | +graphblas_root = os.environ.get("GraphBLAS_ROOT", None) |
| 17 | +if not graphblas_root: |
| 18 | + # Windows wheels.yml configures suitesparse.sh to install GraphBLAS to "C:\\GraphBLAS". |
| 19 | + graphblas_root = "C:\\GraphBLAS" if is_win else sys.prefix |
| 20 | + |
| 21 | +include_dirs = [os.path.join(graphblas_root, "include")] |
| 22 | +library_dirs = [os.path.join(graphblas_root, "lib")] |
15 | 23 | if is_win: |
16 | 24 | include_dirs.append(os.path.join(sys.prefix, "Library", "include")) |
17 | 25 | library_dirs.append(os.path.join(sys.prefix, "Library", "lib")) |
18 | 26 |
|
19 | | - # wheels.yml configures suitesparse.sh to install GraphBLAS here. |
20 | | - prefix = "C:\\GraphBLAS" |
21 | | - include_dirs.append(os.path.join(prefix, "include")) |
22 | | - library_dirs.append(os.path.join(prefix, "lib")) |
23 | | - library_dirs.append(os.path.join(prefix, "bin")) |
| 27 | + include_dirs.append(os.path.join(graphblas_root, "include")) |
| 28 | + library_dirs.append(os.path.join(graphblas_root, "lib")) |
| 29 | + library_dirs.append(os.path.join(graphblas_root, "bin")) |
24 | 30 |
|
25 | 31 | ffibuilder.set_source( |
26 | 32 | "suitesparse_graphblas._graphblas", |
|
0 commit comments