Skip to content

Commit

Permalink
Fix OpenCV installation
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Jun 17, 2023
1 parent 34cb27a commit caa8982
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 169 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/wheels-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
os: [ubuntu-latest]
python: [36, 37, 38, 39, 310, 311]
bitness: [32, 64]
manylinux_image: [manylinux2014]
manylinux_image: [manylinux_2_28]
include:
- os: ubuntu-latest
bitness: 32
Expand Down Expand Up @@ -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: dnf update && dnf install epel-release && dnf 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
Expand Down
38 changes: 4 additions & 34 deletions .github/workflows/wheels-windows.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Workflow to build and test wheels
name: Wheel builder Windows

on:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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: |
Expand All @@ -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/opencv/build/x64/vc16

- 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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
102 changes: 0 additions & 102 deletions build_tools/github/install_cv4.sh

This file was deleted.

26 changes: 0 additions & 26 deletions build_tools/github/test_windows_wheels.sh

This file was deleted.

23 changes: 23 additions & 0 deletions build_tools/install_opencv_windows.bat
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions include/daisykit/models/face_recognition/face_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <fstream>
#include <iostream>
#include <vector>
#include <memory>
#include "daisykit/common/types.h"
#include "hnswlib.h"

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit caa8982

Please sign in to comment.