Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT Creator / qmake project organization question

QT Creator / qmake project organization question

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 3 Posters 556 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DL5EU
    wrote on last edited by
    #1

    Dear all,

    I have got a master project that is composed of several projects in two groups. My problem is that the dependencies are not always respected as I expect.

    The structure in Qt Creator spans three levels and is as follows:

    Master
    Master.pro
    +---Group1
    |   Group1.pro
    |   +---Project1
    |   |   Project1.pro
    |   +---Helper
    |       Helper.pro
    +---Group2
        Group2.pro
        +---Project1
        |   Project1.pro
        +---Helper
        |   Helper.pro
        +---Common
            Common.pro
    
    Master.pro:
    TEMPLATE = subdirs
    SUBDIRS += \
        Group1 \
        Group2
    Group1.depends = Group2
    
    Group1.pro:
    TEMPLATE = subdirs
    SUBDIRS += \
        Project1 \
        Helper
    Project1.depends = Helper
    
    Project1.pro (in Group1):
    Project1.depends = Helper
    
    Helper.pro (in Group1):
    TEMPLATE = lib
    CONFIG += staticlib
    
    Group2.pro:
    TEMPLATE = subdirs
    SUBDIRS += \
        Project1 \
        Helper \
        Common
    Helper.depends = Common
    Project1.depends = Helper Common
    
    Project1.pro (in Group2):
    TEMPLATE = lib
    DEFINES += PROJECT1_LIBRARY
    Project1.depends = Helper Common
    
    Helper.pro (in Group2):
    TEMPLATE = lib
    CONFIG += staticlib
    Helper.depends = Common
    
    Common.pro:
    TEMPLATE = lib
    CONFIG += staticlib
    

    My questions are:

    1. Is it possible to have a project organization with more than two levels (e.g. main project, project groups and individual projects in the groups)?

    2. When I change something in Group2/Common and build Group1/Project1, the changes are not taken into account although I have specified in Master.pro that Group1 depends on Group2 and in Group2.pro that Group2/Project1 depends on Group2/Common. Why is this so? Does the dependency check only work top -> down, i.e. when I build the master project?

    3. Is it possible that the mixture of dynamic and static libraries causes the problem? I need both (dynamic libraries that can be called by other programs and static libraries with common methods, GUI elements and so on that I would like to link to the GUI applications)?

    4. How would you organize the project that is currently composed of a master project and two groups, where one group contains the GUI applications and the other one the dynamic libraries (that can also be called from other programs)?

    I am currently using Qt Creator 4.15.1 and Qt 5.15.2 (open source version) on Windows 10.

    Thank you very much for your help!

    Kind regards,

    Ralf

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      1. Sure you can, Qt is a perfect example of that.
      2. Can you show an example of project that shows that issue ? If you properly set all dependencies it should build in order.
      3. Yes you can, do not forget to use PRE_TARGETDEPS when linking to your static libraries.
      4. You can have one group that are the application which contains the bare minimum and then a second group which will contain all the libraries of your applications.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        I did experiment with Qt "SUB_DIR" and found the dependencies and level relations hard to manage. I think good knowledge of "make" / qmake and how it relates to (C) code is mandatory. And learning "make" was not part of my goal during my project.
        I have ditched "SUB_DIRS" and found that I can manage the "subprojects" without it.
        If you can - I would recommend to build sort of dummy skeleton / frame of all all your sub projects and then gradually replace then with real code.
        73 es 55

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DL5EU
          wrote on last edited by
          #4

          Hello SGaist and AnneRanch,

          thank you very much for the answers.

          I had not specified PRE_TARGETDEPS but when I add this I get the error message "Multiple target patterns. Stop.". I will setup a small project structure (and not all at once) and make tests to see how it works exactly.

          Kind regards,

          Ralf

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DL5EU
            wrote on last edited by
            #5

            Dear all,

            @SGaist said in QT Creator / qmake project organization question:

            do not forget to use PRE_TARGETDEPS when linking to your static libraries.

            I suppose this is a typical newbie problem. Not all things are done automagically :-) Of course I had not specified this variable and after adding it the problem was solved.

            Thanks again for your help.

            Kind regards,

            Ralf

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved