diff --git a/.github/workflows/wheels-linux.yml b/.github/workflows/wheels-linux.yml index bd2533e7..559c3b91 100644 --- a/.github/workflows/wheels-linux.yml +++ b/.github/workflows/wheels-linux.yml @@ -82,12 +82,10 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }} - CIBW_BEFORE_ALL_LINUX: bash build_tools/github/install_cv4.sh + CIBW_BEFORE_ALL_LINUX: yum install -y opencv opencv-devel CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }} - CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }} CIBW_TEST_REQUIRES: pytest threadpoolctl CIBW_TEST_COMMAND: bash {project}/build_tools/github/test_wheels.sh - CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} ${{ matrix.bitness }} CIBW_BUILD_VERBOSITY: 1 run: bash build_tools/github/build_wheels.sh diff --git a/.github/workflows/wheels-windows.yml b/.github/workflows/wheels-windows.yml index 267f820a..3e3ece93 100644 --- a/.github/workflows/wheels-windows.yml +++ b/.github/workflows/wheels-windows.yml @@ -1,3 +1,4 @@ +# Workflow to build and test wheels name: Wheel builder Windows on: @@ -33,7 +34,6 @@ jobs: fetch-depth: 0 - name: Update submodules - # if: github.event_name == 'pull_request' run: git submodule update --remote - name: Set up Python ${{ matrix.python-version }} @@ -42,40 +42,10 @@ jobs: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Get CMake - uses: lukka/get-cmake@latest - - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.1 - - - name: Restore vcpkg and its artifacts. - uses: actions/cache@v2 - id: vcpkg-cache - with: - path: | - ${{ env.VCPKG_ROOT }} - ${{ github.workspace }}/build/vcpkg_installed - !${{ env.VCPKG_ROOT }}/.git - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - key: | - ${{ hashFiles( 'vcpkg.json' ) }}-cache-key-v1 - - - name: Get vcpkg(windows) - if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} - run: | - cd ${{ github.workspace }} - mkdir build -force - git clone https://github.com/Microsoft/vcpkg.git - cd vcpkg - .\bootstrap-vcpkg.bat - - name: Install OpenCV - if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} run: | cd ${{ github.workspace }} - vcpkg install opencv:x64-windows + build_tools/install_opencv_windows.bat - name: Build a package run: | @@ -86,13 +56,13 @@ jobs: set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp36 --dist-dir=%cd%\wheelhouse -v shell: cmd env: - OpenCV_DIR: C:/vcpkg/packages/opencv_x64-windows/share/opencv + OpenCV_DIR: ${{ github.workspace }}\opencv\build - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels - path: wheelhouse/opencv*.whl + path: wheelhouse/*.whl release_daisykit: # if: github.event_name == 'release' && !github.event.release.prerelease diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d9fbef7..98e6e7b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ endif() set(DAISYKIT_VERSION_MAJOR 0) set(DAISYKIT_VERSION_MINOR 3) set(DAISYKIT_VERSION_PATCH 0) -set(DAISYKIT_VERSION_BUILD 1) +set(DAISYKIT_VERSION_BUILD 2) set(DAISYKIT_VERSION_STRING ${DAISYKIT_VERSION_MAJOR}.${DAISYKIT_VERSION_MINOR}.${DAISYKIT_VERSION_PATCH}.${DAISYKIT_VERSION_BUILD}) message(STATUS "DAISYKIT_VERSION_STRING = ${DAISYKIT_VERSION_STRING}") diff --git a/build_tools/github/install_cv4.sh b/build_tools/github/install_cv4.sh deleted file mode 100644 index 688bd260..00000000 --- a/build_tools/github/install_cv4.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash - -echo "Installing OpenCV..." - -# Specify OpenCV version -cvVersion="4.5.4" - -curl -O -L https://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz && \ - tar -xf qt-everywhere-src-5.15.0.tar.xz && \ - cd qt-everywhere* && \ - export MAKEFLAGS=-j$(nproc) && \ - ./configure -prefix /opt/Qt5.15.0 -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ - make && \ - make install && \ - cd .. && \ - rm -rf qt-everywhere-src-5.15.0 && \ - rm qt-everywhere-src-5.15.0.tar.xz - -QTDIR /opt/Qt5.15.0 -export PATH="$QTDIR/bin:$PATH" - -mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ - curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz && \ - tar -xf OpenSSL_1_1_1g.tar.gz && \ - cd openssl-OpenSSL_1_1_1g && \ - ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ - make -j$(getconf _NPROCESSORS_ONLN) && \ - # skip installing documentation - make install_sw && \ - rm -rf ~/openssl_build - -cd ~/ffmpeg_sources && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.15.04/nasm-2.15.04.tar.bz2 && \ - tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ - make -j$(getconf _NPROCESSORS_ONLN) && \ - make install - -cd ~/ffmpeg_sources && \ - curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ - tar -xf yasm-1.3.0.tar.gz && \ - cd yasm-1.3.0 && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ - make -j$(getconf _NPROCESSORS_ONLN) && \ - make install - -cd ~/ffmpeg_sources && \ - git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ - cd libvpx && \ - ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ - make -j$(getconf _NPROCESSORS_ONLN) && \ - make install - -cd ~/ffmpeg_sources && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.bz2 && \ - tar -xf ffmpeg-4.3.2.tar.bz2 && \ - cd ffmpeg-4.3.2 && \ - PATH=~/bin:$PATH && \ - PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ - make -j$(getconf _NPROCESSORS_ONLN) && \ - make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ - ldconfig && \ - rm -rf ~/ffmpeg_sources - -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig - -cd ~ - -git clone https://github.com/opencv/opencv.git -cd opencv -git checkout "$cvVersion" -cd .. - -git clone https://github.com/opencv/opencv_contrib.git -cd opencv_contrib -git checkout "$cvVersion" -cd .. - -cd opencv -mkdir build -cd build - -cmake -D CMAKE_BUILD_TYPE=RELEASE \ - -D INSTALL_C_EXAMPLES=OFF \ - -D INSTALL_PYTHON_EXAMPLES=OFF \ - -D WITH_TBB=OFF \ - -D WITH_V4L=OFF \ - -D OPENCV_SKIP_PYTHON_LOADER=ON \ - -D OPENCV_GENERATE_PKGCONFIG=ON \ - -D WITH_QT=OFF \ - -D WITH_OPENGL=OFF \ - -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \ - -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ - -D ENABLE_CXX11=ON \ - -D BUILD_EXAMPLES=OFF .. - -make -j$(nproc) -make install - -cd $cwd diff --git a/build_tools/github/test_windows_wheels.sh b/build_tools/github/test_windows_wheels.sh deleted file mode 100755 index fd215637..00000000 --- a/build_tools/github/test_windows_wheels.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e -set -x - -PYTHON_VERSION=$1 -BITNESS=$2 - -# if [[ "$BITNESS" == "32" ]]; then -# # 32-bit architectures use the regular -# # test command (outside of the minimal Docker container) -# cp $CONFTEST_PATH $CONFTEST_NAME -# python -c "import daisykit;" -# pytest --pyargs daisykit -# else -# docker container run \ -# --rm daisykit/minimal-windows \ -# powershell -Command "python -c 'import daisykit;'" - -# docker container run \ -# -e daisykit_SKIP_NETWORK_TESTS=1 \ -# -e OMP_NUM_THREADS=2 \ -# -e OPENBLAS_NUM_THREADS=2 \ -# --rm daisykit/minimal-windows \ -# powershell -Command "pytest --pyargs daisykit" -# fi diff --git a/build_tools/install_opencv_windows.bat b/build_tools/install_opencv_windows.bat new file mode 100644 index 00000000..6cd347e0 --- /dev/null +++ b/build_tools/install_opencv_windows.bat @@ -0,0 +1,23 @@ +set "opencv_release_url=https://github.com/opencv/opencv/releases/download/4.7.0/opencv-4.7.0-windows.exe" +set "opencv_installer=opencv_installer.exe" + +echo Downloading OpenCV installer... +curl -L -o %opencv_installer% %opencv_release_url% + +rem Check if 7-Zip is installed +where 7z > nul +if %errorlevel% neq 0 ( + echo 7-Zip is not installed. Downloading... + curl -L -o 7zip_installer.exe https://www.7-zip.org/a/7z2201-x64.exe + echo Installing 7-Zip silently... + start /wait 7zip_installer.exe /S + echo Cleaning up... + del 7zip_installer.exe +) + +echo Extracting OpenCV installer... +7z x %opencv_installer% -oopencv + +echo Cleaning up... +del %opencv_installer% +echo OpenCV installation completed. diff --git a/pyproject.toml b/pyproject.toml index 79f7eff7..220aeb4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,12 +3,12 @@ requires = [ "setuptools", "wheel", "scikit-build", "cmake", "pip", "ninja; sys_platform != 'win32'", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", - "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'", + "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'", "numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'", "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.21.2; python_version=='3.10' and platform_system!='Darwin'", "numpy==1.21.4; python_version=='3.10' and platform_system=='Darwin'", - "numpy==1.22.0; python_version>='3.11'" + "numpy==1.23.2; python_version>='3.11'" ] build-backend = "setuptools.build_meta"