diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 85f65c0..603fff0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,14 +10,14 @@ jobs: build_windows_wheels: name: Build ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: fail-fast: false matrix: os: [windows-latest] cibw_arch: ["AMD64"] cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 @@ -25,6 +25,16 @@ jobs: fetch-depth: 0 submodules: true + # - name: Check Python version + # run: | + # case "${{ matrix.cibw_python }}" in + # "cp38-") export PYTHON_VERSION="3.8" ;; + # "cp39-") export PYTHON_VERSION="3.9" ;; + # "cp310-") export PYTHON_VERSION="3.10" ;; + # "cp311-") export PYTHON_VERSION="3.11" ;; + # esac + # echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV + - uses: actions/setup-python@v4 name: Install Python with: @@ -56,8 +66,10 @@ jobs: python -m cibuildwheel --output-dir dist env: # define CC, CXX so meson will use clang-cl instead of MSVC - CC: clang-cl - CXX: clang-cl + # CC: clang-cl + # CXX: clang-cl + CC: gcc + CXX: g++ CIBW_BUILD: ${{ matrix.cibw_python }} CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }} # -Wl,-S equivalent to gcc's -Wl,--strip-debug @@ -99,53 +111,17 @@ jobs: - name: Build wheels for CPython Mac OS run: | - # Make sure to use a libomp version binary compatible with the oldest - # supported version of the macos SDK as libomp will be vendored into - # the scikit-image wheels for macos. The list of binaries are in - # https://packages.macports.org/libomp/. Currently, the oldest - # supported macos version is: High Sierra / 10.13. When upgrading - # this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment - # variable accordingly. Note that Darwin_17 == High Sierra / 10.13. - # - # We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET - # until there is a new release with this commit: - # https://github.com/mesonbuild/meson-python/pull/309 - if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then - # SciPy requires 12.0 on arm to prevent kernel panics - # https://github.com/scipy/scipy/issues/14688 - # so being conservative, we just do the same here - export MACOSX_DEPLOYMENT_TARGET=12.0 - export MACOS_DEPLOYMENT_TARGET=12.0 - OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2" - else - export MACOSX_DEPLOYMENT_TARGET=10.9 - export MACOS_DEPLOYMENT_TARGET=10.9 - OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2" - fi - echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} - echo MACOS_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET} - - # use conda to install llvm-openmp - # Note that we do NOT activate the conda environment, we just add the - # library install path to CFLAGS/CXXFLAGS/LDFLAGS below. - sudo conda create -n build $OPENMP_URL - PREFIX="/usr/local/miniconda/envs/build" - export CC=/usr/bin/clang - export CXX=/usr/bin/clang++ - export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp" - export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include" - export CXXFLAGS="$CXXFLAGS -I$PREFIX/include" - export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp" - python -m cibuildwheel --output-dir dist env: + CC: /usr/local/opt/llvm/bin/clang + CXX: /usr/local/opt/llvm/bin/clang CIBW_BUILD: ${{ matrix.cibw_python }} CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_TEST_SKIP: "*-macosx_arm64" CIBW_TEST_REQUIRES: pytest pytest-cov coverage - CIBW_TEST_COMMAND: coverage run --source={package} -m pytest {package}/tests && coverage report -m + CIBW_TEST_COMMAND: python -m pytest tests/ --cov={package} --benchmark-skip && coverage report -m - uses: actions/upload-artifact@v3 with: diff --git a/pyproject.toml b/pyproject.toml index 4d08930..1d252a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ setup = ['--default-library=static'] before-build = "sh tools/cibw_macos.sh" # environment = { CXX = "/usr/local/opt/llvm/bin/clang", CC = "/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%" diff --git a/tools/cibw_macos.sh b/tools/cibw_macos.sh index 64cb500..fa29720 100644 --- a/tools/cibw_macos.sh +++ b/tools/cibw_macos.sh @@ -1,14 +1,15 @@ #!/usr/bin/env bash -brew install --force libomp llvm openblas rm -rf /usr/local/bin/2to3/* +brew install --force libomp llvm openblas export CC=/usr/local/opt/llvm/bin/clang export CXX=/usr/local/opt/llvm/bin/clang++ export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp" -export CFLAGS="$CFLAGS -I$PREFIX/include" +export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include" export CXXFLAGS="$CXXFLAGS -I$PREFIX/include" export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp" +export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp" if [[ $(uname -m) == "arm64" && "$CIBW_BUILD" == "cp38-macosx_arm64" ]]; then # Enables native building and testing for macosx arm on Python 3.8. For details see: @@ -18,11 +19,40 @@ if [[ $(uname -m) == "arm64" && "$CIBW_BUILD" == "cp38-macosx_arm64" ]]; then sh "/Applications/Python 3.8/Install Certificates.command" fi -echo CXX VARIABLE: -echo $CXX -rm /usr/bin/clang -rm /usr/bin/clang++ -ln -s $CC /usr/bin/clang -ln -s $CXX /usr/bin/clang++ -alias clang=/usr/local/opt/llvm/bin/clang -alias clang++=/usr/local/opt/llvm/bin/clang++ \ No newline at end of file +echo CXX VARIABLE: $CXX +clang --version + + +# # Make sure to use a libomp version binary compatible with the oldest +# # supported version of the macos SDK as libomp will be vendored into +# # the scikit-image wheels for macos. The list of binaries are in +# # https://packages.macports.org/libomp/. Currently, the oldest +# # supported macos version is: High Sierra / 10.13. When upgrading +# # this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment +# # variable accordingly. Note that Darwin_17 == High Sierra / 10.13. +# # +# # We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET +# # until there is a new release with this commit: +# # https://github.com/mesonbuild/meson-python/pull/309 +# if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then +# # SciPy requires 12.0 on arm to prevent kernel panics +# # https://github.com/scipy/scipy/issues/14688 +# # so being conservative, we just do the same here +# export MACOSX_DEPLOYMENT_TARGET=12.0 +# export MACOS_DEPLOYMENT_TARGET=12.0 +# OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2" +# else +# export MACOSX_DEPLOYMENT_TARGET=10.9 +# export MACOS_DEPLOYMENT_TARGET=10.9 +# OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2" +# fi +# echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} +# echo MACOS_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET} + +# # use conda to install llvm-openmp +# # Note that we do NOT activate the conda environment, we just add the +# # library install path to CFLAGS/CXXFLAGS/LDFLAGS below. +# sudo conda create -n build $OPENMP_URL +# PREFIX="/usr/local/miniconda/envs/build" +# export CC=/usr/bin/clang +# export CXX=/usr/bin/clang++