diff --git a/python/cpp/pyproject.toml.jinja b/python/cpp/pyproject.toml.jinja index 47b64bc..7b1e451 100644 --- a/python/cpp/pyproject.toml.jinja +++ b/python/cpp/pyproject.toml.jinja @@ -110,7 +110,10 @@ repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} --exclud [tool.cibuildwheel.windows] archs = "AMD64" skip = "*win32 *arm64" - +{% if add_c_abi -%} +# The C ABI library ships inside the wheel; delvewheel must not look for it on PATH. +repair-wheel-command = "delvewheel repair --exclude lib{{ module }}.dll -w {dest_dir} {wheel}" +{% endif %} {% if add_pyodide -%} [tool.cibuildwheel.pyodide] test-command = "python -m pytest -vvv --pyargs {{ module }}.tests" diff --git a/python/cpp/{{module}}/tests/test_all.py.jinja b/python/cpp/{{module}}/tests/test_all.py.jinja index 97a7aad..536a0f5 100644 --- a/python/cpp/{{module}}/tests/test_all.py.jinja +++ b/python/cpp/{{module}}/tests/test_all.py.jinja @@ -65,9 +65,11 @@ def test_c_consumer_builds_against_the_installed_package(tmp_path): source.write_text(C_CONSUMER) executable = tmp_path / ("consumer.exe" if platform == "win32" else "consumer") env = dict(os.environ) + if platform == "win32": + # Windows has no rpath, so the program finds the DLL through PATH whichever compiler built it. + env["PATH"] = library_dir + os.pathsep + env["PATH"] if Path(compiler).stem.lower() == "cl": command = [compiler, "/nologo", f"/I{get_include()}", str(source), f"/Fe:{executable}", "/link", f"/LIBPATH:{library_dir}", f"{library}.lib"] - env["PATH"] = library_dir + os.pathsep + env["PATH"] else: command = [ compiler,