Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a qt project from command line?

I've seen similar questions, but they all address slightly different situations than my own.

I have the source code for a qt project on a github repo, including the .pro file. Basically, I want to know if it's possible for someone on a Windows machine to clone the repo and build the executable from the source code without downloading and configuring Qt Creator. If it is possible, what prerequisites need to be met, and what steps need to be taken in order to build the project? The project uses qmake and not cmake, which probably affects the answer.

like image 295
Terry Martin Avatar asked Nov 15 '18 21:11

Terry Martin


People also ask

How do I run Qt application from terminal?

For console applications, check the Run in terminal check box. To specify the terminal to use on Linux and macOS, select Edit > Preferences > Environment > System. To run with special environment variables set up, select them in the Run Environment section. For more information, see Selecting the Run Environment.


1 Answers

Install Qt. Download and install Git for Windows. In Git Bash, go to a folder you want to use for a project. Execute the command git clone. Run Start -> Qt<version> -> Qt Command Prompt. CD to this directory and execute:

qmake <your_project.pro>
mingw32-make

or if you are using MSVC, commands should be

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
qmake <your_project.pro>
nmake
like image 109
Michael Avatar answered Sep 28 '22 04:09

Michael