Skip to content

Commit a0f8911

Browse files
committed
compiler, uv for windows
1 parent 7a56b2b commit a0f8911

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ requires-python = ">=3.11"
1111
dependencies = ["numpy>=1.20"]
1212

1313
[tool.cibuildwheel]
14-
build-frontend = "build[uv]"
14+
build-frontend = "build"
1515
skip = "*-musllinux*"
1616
test-skip = "*"
1717
environment = { EASYSBA_LAPACK_LIBS = "openblas" }

setup.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def _parse_csv_env(name, default_value):
1111
return [item.strip() for item in raw.split(",") if item.strip()]
1212

1313

14+
def _parse_path_env(name):
15+
raw = os.environ.get(name, "")
16+
if not raw:
17+
return []
18+
normalized = raw.replace(",", os.pathsep)
19+
return [item.strip() for item in normalized.split(os.pathsep) if item.strip()]
20+
21+
1422
sources = [
1523
"easysba/_easysba.cpp",
1624
"src/sba_chkjac.c",
@@ -22,6 +30,26 @@ def _parse_csv_env(name, default_value):
2230

2331
libraries = _parse_csv_env("EASYSBA_LAPACK_LIBS", "lapack,blas")
2432

33+
include_dirs = [pybind11.get_include(), "src"]
34+
library_dirs = []
35+
extra_link_args = []
36+
37+
include_dirs.extend(_parse_path_env("EASYSBA_INCLUDE_DIRS"))
38+
library_dirs.extend(_parse_path_env("EASYSBA_LIBRARY_DIRS"))
39+
40+
if sys.platform == "darwin" and not library_dirs:
41+
for prefix in ("/opt/homebrew/opt/openblas", "/usr/local/opt/openblas"):
42+
inc = os.path.join(prefix, "include")
43+
lib = os.path.join(prefix, "lib")
44+
if os.path.isdir(lib):
45+
if os.path.isdir(inc):
46+
include_dirs.append(inc)
47+
library_dirs.append(lib)
48+
49+
if sys.platform == "darwin":
50+
for libdir in library_dirs:
51+
extra_link_args.append(f"-Wl,-rpath,{libdir}")
52+
2553
extra_compile_args = []
2654
if sys.platform == "win32":
2755
extra_compile_args.extend(["/O2"])
@@ -34,10 +62,12 @@ def _parse_csv_env(name, default_value):
3462
Extension(
3563
"easysba._easysba",
3664
sources=sources,
37-
include_dirs=[pybind11.get_include(), "src"],
65+
include_dirs=include_dirs,
3866
language="c++",
3967
libraries=libraries,
68+
library_dirs=library_dirs,
4069
extra_compile_args=extra_compile_args,
70+
extra_link_args=extra_link_args,
4171
)
4272
]
4373

0 commit comments

Comments
 (0)