Skip to content

Commit 09dd0d9

Browse files
committed
further building updates
1 parent 6f75a72 commit 09dd0d9

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ test-requires = [
203203
manylinux-x86_64-image = "manylinux_2_28"
204204
before-all = "dnf install -y ocl-icd-devel opencl-headers"
205205
before-build = "python -m pip install --upgrade pip && python -m pip install 'scipy==1.15.*'"
206-
environment = { PIP_ONLY_BINARY=":all:", CFLAGS="-I/usr/include", LDFLAGS="-L/usr/lib64", CL_INC_DIR="/usr/include", CL_LIB_DIR="/usr/lib64", CL_LIBNAME="OpenCL" }
207-
environment-pass = ["CL_INC_DIR", "CL_LIB_DIR", "CL_LIBNAME", "CFLAGS", "LDFLAGS"]
206+
environment = { CFLAGS="-I/usr/include", LDFLAGS="-L/usr/lib64", CL_INC_DIR="/usr/include", CL_LIB_DIR="/usr/lib64", CL_LIBNAME="OpenCL" }
208207
# repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
209208

210209
[tool.cibuildwheel.macos]

setup.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,24 @@ def search_for_c_files_referrenced_in_pyx_text(text: str):
185185
# EXTRA_LING_ARGS = ["-Xpreprocessor", "-fopenmp"]
186186

187187
elif sys.platform.startswith("linux"):
188-
INCLUDE_DIRS += ["/usr/local/include", "/usr/include"]
189-
LIBRARY_DIRS += ["/usr/local/lib", "/usr/lib"]
190-
EXTRA_COMPILE_ARGS += ["-O3", "-march=native", "-fopenmp"]
188+
# Check for OpenCL environment variables (used by cibuildwheel)
189+
cl_inc_dir = os.environ.get("CL_INC_DIR", "/usr/include")
190+
cl_lib_dir = os.environ.get("CL_LIB_DIR", "/usr/lib64")
191+
192+
INCLUDE_DIRS += ["/usr/local/include", "/usr/include", cl_inc_dir]
193+
LIBRARY_DIRS += ["/usr/local/lib", "/usr/lib", "/usr/lib64", cl_lib_dir]
194+
195+
# Don't use -march=native in manylinux builds (breaks portability)
196+
# Detect if we're in a cibuildwheel/manylinux environment
197+
in_manylinux = os.environ.get(
198+
"AUDITWHEEL_PLAT"
199+
) is not None or "manylinux" in os.environ.get("CIBUILDWHEEL", "")
200+
201+
if in_manylinux:
202+
EXTRA_COMPILE_ARGS += ["-O3", "-fopenmp"]
203+
else:
204+
EXTRA_COMPILE_ARGS += ["-O3", "-march=native", "-fopenmp"]
205+
191206
EXTRA_LING_ARGS += ["-fopenmp"]
192207

193208
try:

0 commit comments

Comments
 (0)