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. [Solved] QtCreator compile-install order for subdir projects
Forum Updated to NodeBB v4.3 + New Features

[Solved] QtCreator compile-install order for subdir projects

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 3 Posters 5.6k Views 1 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.
  • K Offline
    K Offline
    kortus
    wrote on last edited by
    #1

    Hi,

    I have a simple subdirs projects like:

    @TEMPLATE = subdirs
    CONFIG = ordered

    SUBDIRS = base
    SUBDIRS += depend@

    Every project has a install path and I have added the make install command under the Projects tab.
    When I start a build from QtCreator for this project the following order appears:

    make base

    make depend

    make install base

    make install depend

    As result step 2 (make depend) end with a link error because base.lib is not installed. I have to build base manually and than it is installed and all works. The problem is:

    manually work

    first time depend is linked against the last (not actually) base lib

    Can I change the make order to?

    make base

    make base install

    make depend

    make depend install

    Thanks for every hint solving this problem. I use QtCreator 3.0.0.

    Steffen

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

      Hi,

      Rather than installing your libs every time you build them (and since they are static), you should rather determine a common folder in the build tree where they will be put and use that folder to retrieve them as needed

      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
      • K Offline
        K Offline
        kortus
        wrote on last edited by
        #3

        Hi,

        that is exactly what the install does. It installs the libraries in a common folder. And from there are the libs used. The problem is the generated build-install order from QtCreator. I can click ervery project to build in the right order and everything works fine. But to minimize this clicks I use subdir-projects.

        Another idea?

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

          And its a step you don't need, just use something like

          @DESTDIR = ../lib@

          in your libraries projects so all the resulting lib will go there

          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
          • K Offline
            K Offline
            kortus
            wrote on last edited by
            #5

            Yeah, thats clear, I use this. But I'm not sure what the right method is to start this installation step.

            At the moment I add a new "make install" step in the Build Steps in the Project configuration. And this results in the make call order from my first message.

            I set also the the following variables
            @DEPENDENPATH
            INCLUDEPATH
            LIBS
            DESTDIR@

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

              What I am trying to make you understand is that you don't need that install step if you configure correctly your projects.

              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
              • K Offline
                K Offline
                kortus
                wrote on last edited by
                #7

                Hi, I need this install directory, because in a distributed development environment or when I use the results from a build server. I don't compile all libraries at my computer. From this reason I think it is a good idea to have all used libraries at the same place.

                Solution: The only thing that solves the problem for the moment is to define, that depending libraries are not placed in the same subproject.

                Another question handling subprojects. I can compile one project alone, but when I run the project the make of all other projects in the directory is started, that takes time. How can I stop this?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Attila1983
                  wrote on last edited by
                  #8

                  I have the same problem. The structure of my subprojects is the following:

                  • lib1
                  • lib2
                  • lib3
                  • dependentapp
                  • public (headers, libs)

                  After compiling lib1, lib2, lib3 their public headers and libs should be copied into the public directory. Subsequently the depentdentapp could refer only to the public directory.

                  Is this a standard solution? Do you have any better idea? Thanks!

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kortus
                    wrote on last edited by
                    #9

                    Stupid automatism:-) The solution is so easy. I had in mind the sequence

                    • make
                    • make install

                    Based on that I have created a second make step under Projects::Build Steps. But every Makefile has the dependency to compile first changed files before install.

                    Right Solution: type into the Make arguments of the first Make step the install command, everything is fine. You need one make call only (make install <params>)

                    Attila1983: Do you use the position of the copied header as INCLUDEPATH? That is not a good idea. The reason is that is something wrong you edit the wrong file, because QtCreator point to the copied file.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Attila1983
                      wrote on last edited by
                      #10

                      You were right Kortus with Qt Creator and INCLUDEPATH. Thanks!

                      I have just realized, that its possible to write own INSTALLS commands:

                      public_headers.path = $${PUBLIC_INC_PATH}
                      public_headers.files = $${PUBLIC_HEADERS}
                      INSTALLS += public_headers

                      This can be called with make install_public_headers, weil the generated makefile contains the following line:
                      install_public_headers: first FORCE

                      Would it be possible to remove the dependency to first? I would not like to compile my source files, just to copy them.

                      I tried to override the field public_headers.depends, but it did not work.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kortus
                        wrote on last edited by
                        #11

                        I think you can't remove the dependency in one project. To copy include headers for deployment I would create a own project (CopyIncludes) with the INSTALL commands in it.

                        For all other projects I use the include files directly from the source directory. Here my code snippet to do this:

                        @
                        #global used pri file (global.pri)

                        $$PWD return the position of the global.pri file

                        MY_ROOT_PATH = $$PWD/..

                        the used include paths depends at the used libraries

                        in MY_LIBS, with this we offer the needed header paths

                        only and not all existing

                        MY_BASE_INC = lib1
                        lib2
                        lib3

                        for(inc,MY_LIBS) {
                        MY_LOCAL_SUCCESS = 0
                        contains(MY_BASE_INC, $$inc) {
                        INCLUDEPATH += $${MY_ROOT_PATH}/src/base/$$inc
                        MY_LOCAL_SUCCESS = 1
                        }

                        isEqual(MY_LOCAL_SUCCESS, 0) {
                        error("'"$$inc"' :this library is unknown at the build environment")
                        }
                        }@

                        Thats the part for all libraries located in src/base and the project pro file has the variable MY_LIBS to set. This information is also used to add the library paths.

                        @
                        MY_LIBS = lib1 lib2
                        @

                        Hope that helps, I have spent a long time to create a build environment with minimal effort for new projects.

                        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