Skip to content

Commit

Permalink
Merge pull request #281 from viktor-ferenczi/setup-faster-download
Browse files Browse the repository at this point in the history
Improved download and archive extraction speed during setup
  • Loading branch information
deadprogram authored Aug 26, 2018
2 parents 641bee8 + 2973cfa commit 2a7e91b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
29 changes: 25 additions & 4 deletions win_build_opencv.cmd
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2a7e91b

Please sign in to comment.