Results 1 to 6 of 6

Thread: Set of Directories for a Project

  1. #1
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Set of Directories for a Project

    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 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?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Set of Directories for a Project

    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.

  3. The following user says thank you to anda_skoa for this useful post:

    vrltwe (9th August 2014)

  4. #3
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set of Directories for a Project

    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?

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Set of Directories for a Project

    Sounds reasonable.

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

    Cheers,
    _

  6. The following user says thank you to anda_skoa for this useful post:

    vrltwe (9th August 2014)

  7. #5
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set of Directories for a Project

    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?

  8. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Set of Directories for a Project

    Quote Originally Posted by vrltwe View Post
    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.

    Quote Originally Posted by vrltwe View Post
    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.

    Quote Originally Posted by vrltwe View Post
    Every time someone asks a build I'll add a folder inside install (named i.e. MyApp-0.1).
    Sure why not.

    Cheers,
    _

Similar Threads

  1. Meaning of ':' in Qt directories
    By mchome in forum Newbie
    Replies: 1
    Last Post: 11th August 2012, 22:43
  2. Return number of directories in a directories
    By franco.amato in forum Newbie
    Replies: 7
    Last Post: 30th September 2010, 00:29
  3. Adding directories to resources
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2008, 13:00
  4. qtopiamake bug when same name file under different directories
    By izico in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th October 2007, 20:02
  5. How to create directories??
    By paranoid_android in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2006, 17:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.