PDA

View Full Version : Set of Directories for a Project



vrltwe
8th August 2014, 04:03
Starting a new project Qt Creator creates a folder containing, i.e, release debug folders and some files, .pro, main.cpp, ... When the project gets bigger it makes sense to put .h files in a include folder, and .ccp files in a source folder... This post (http://www.qtforum.org/article/11422/tips-on-directory-project-file-conventions.html#post46235) mentions other folders ("moc", "obj", "ui", and "bin") which might be useful to keep things organized.

I would like to know about the origins and guidelines aboud these sets of directories. When actually should I use that directories? What is the standard to keep thinks well organized?

anda_skoa
8th August 2014, 05:55
There is no standard since this usually is governed by external guidelines, e.g. company guidelines or personal preferences.

What is very useful though is to build out-of-source, i.e. have the build folder outside the source folder. QtCreator does this by default, calls it Shadow Build.
This has the advantage of making special directories for moc, obj and ui unnecessary. These can be used in in-source-builds to keep the build artifacts separate from the source, but a real out-of-source build is way better.

vrltwe
9th August 2014, 03:23
I thinking to put include, source, ui and ProjetcX folders under svn trunk. ProjectX will be host for the .pro file, ui for .ui files, source for the .cpp files and include for the .h files. I'm not sure about main.ccp, seems ok to maintain it in ProjectX. Is this a good/bad aproach?

anda_skoa
9th August 2014, 09:07
Sounds reasonable.

I personally wouldn't separate headers from sources but that is a simply a matter of convenience.

Cheers,
_

vrltwe
9th August 2014, 20:34
And I'm thinking to add a test folder at same level as include, source, ... for automated unit tests. Inside this test folder there will be one or more ProjectTests.

And an install folder at the same level as include, source, ... for the final package, which includes .exe + .dll + .a and others thinghs (like images) the executable may need. Every time someone asks a build I'll add a folder inside install (named i.e. MyApp-0.1).

No problem until now? Which alternatives may I consider?

anda_skoa
9th August 2014, 20:49
And I'm thinking to add a test folder at same level as include, source, ... for automated unit tests. Inside this test folder there will be one or more ProjectTests.

Very reasonable setup.



And an install folder at the same level as include, source

Not sure you would want your project folder clogged up by that. Like for build I would rather go for an out-of-source approach.



Every time someone asks a build I'll add a folder inside install (named i.e. MyApp-0.1).

Sure why not.

Cheers,
_