Update libopencv-dev package: improve compatibility with latest Visua… #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
OPENCVVER: 4.9.0 | |
on: | |
push: | |
branches: 'libopencv-dev.4.9.0' | |
tags: '' # Restrict to blank tags | |
pull_request: | |
jobs: | |
vcmatrix: | |
runs-on: ${{ matrix.cfg.os }} | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc17, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v143 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2022 x64' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc17, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v143 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2022 x64 Debug' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc17, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v143 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2022 x64 static' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc17, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v143 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2022 x64 static Debug' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc17, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v143 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2022 x86' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc17, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v143 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2022 x86 Debug' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc17, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v143 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2022 x86 static' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc17, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v143 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2022 x86 static Debug' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc16, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v142 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2019 x64' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc16, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v142 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2019 x64 Debug' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc16, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v142 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2019 x64 static' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: vc16, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v142 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2019 x64 static Debug' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc16, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2019 x86' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc16, shared: 'ON', cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2019 x86 Debug' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc16, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2019 x86 static' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: vc16, shared: 'OFF', cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2019 x86 static Debug' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc15, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v141 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2017 x64' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc15, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v141 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2017 x64 Debug' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc15, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v141 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2017 x64 static' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc15, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v141 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2017 x64 static Debug' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc15, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v141 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2017 x86' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc15, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v141 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2017 x86 Debug' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc15, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v141 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2017 x86 static' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc15, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v141 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2017 x86 static Debug' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc14, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v140 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2015 x64' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc14, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v140 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2015 x64 Debug' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc14, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v140 -A x64', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2015 x64 static' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: vc14, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v140 -A x64', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2015 x64 static Debug' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc14, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v140 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2015 x86' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc14, shared: 'ON', cmake_params: '-G "Visual Studio 16" -T v140 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2015 x86 Debug' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc14, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v140 -A Win32', choco_flags: '--x86', cmake_config: 'Release', test_config: 'Release/', desc: 'Visual Studio 2015 x86 static' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: vc14, shared: 'OFF', cmake_params: '-G "Visual Studio 16" -T v140 -A Win32', choco_flags: '--x86', cmake_config: 'Debug', test_config: 'Debug/', desc: 'Visual Studio 2015 x86 static Debug' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw13, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 13.2.0 x64' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw13, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 13.2.0 x64 static' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw13, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 13.2.0 x86' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw13, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 13.2.0 x86 static' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw12, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 12.2.0 x64' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw12, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 12.2.0 x64 static' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw12, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 12.2.0 x86' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw12, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 12.2.0 x86 static' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw11, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 11.2.0 x64' } | |
- { os: windows-2022, arch: x64, bitness: 64, runtime: mingw11, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 11.2.0 x64 static' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw11, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 11.2.0 x86' } | |
- { os: windows-2022, arch: x86, bitness: 32, runtime: mingw11, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 11.2.0 x86 static' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: mingw8, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 8.1.0 x64' } | |
- { os: windows-2019, arch: x64, bitness: 64, runtime: mingw8, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', cmake_config: 'Release', desc: 'MinGW 8.1.0 x64 static' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: mingw8, shared: 'ON', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 8.1.0 x86' } | |
- { os: windows-2019, arch: x86, bitness: 32, runtime: mingw8, shared: 'OFF', cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', cmake_config: 'Release', desc: 'MinGW 8.1.0 x86 static' } | |
name: ${{ matrix.cfg.desc }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
clean: false | |
- run: | | |
rem choco install -y -r --no-progress 7zip git cmake make nsis jq | |
choco install -y -r --no-progress wget unzip patch checksum dos2unix | |
powershell -Command "Install-WindowsFeature Server-Media-Foundation" | |
wget http://www.ensta-bretagne.fr/lebars/Share/windows_server_core_prereq.zip --no-check-certificate -nv | |
7z x windows_server_core_prereq.zip -o"%SystemRoot%" -y & cd. & rem ksuser.dll already on windows-2016...? | |
del /f /q windows_server_core_prereq.zip | |
wget http://www.ensta-bretagne.fr/lebars/Share/cmake_extra_tools.zip --no-check-certificate -nv | |
7z x cmake_extra_tools.zip -o"%SystemDrive%" -y | |
del /f /q cmake_extra_tools.zip | |
wget https://gist.github.com/lebarsfa/237841f9e5dad55ef192713b3b1b2f16/raw/04d77ced3457346c55f183ca12a10dbcb850e6d5/refreshenv.bashrc --no-check-certificate -nv | |
move /y refreshenv.bashrc %USERPROFILE% | |
- run: | | |
choco install -y -r --no-progress mingw --version=8.1.0 --force ${{ matrix.cfg.choco_flags }} | |
%SystemDrive%\cmake_extra_tools\pathman /as C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw${{ matrix.cfg.bitness }}\bin & cd. & rem Non-zero exit code...? | |
echo export BASHMINGWPATH=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw${{ matrix.cfg.bitness }}/bin>>%USERPROFILE%\.bashrc | |
if: (matrix.cfg.runtime=='mingw8') | |
- run: | | |
choco install -y -r --no-progress mingw --version=11.2.0.07112021 --force ${{ matrix.cfg.choco_flags }} | |
%SystemDrive%\cmake_extra_tools\pathman /as C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw${{ matrix.cfg.bitness }}\bin & cd. & rem Non-zero exit code...? | |
echo export BASHMINGWPATH=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw${{ matrix.cfg.bitness }}/bin>>%USERPROFILE%\.bashrc | |
if: (matrix.cfg.runtime=='mingw11') | |
- run: | | |
choco install -y -r --no-progress mingw --version=12.2.0.03042023 --force ${{ matrix.cfg.choco_flags }} | |
%SystemDrive%\cmake_extra_tools\pathman /as C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw${{ matrix.cfg.bitness }}\bin & cd. & rem Non-zero exit code...? | |
echo export BASHMINGWPATH=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw${{ matrix.cfg.bitness }}/bin>>%USERPROFILE%\.bashrc | |
if: (matrix.cfg.runtime=='mingw12') | |
- run: | | |
choco install -y -r --no-progress mingw --version=13.2.0 --force ${{ matrix.cfg.choco_flags }} | |
%SystemDrive%\cmake_extra_tools\pathman /as C:\ProgramData\mingw64\mingw${{ matrix.cfg.bitness }}\bin & cd. & rem Non-zero exit code...? | |
echo export BASHMINGWPATH=/c/ProgramData/mingw64/mingw${{ matrix.cfg.bitness }}/bin>>%USERPROFILE%\.bashrc | |
if: (matrix.cfg.runtime=='mingw13') | |
- run: | | |
source ~/refreshenv.bashrc ; refreshenv | |
export PATH=$BASHMINGWPATH:$PATH | |
echo $PATH | |
git clone --depth 1 -b ${{ env.OPENCVVER }} https://github.com/opencv/opencv.git | |
git clone --depth 1 -b ${{ env.OPENCVVER }} https://github.com/opencv/opencv_contrib.git | |
patch -p0 -i choco/libopencv-dev/tools/no_iconv_mingw.patch | |
git config --global user.email "[email protected]" | |
git config --global user.name "temporary" | |
cd opencv | |
git fetch origin pull/25632/head:PR25632 | |
curl -s https://api.github.com/repos/opencv/opencv/pulls/25632/commits | jq -r '.[] | .sha' | /c/ProgramData/chocolatey/lib/dos2unix/tools/bin/dos2unix -O | while read commit; do git cherry-pick $commit; done | |
git fetch origin pull/25638/head:PR25638 | |
curl -s https://api.github.com/repos/opencv/opencv/pulls/25638/commits | jq -r '.[] | .sha' | /c/ProgramData/chocolatey/lib/dos2unix/tools/bin/dos2unix -O | while read commit; do git cherry-pick $commit; done | |
cd .. | |
mkdir build | |
cd build | |
export _RUNTIME=${{ matrix.cfg.runtime }} | |
cmake ${{ matrix.cfg.cmake_params }} -D OpenCV_ARCH=${{ matrix.cfg.arch }} -D OpenCV_RUNTIME=${_RUNTIME:0:5} -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D OPENCV_ENABLE_NONFREE=ON -D BUILD_opencv_python3=OFF -D BUILD_SHARED_LIBS=${{ matrix.cfg.shared }} -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_opencv_world=${{ matrix.cfg.shared }} -D WITH_CUDA=OFF ../opencv | |
cmake --build . -j 4 --config ${{ matrix.cfg.cmake_config }} --target package | |
if [[ ${{ matrix.cfg.shared }} = OFF ]]; then export _STATIC=static ; else unset _STATIC ; fi | |
mv *.exe ../libopencv-dev.${{ env.OPENCVVER }}_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}_${_STATIC}lib_${{ matrix.cfg.cmake_config }}.exe | |
cd ../choco/libopencv-dev | |
mv tools/cv_mat_test .. | |
mv tools/no_iconv_mingw.patch .. | |
choco pack | |
cd ../.. | |
checksum -f=libopencv-dev.${{ env.OPENCVVER }}_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}_${_STATIC}lib_${{ matrix.cfg.cmake_config }}.exe -t=sha256 | |
shell: bash | |
- uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "*.exe" | |
overwrite: true | |
tag_name: autotagname-${{ github.sha }} | |
if: (github.event_name != 'pull_request')&&(github.ref_name == 'libopencv-dev.${{ env.OPENCVVER }}') | |
- run: | | |
source ~/refreshenv.bashrc ; refreshenv | |
export PATH=$BASHMINGWPATH:$PATH | |
echo $PATH | |
export _RUNTIME=${{ matrix.cfg.runtime }} | |
if [[ ${{ matrix.cfg.shared }} = OFF ]]; then export _STATIC=static ; else unset _STATIC ; fi | |
cd choco/libopencv-dev | |
choco install -y -r --no-progress --ignore-dependencies -s . libopencv-dev --params "'/url:../../libopencv-dev.${{ env.OPENCVVER }}_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}_${_STATIC}lib_${{ matrix.cfg.cmake_config }}.exe'" | |
source ~/refreshenv.bashrc ; refreshenv | |
export PATH=$BASHMINGWPATH:$PATH | |
echo $PATH | |
reg query "HKLM\SOFTWARE\Kitware\CMake\Packages\OpenCV" | |
cd ../cv_mat_test | |
if [[ ${{ matrix.cfg.shared }} = ON ]]; then export OpenCV_STATIC=OFF ; else export OpenCV_STATIC=ON ; fi | |
cmake ${{ matrix.cfg.cmake_params }} -D OpenCV_ARCH=${{ matrix.cfg.arch }} -D OpenCV_RUNTIME=${_RUNTIME:0:5} -D OpenCV_STATIC=$OpenCV_STATIC . || true | |
cmake --build . --config ${{ matrix.cfg.cmake_config }} | |
file ./${{ matrix.cfg.test_config }}cv_mat_test | |
./${{ matrix.cfg.test_config }}cv_mat_test | |
cd ../.. | |
shell: bash | |
- run: | | |
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1" ; refreshenv | |
echo $env:PATH | |
reg query "HKLM\SOFTWARE\Kitware\CMake\Packages\OpenCV" | |
choco uninstall -y -r --no-progress libopencv-dev | |
shell: pwsh | |
- run: | | |
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1" ; refreshenv | |
echo $env:PATH | |
reg query "HKLM\SOFTWARE\Kitware\CMake\Packages\OpenCV" | |
shell: pwsh |