diff --git a/README.md b/README.md index d63ed794..9f871dd0 100644 --- a/README.md +++ b/README.md @@ -325,7 +325,7 @@ The following commands should do everything to download and install OpenCV 3.4.2 chdir %GOPATH%\src\gocv.io\x\gocv win_build_opencv.cmd -It will probably take at least 1 hour to download and build. +It might take up to one hour. Last, add `C:\opencv\build\install\x64\mingw\bin` to your System Path. diff --git a/win_build_opencv.cmd b/win_build_opencv.cmd index dd46ea07..b6c9a4e2 100644 --- a/win_build_opencv.cmd +++ b/win_build_opencv.cmd @@ -1,13 +1,34 @@ +echo off + if not exist "C:\opencv" mkdir "C:\opencv" if not exist "C:\opencv\build" mkdir "C:\opencv\build" -powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri https://github.com/opencv/opencv/archive/3.4.2.zip -OutFile c:\opencv\opencv-3.4.2.zip" -powershell -command "Expand-Archive -Path c:\opencv\opencv-3.4.2.zip -DestinationPath c:\opencv" +echo Downloading OpenCV sources +echo. +echo For monitoring the download progress please check the C:\opencv directory. +echo. + +REM This is why there is no progress bar: +REM https://github.com/PowerShell/PowerShell/issues/2138 + +echo Downloading: opencv-3.4.2.zip [91MB] +powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv/archive/3.4.2.zip -OutFile c:\opencv\opencv-3.4.2.zip" +echo Extracting... +powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path c:\opencv\opencv-3.4.2.zip -DestinationPath c:\opencv" del c:\opencv\opencv-3.4.2.zip /q +echo. -powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri https://github.com/opencv/opencv_contrib/archive/3.4.2.zip -OutFile c:\opencv\opencv_contrib-3.4.2.zip" -powershell -command "Expand-Archive -Path c:\opencv\opencv_contrib-3.4.2.zip -DestinationPath c:\opencv" +echo Downloading: opencv_contrib-3.4.2.zip [58MB] +powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv_contrib/archive/3.4.2.zip -OutFile c:\opencv\opencv_contrib-3.4.2.zip" +echo Extracting... +powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path c:\opencv\opencv_contrib-3.4.2.zip -DestinationPath c:\opencv" del c:\opencv\opencv_contrib-3.4.2.zip /q +echo. + +echo Done with downloading and extracting sources. +echo. + +echo on cd C:\opencv\build set PATH=%PATH%;C:\Program Files (x86)\CMake\bin;C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin