47 lines
1.3 KiB
Batchfile
47 lines
1.3 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
rem Usage:
|
|
rem build_windows.bat C:\Qt\6.6.0\msvc2019_64 C:\opencv\build\x64\vc16\lib "Visual Studio 17 2022"
|
|
rem build_windows.bat C:\Qt\6.6.0\mingw_64 C:\opencv-mingw\install "MinGW Makefiles"
|
|
|
|
if "%~1"=="" (
|
|
echo Usage: %~nx0 ^<QtDir^> ^<OpenCV_DIR^> [CMakeGenerator]
|
|
echo Example MSVC : %~nx0 C:\Qt\6.6.0\msvc2019_64 C:\opencv\build\x64\vc16\lib "Visual Studio 17 2022"
|
|
echo Example MinGW: %~nx0 C:\Qt\6.6.0\mingw_64 C:\opencv-mingw\install "MinGW Makefiles"
|
|
exit /b 1
|
|
)
|
|
|
|
if "%~2"=="" (
|
|
echo Missing OpenCV_DIR.
|
|
exit /b 1
|
|
)
|
|
|
|
set QT_DIR=%~1
|
|
set OPENCV_DIR=%~2
|
|
set GENERATOR=%~3
|
|
|
|
if "%GENERATOR%"=="" (
|
|
set GENERATOR=Visual Studio 17 2022
|
|
)
|
|
|
|
if not exist build-windows (
|
|
mkdir build-windows
|
|
)
|
|
|
|
if /I "%GENERATOR%"=="MinGW Makefiles" (
|
|
cmake -S . -B build-windows -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%QT_DIR%" -DOpenCV_DIR="%OPENCV_DIR%"
|
|
) else (
|
|
cmake -S . -B build-windows -G "%GENERATOR%" -A x64 -DCMAKE_PREFIX_PATH="%QT_DIR%" -DOpenCV_DIR="%OPENCV_DIR%"
|
|
)
|
|
|
|
if errorlevel 1 exit /b %errorlevel%
|
|
|
|
cmake --build build-windows --config Release
|
|
if errorlevel 1 exit /b %errorlevel%
|
|
|
|
echo.
|
|
echo Build finished.
|
|
echo For MSVC, check: build-windows\Release\QtOpenCVImageTool.exe
|
|
echo For MinGW, check: build-windows\QtOpenCVImageTool.exe
|