I'm in the process of writing a build script to automate build and release tasks. I have a Qt Creator project which has three configurations, two of which I want to completely rebuild from scratch without any precompiled headers and existing .o files to skip (release and release_production). The latter is the same except it has the PRODUCTION symbol #defined.
I'm using windows. How can I build these configurations from the command line?
Edit: Some clarification: The Qt Creator custom build steps are not stored in the qmake makefile but in the Qt Creator-specific .pro.user XML file. I would like to perform these from the command line without repeating them in the script.
To get such a command prompt, just select "Qt 4.8. 5 Command Prompt" from the startmenu. Either that or open a command prompt via Start -> Run -> "CMD.exe" and then call "C:\your_qt_install_path\bin\qtvars.
There are two steps involved here:
Running qmake
to generate Makefiles. The usual command is
c:\qt\4.7.2\bin\qmake.exe" path\to\some\project.pro -r -spec win32-g++ CONFIG+=...
The -spec
switch is important. Make sure you supply a valid makespec file. CONFIG
needs to be specified in this step.
Running make
to compile and link. This is easy
C:\MinGW32\bin\mingw32-make -f Makefile.Debug
Remember to point make
to the correct makefile.
In the project tab of QtCreator you have the exact command, QtCreator runs on build for both debug and release. Just run those lines in a environment your project can be build (Qt console). But basically Qt projects are build with a qmake.exe
then a nmake.exe
or the Qt multi-thread make-like executable jom.exe
.
For your "production" mode your can use CONFIG+=production
argument in the qmake command, then in your .pro files :
CONFIG(production){
DEFINES+=PRODUCTION
}else{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With