Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Manual make install step for static libraries with a .pro file
Forum Updated to NodeBB v4.3 + New Features

Manual make install step for static libraries with a .pro file

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
12 Posts 3 Posters 3.2k 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.
  • R Offline
    R Offline
    Rubin Stove
    wrote on last edited by
    #1

    Hello,

    I have static library which is being used in an app. The app is a qt app & I building the library using qt as well. The library has a .pro. I am testing it on ios & android.

    Currently I build the library to a different build directory. The build directory needs to primarily contain the .a & the library header. The header is the interface of the library as it is the convention. I wrote an install rule in my library.pro to copy the header to the build directory every-time the library is built. This copy step is working.

    But here is the problem. I had to include a make install step in my project settings to run this extra build step. This something manual. If 10 more developers are using my library then they all have to add this manual step for make install in their project settings. I want to eliminate this manual step so that when a developer imports the library, he just clicks "build" on his qt creator without having to manually add this make install step in his project setting in qt creator. Is it possible to do so ? If yes, then can someone please tell the way to do it ?

    Thanks in advance for any suggestions..

    1 Reply Last reply
    0
    • SeeLookS Offline
      SeeLookS Offline
      SeeLook
      wrote on last edited by
      #2

      In my app I solved that in such a way:

      • I'm keeping compiled static libraries of fftw and ogg in sub-folders of my library source directory
      • .pro file of library that links to them contains the following:
      android {
        INCLUDEPATH += fftw
      
        contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
          LIBS += -Bstatic -L$$PWD/fftw/armv7/ -lfftw3f -L$$PWD/ogg/armv7/ -loggstatic -Bdynamic
        }
      
        contains(ANDROID_TARGET_ARCH,x86) {
          LIBS += -Bstatic -L$$PWD/fftw/x86/ -lfftw3f -L$$PWD/ogg/x86/ -loggstatic -Bdynamic
        }
      

      I hope this example will help You.

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

        Hi,

        Is that static library part of your main Qt Project ? e.g. as a subdir

        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
        • SeeLookS Offline
          SeeLookS Offline
          SeeLook
          wrote on last edited by
          #4

          Not so directly. ..
          I put the code just as an example of a possible way how to manage such a cases.
          It could be symbolic links or configured variables of qmake with path to compiled lib file.

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

            Sorry @SeeLook, I meant it as a question for the OP :) But I see your point.

            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
            • R Offline
              R Offline
              Rubin Stove
              wrote on last edited by Rubin Stove
              #6

              My static library is not part of my qt app. It is built separately as a static library using qt. My app only uses the static library for certain functionality but it is only dependent on one header file from the library which is the library's API/interface. And this is the header file I want to provide into the build directory as a part of building the static library.

              Imagine a situation where I tell you as my co-developer that you need to use my library as a part of your app. Qt is great to provide the option that I can add a install step detail by using INSTALL += . I am using this to specify my header to be installed as part of the build but I wish to avoid the manual step so that my co-developer does not need add a install step manually to build my library in his qt creator.

              Is there some config or something I can add to my library's .pro which enforces this make install automatically.. Or is there some completely different way to share my static library's header ? Surely should be a way.. aah.. I am sort of new to this

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

                Since that library is also built with Qt, why not make it part of your current project through a git submodule and use the SUBDIR template to build everything together ?

                That way all your co-worker will use the same version of that static library, there's no need to install it and you can easily point your current project to the needed header.

                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
                • R Offline
                  R Offline
                  Rubin Stove
                  wrote on last edited by
                  #8

                  sorry to be late in replying. I am not very sure about the git submodule process. I need to check that out. If this cannot be handled by adding any code to mu library's .pro file, then I would have to look into the git submodule way.
                  May be making the "make install" step automatic is not in the purview of a project .pro file..

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Rubin Stove
                    wrote on last edited by
                    #9

                    http://www.vladislavonline.com/installing-library-header-files-with-qmake/

                    Just to clarify readers, Step # 2 in above link is what I wish my co-developers to omit. So that they don't have to do add "make install" step manually. It should come inherent with the library.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Rubin Stove
                      wrote on last edited by
                      #10

                      I figured this out by some more searching around. QMAKE_POST_LINK does something that I was looking for. We can copy a particular file to the build directory or somewhere else by putting it into QMAKE_POST_LINK. Like I added the following line to my .pro file

                      QMAKE_POST_LINK = cp "mylibrary_header" "destination_directory"

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

                        Again, you are complicating your life for that static library. Integrating it in your current project will avoid your fellows developer to have to build and install it before building the application. Also, that will make their life easier if it's also an actively developed library. With the submodule you can ensure that they are getting a version of this library that is known to work with the application. They won't have to check an external library state + rebuild/install.

                        By the way, your current QMAKE_POST_LINK will only work on systems where there's a cp command.

                        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
                        • R Offline
                          R Offline
                          Rubin Stove
                          wrote on last edited by
                          #12

                          Very good points indeed @SGaist. I will take that down. I need to look into how to make it as a git submodule which looks to be much better approach.
                          Thanks for your dude. Appreciate

                          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