Skip to content

Commit

Permalink
linux and windows build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peekxc committed Dec 5, 2023
1 parent ab1660e commit 5a7caaa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ before-build = "bash {project}/tools/cibw_macos.sh"
environment = { CC="/usr/local/opt/llvm/bin/clang", CXX="/usr/local/opt/llvm/bin/clang++" }

[tool.cibuildwheel.windows]
# before-build = "sh tools/cibw_windows.sh"
before-build = "choco install rtools -y --no-progress --force --version=4.0.0.20220206 && set PATH=C:\\rtools40\\ucrt64\\bin\\;%PATH%"
environment = { PKG_CONFIG_PATH="C:/opt/64/lib/pkgconfig", CXX="g++", CC="gcc" }
before-build = "bash {project}/tools/cibw_windows.sh"
# before-build = "choco install rtools -y --no-progress --force --version=4.0.0.20220206 && set PATH=C:\\rtools40\\ucrt64\\bin\\;%PATH%"
environment = { PKG_CONFIG_PATH="C:/opt/64/lib/pkgconfig", CXX="g++", CC="gcc" }
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"

[tool.cibuildwheel.linux]
environment = { CC="clang", CXX="clang++" }
29 changes: 29 additions & 0 deletions tools/repair_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set -xe

WHEEL="$1"
DEST_DIR="$2"

# create a temporary directory in the destination folder and unpack the wheel into there
pushd $DEST_DIR
mkdir -p tmp
pushd tmp
wheel unpack $WHEEL
pushd primate*

# To avoid DLL hell, the file name of libopenblas that's being vendored with
# the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD
# containing extra data at the end of the binary, which frequently occurs when
# building with mingw.
# We therefore find each PYD in the directory structure and strip them.
for f in $(find ./primate* -name '*.pyd'); do strip $f; done


# now repack the wheel and overwrite the original
wheel pack .
mv -fv *.whl $WHEEL

cd $DEST_DIR
rm -rf tmp

# the libopenblas.dll is placed into this directory in the cibw_before_build script.
delvewheel repair -w $DEST_DIR $WHEEL

0 comments on commit 5a7caaa

Please sign in to comment.