2019-12-18 23:08:07 +00:00
|
|
|
echo off
|
|
|
|
|
|
|
|
if not exist "C:\opencv" mkdir "C:\opencv"
|
|
|
|
if not exist "C:\opencv\build" mkdir "C:\opencv\build"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-04-12 16:00:12 +00:00
|
|
|
echo Downloading: opencv-4.5.5.zip [91MB]
|
|
|
|
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv/archive/4.5.5.zip -OutFile c:\opencv\opencv-4.5.5.zip"
|
2019-12-18 23:08:07 +00:00
|
|
|
echo Extracting...
|
2022-04-12 16:00:12 +00:00
|
|
|
powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path c:\opencv\opencv-4.5.5.zip -DestinationPath c:\opencv"
|
|
|
|
del c:\opencv\opencv-4.5.5.zip /q
|
2019-12-18 23:08:07 +00:00
|
|
|
echo.
|
|
|
|
|
2022-04-12 16:00:12 +00:00
|
|
|
echo Downloading: opencv_contrib-4.5.5.zip [58MB]
|
|
|
|
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv_contrib/archive/4.5.5.zip -OutFile c:\opencv\opencv_contrib-4.5.5.zip"
|
2019-12-18 23:08:07 +00:00
|
|
|
echo Extracting...
|
2022-04-12 16:00:12 +00:00
|
|
|
powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path c:\opencv\opencv_contrib-4.5.5.zip -DestinationPath c:\opencv"
|
|
|
|
del c:\opencv\opencv_contrib-4.5.5.zip /q
|
2019-12-18 23:08:07 +00:00
|
|
|
echo.
|
|
|
|
|
|
|
|
echo Done with downloading and extracting sources.
|
|
|
|
echo.
|
|
|
|
|
|
|
|
echo on
|
|
|
|
|
|
|
|
cd /D C:\opencv\build
|
2022-04-12 16:00:12 +00:00
|
|
|
set PATH=%PATH%;C:\Program Files (x86)\CMake\bin;C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
|
2022-01-03 18:21:35 +00:00
|
|
|
if [%1]==[static] (
|
|
|
|
echo Build static opencv
|
|
|
|
set enable_shared=OFF
|
|
|
|
) else (
|
|
|
|
set enable_shared=ON
|
|
|
|
)
|
2022-04-12 16:00:12 +00:00
|
|
|
cmake C:\opencv\opencv-4.5.5 -G "MinGW Makefiles" -BC:\opencv\build -DENABLE_CXX11=ON -DOPENCV_EXTRA_MODULES_PATH=C:\opencv\opencv_contrib-4.5.5\modules -DBUILD_SHARED_LIBS=%enable_shared% -DWITH_IPP=OFF -DWITH_MSMF=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_DOCS=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_wechat_qrcode=ON -DCPU_DISPATCH= -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_OPENCL_D3D11_NV=OFF -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int64_t -Wno-dev
|
2019-12-18 23:08:07 +00:00
|
|
|
mingw32-make -j%NUMBER_OF_PROCESSORS%
|
|
|
|
mingw32-make install
|
2022-04-12 16:00:12 +00:00
|
|
|
rmdir c:\opencv\opencv-4.5.5 /s /q
|
|
|
|
rmdir c:\opencv\opencv_contrib-4.5.5 /s /q
|
2019-12-18 23:08:07 +00:00
|
|
|
chdir /D %GOPATH%\src\gocv.io\x\gocv
|