diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 89a35eac..03e01a68 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -34,23 +34,9 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: - CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* - CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*" - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_MANYLINUX_I686_IMAGE: manylinux2014 - CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh - CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx_x86_64.sh + # override setting in pyproject.toml to use msys2 instead of msys64 bash CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh - CIBW_BEFORE_BUILD_WINDOWS: msys2 -c bin/cibw_before_build_windows.sh - CIBW_BEFORE_BUILD: pip install numpy setuptools cython delvewheel - CIBW_ENVIRONMENT: > - C_INCLUDE_PATH=$(pwd)/.local/include/ - LIBRARY_PATH=$(pwd)/.local/lib/ - LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH - PYTHON_FLINT_MINGW64=true - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- - bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} - CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" + CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh - uses: actions/upload-artifact@v4 with: diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 442d74f4..7f807a9f 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -174,7 +174,7 @@ if [ $USE_GMP = "gmp" ]; then --enable-shared=yes\ --enable-static=no\ --host=$HOST_ARG - make -j3 + make -j6 make install cd .. @@ -195,7 +195,7 @@ else tar xf yasm-$YASMVER.tar.gz cd yasm-$YASMVER ./configure --prefix=$PREFIX - make -j3 + make -j6 make install cd .. @@ -226,7 +226,7 @@ else --enable-shared=yes\ --enable-static=no\ --enable-gmpcompat - make -j3 + make -j6 make install cd .. @@ -260,7 +260,7 @@ else --with-gmp=$PREFIX\ --enable-shared=yes\ --enable-static=no - make -j3 + make -j6 make install cd .. fi @@ -285,7 +285,7 @@ cd flint-$FLINTVER $FLINTARB_WITHGMP\ --with-mpfr=$PREFIX\ --disable-static - make -j3 + make -j6 make install cd .. @@ -312,7 +312,7 @@ if [ $BUILD_ARB = "yes" ]; then $FLINTARB_WITHGMP\ --with-mpfr=$PREFIX\ --disable-static - make -j3 + make -j6 make install # # Set PATH so that DLLs are picked up on Windows. diff --git a/bin/cibw.bat b/bin/cibw.bat index a21ebb6d..8f62e8e9 100644 --- a/bin/cibw.bat +++ b/bin/cibw.bat @@ -21,12 +21,7 @@ rem wheels from a previous run so we delete them here. rem del /q wheelhouse\* +rem override setting in pyproject.toml set CIBW_BUILD=cp39-* cp310-* cp311-* -set CIBW_SKIP=*-win32 *-manylinux_i686 *-musllinux_* -set CIBW_BEFORE_ALL_WINDOWS=C:\msys64\usr\bin\bash bin/cibw_before_all_windows.sh -set CIBW_BEFORE_BUILD_WINDOWS=C:\msys64\usr\bin\bash bin/cibw_before_build_windows.sh -set CIBW_ENVIRONMENT=PYTHON_FLINT_MINGW64=true -set CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} -set CIBW_TEST_COMMAND=python -c "import flint; print(str(flint.fmpz(2)))" cibuildwheel --platform windows diff --git a/bin/cibw.sh b/bin/cibw.sh index a62de6f3..23a70498 100755 --- a/bin/cibw.sh +++ b/bin/cibw.sh @@ -8,28 +8,10 @@ rm -f wheelhouse/* -# bin/build_dependencies_unix.sh places headers and shared libraries under .local -export CIBW_ENVIRONMENT='C_INCLUDE_PATH=$(pwd)/.local/include/ LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true' - -export CIBW_BUILD='cp39-* cp310-* cp311-* cp312-*' -# export CIBW_BUILD='cp311-*' -export CIBW_SKIP='*-win32 *-manylinux_i686 *-musllinux_*' - # export CIBW_ARCHS_MACOS="x86_64" export CIBW_ARCHS_MACOS="arm64" -export CIBW_BEFORE_ALL_LINUX=bin/cibw_before_all_linux.sh -# export CIBW_BEFORE_ALL_MACOS=bin/cibw_before_all_macosx_x86_64.sh -export CIBW_BEFORE_ALL_MACOS=bin/cibw_before_all_macosx_arm64.sh -export CIBW_BEFORE_ALL_WINDOWS='C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh' - -export CIBW_BEFORE_BUILD='pip install numpy cython delvewheel' -export CIBW_BEFORE_BUILD_WINDOWS='C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh' - -export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS='bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}' - -# export CIBW_TEST_COMMAND="python -c 'import flint; print(str(flint.fmpz(2)))'" -export CIBW_TEST_COMMAND="python -m flint.test" +export CIBW_TEST_COMMAND="python -m flint.test" # override setting in pyproject.toml # cibuildwheel --platform linux # cibuildwheel --platform windows diff --git a/pyproject.toml b/pyproject.toml index e5bd0307..19d18a8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,3 +20,30 @@ classifiers = [ [project.readme] file = "README.md" content-type = "text/markdown" + +[tool.cibuildwheel] +build = "cp39-* cp310-* cp311-* cp312-*" +skip = "*-win32 *-manylinux_i686 *-musllinux_*" +manylinux-x86_64-image = "manylinux2014" +manylinux-i686-image = "manylinux2014" +test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" + +[tool.cibuildwheel.environment] +# bin/build_dependencies_unix.sh places headers and shared libraries under .local +C_INCLUDE_PATH = "$(pwd)/.local/include/" +LIBRARY_PATH = "$(pwd)/.local/lib/" +LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" + +[tool.cibuildwheel.linux] +before-all = "bin/cibw_before_all_linux.sh" + +[tool.cibuildwheel.macos] +before-all = "bin/cibw_before_all_macosx_$(uname -m).sh" + +[tool.cibuildwheel.windows] +before-all = "C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh" +before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh" +repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" + +[tool.cibuildwheel.windows.environment] +PYTHON_FLINT_MINGW64 = "true"