PDA

View Full Version : Qt Creator Qt Creator and big auto generated makefiles



yurai
23rd May 2015, 11:08
Suppose I create new project in Qt Creator by Non-Qt Project->Plain C++ Project.
Unfortunately makefile generated by editor has ~20KB garbages I don't need for my simple 'Hello World' like *.pri files and compiler_yacc_decl_* rules.
I guess there is some file in Tools/QtCreator/share/qtcreator/templates/wizards that should be modified but I couldn't grep that. Removing those lines:
include(deployment.pri)
qtcAddDeployment()
from Tools/QtCreator/share/qtcreator/templates/wizards/plaincppapp/qmake/project.pro
did't help.
Is it possible to force Qt Creator to not generating so big makefiles for new projects?

jefftee
27th May 2015, 03:41
You could probably hack your way around and change what is generated by qmake, but seriously, why do you care about 20KB worth of files?

Surely time spent developing and testing your application is more important than trying to reduce your build footprint by 20KB. If you are worried about the size of distributing your application, you shouldn't be distributing any generated files, including make files anyway. Just include the files required to build your application, etc.

Just my opinon.

yurai
28th May 2015, 13:14
"hack your way around and change what is generated by qmake"
That's what I would like to know. Could you provide more informations how to do this?

<offtop>
"but seriously, why do you care about 20KB worth of files?"
I don't use Qt framework at all and I just don't need anything associated with Qt framework (like extra *.pri).
That's not any kind of premature optimization. If you have some unsused variables in your code I guess you just remove them. That's the same.
Clean code approach applied to makefiles :)

"you shouldn't be distributing any generated files, including make files anyway"
I disagree. I believe that attaching makefile to projects (e.g on github) is good practice.
Ability to building some project downloaded from internet is important thing for me.
</offtop>

Thanks for response

anda_skoa
28th May 2015, 13:37
<offtop>
"but seriously, why do you care about 20KB worth of files?"
I don't use Qt framework at all and I just don't need anything associated with Qt framework (like extra *.pri).

Then maybe you don't want to use a qmake based project.



I believe that attaching makefile to projects (e.g on github) is good practice.
Ability to building some project downloaded from internet is important thing for me.

You are mixing two things.

The ability to build a project by having all necessary build input files is indeed good practise, but in this case those are not the Makefiles.
The Makefiles generated by qmake are already build artefacts, specific to the platform and possibly even the machine qmake ran on.

Cheers,
_

jefftee
29th May 2015, 04:46
"hack your way around and change what is generated by qmake"
That's what I would like to know. Could you provide more informations how to do this?

Sorry, I have never had the need to do this, so I wouldn't know how to recommend for you to get started.


I don't use Qt framework at all and I just don't need anything associated with Qt framework (like extra *.pri).
That's not any kind of premature optimization. If you have some unsused variables in your code I guess you just remove them. That's the same.
Clean code approach applied to makefiles :)

If you're not using the Qt framework, then I would question why you're using qmake at all. Why not just hand code your Makefile and make it lean and mean if that's important to you?



"you shouldn't be distributing any generated files, including make files anyway"
I disagree. I believe that attaching makefile to projects (e.g on github) is good practice.
Ability to building some project downloaded from internet is important thing for me.

My point was the qmake generates the Makefile, specific to *your* build system. If you continue to use qmake for your project, the end user should run qmake on *their* system so that a Makefile is generated for their specific system. For example, I'm a mac user, the Makefile you generate for Linux or Windows will be useless for me or anyone else whose build system doesn't match yours exactly.

Even the standard GNU build system consists of configure, make, make install. The configure step generates a Makefile that is appropriate for the user's system.

Anyway, I wish I could be of more help, but I have never attempted to influence the stuff included in a qmake generated Makefile, other than the built-in qmake directives that allow you to add post-link commands and platform specific compiler/linker options, etc.

yurai
12th June 2015, 10:14
Finally I solved problem by producing my project from "scratch" by creating files manually and importing them.
It requires some extra effort like setting include paths, preparing build and run configurations which is not so good but from the other hand
I have directory hierarchy like I wanted to and custom makefiles without qmake dependency.
Thanks for help and advices.