If somebody finds this question looking for an answer on how to automate the build process of a QT project, and wants to do it using a BATCH file as the original question states, here is the BATCH script that I used to automate my building process:
@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
cd %path_to_your_repo%
nmake /f Makefile.Release clean && qmake.exe %path_to_your_.pro% -spec win32-msvc "CONFIG+=qtquickcompiler"
nmake qmake_all
nmake -f Makefile.Release
It is important to call the vcvarsall.bat
the first thing, as this will set the environment for all visual studio tools. Also make sure to launch it with call
, if you just start the batch file as in @vahancho's answer it will stop your script after executing vcvarsall.bat
.
The clean step is not necessary but it is a good practice to use it before building.
It is important to select the -spec
and CONFIG
(if any) during the qmake
step, as this will allow you to select the compiler and required configuration if you are using some extra QT configuration.