set QT_TOOLS_MINGW_PATH=C:\Qt\Tools\mingw1120_64\bin
set QT_TOOLS_PATH=C:\Qt\6.2.4\mingw_64\bin
set OPENCV_MINGW_PATH=C:\OpenCV\install\x64\mingw\bin

set PATH=%PATH%;%QT_TOOLS_MINGW_PATH%
REM echo %PATH%
mkdir build
mkdir output
mkdir output\win
mkdir output\bin
mkdir output\bin\platforms
cd build
"%QT_TOOLS_PATH%\qmake.exe" ..\..\speckleonline.pro -spec win32-g++ PREFIX=win\output
"%QT_TOOLS_MINGW_PATH%\mingw32-make.exe"
"%QT_TOOLS_MINGW_PATH%\mingw32-make.exe" install
cd ..
copy /Y build\bin\*.exe output\bin\

copy /Y "%QT_TOOLS_PATH%\libgcc_s_seh-1.dll" output\bin\
copy /Y "%QT_TOOLS_PATH%\libstdc++-6.dll" output\bin\
copy /Y "%QT_TOOLS_PATH%\libwinpthread-1.dll" output\bin\
copy /Y "%QT_TOOLS_PATH%\Qt6Widgets.dll" output\bin\
copy /Y "%QT_TOOLS_PATH%\Qt6Core.dll" output\bin\
copy /Y "%QT_TOOLS_PATH%\Qt6Gui.dll" output\bin\

copy /Y "%OPENCV_MINGW_PATH%\libopencv_core460.dll" output\bin\
copy /Y "%OPENCV_MINGW_PATH%\libopencv_video460.dll" output\bin\
copy /Y "%OPENCV_MINGW_PATH%\libopencv_videoio460.dll" output\bin\
copy /Y "%OPENCV_MINGW_PATH%\libopencv_imgcodecs460.dll" output\bin\
copy /Y "%OPENCV_MINGW_PATH%\libopencv_highgui460.dll" output\bin\
copy /Y "%OPENCV_MINGW_PATH%\libopencv_imgproc460.dll" output\bin\

copy /Y "%QT_TOOLS_PATH%\..\plugins\platforms\qwindows.dll" output\bin\platforms
copy /Y speckleonline.nsi output\win

rmdir /S /Q build

