Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building 3rd party library before own project
QtWS25 Last Chance

Building 3rd party library before own project

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmakenmakevisual studio3rd partylibtiff
7 Posts 4 Posters 3.6k Views
  • 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.
  • B Offline
    B Offline
    Bart_Vandewoestyne
    wrote on 13 Jul 2016, 09:56 last edited by
    #1

    One of the projects I'm working on, uses LibTIFF as an svn:external library (http://www.remotesensing.org/libtiff/). We want to build LibTIFF ourselves and integrate that in our project's build process. Thus, before we can build our own source code and link with the LibTIFF library, we first need to build LibTIFF. According to the build instructions for Windows on http://www.remotesensing.org/libtiff/build.html#PC, all we have to do is

    cd %LIBTIFF_DIRECTORY%
    nmake /f makefile.vc clean
    nmake /f makefile.vc
    

    Our project uses qmake to generate the Visual Studio project files, and then Msbuild to start the build. How can we make sure LibTIFF is built first? I assume we need to specify something in the qmake .pro file of our project? How is this typically handled?

    R 1 Reply Last reply 13 Jul 2016, 10:06
    0
    • B Bart_Vandewoestyne
      13 Jul 2016, 09:56

      One of the projects I'm working on, uses LibTIFF as an svn:external library (http://www.remotesensing.org/libtiff/). We want to build LibTIFF ourselves and integrate that in our project's build process. Thus, before we can build our own source code and link with the LibTIFF library, we first need to build LibTIFF. According to the build instructions for Windows on http://www.remotesensing.org/libtiff/build.html#PC, all we have to do is

      cd %LIBTIFF_DIRECTORY%
      nmake /f makefile.vc clean
      nmake /f makefile.vc
      

      Our project uses qmake to generate the Visual Studio project files, and then Msbuild to start the build. How can we make sure LibTIFF is built first? I assume we need to specify something in the qmake .pro file of our project? How is this typically handled?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 13 Jul 2016, 10:06 last edited by raven-worx
      #2

      @Bart_Vandewoestyne

      Build order:

      TEMPLATE = subdirs
      SUBDIRS = lib app
      CONFIG += ordered
      app.depends = lib
      

      see this for adding custom commands to qmake

      But be aware that the vcxproj conversion of qmake isn't actively developed anymore. So this may produce some faulty projects in some cases.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      B 1 Reply Last reply 13 Jul 2016, 10:36
      1
      • R raven-worx
        13 Jul 2016, 10:06

        @Bart_Vandewoestyne

        Build order:

        TEMPLATE = subdirs
        SUBDIRS = lib app
        CONFIG += ordered
        app.depends = lib
        

        see this for adding custom commands to qmake

        But be aware that the vcxproj conversion of qmake isn't actively developed anymore. So this may produce some faulty projects in some cases.

        B Offline
        B Offline
        Bart_Vandewoestyne
        wrote on 13 Jul 2016, 10:36 last edited by
        #3

        @raven-worx said:

        TEMPLATE = subdirs
        SUBDIRS = lib app
        app.depends = lib
        

        Isn't this a solution for when lib also has a .pro file? In my case (LibTIFF from http://www.remotesensing.org/libtiff/) does not have a qmake .pro file. Instead of starting to write my own .pro file for LibTIFF, I prefer to use the recommended nmake build instructions from their website (http://www.remotesensing.org/libtiff/build.html#PC):

        nmake /f makefile.vc clean
        nmake /f makefile.vc
        

        see this for adding custom commands to qmake

        Perhaps I also should've mentioned that we're currently still stuck with Qt 4.8.7, but on http://doc.qt.io/qt-4.8/qmake-environment-reference.html#customizing I see that QMAKE_EXTRA_TARGETS is also supported in 4.8.7. So I guess QMAKE_EXTRA_TARGETS is the way to go here?

        R 1 Reply Last reply 13 Jul 2016, 10:48
        0
        • B Bart_Vandewoestyne
          13 Jul 2016, 10:36

          @raven-worx said:

          TEMPLATE = subdirs
          SUBDIRS = lib app
          app.depends = lib
          

          Isn't this a solution for when lib also has a .pro file? In my case (LibTIFF from http://www.remotesensing.org/libtiff/) does not have a qmake .pro file. Instead of starting to write my own .pro file for LibTIFF, I prefer to use the recommended nmake build instructions from their website (http://www.remotesensing.org/libtiff/build.html#PC):

          nmake /f makefile.vc clean
          nmake /f makefile.vc
          

          see this for adding custom commands to qmake

          Perhaps I also should've mentioned that we're currently still stuck with Qt 4.8.7, but on http://doc.qt.io/qt-4.8/qmake-environment-reference.html#customizing I see that QMAKE_EXTRA_TARGETS is also supported in 4.8.7. So I guess QMAKE_EXTRA_TARGETS is the way to go here?

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 13 Jul 2016, 10:48 last edited by
          #4

          @Bart_Vandewoestyne said:

          Isn't this a solution for when lib also has a .pro file? In my case (LibTIFF from http://www.remotesensing.org/libtiff/) does not have a qmake .pro file. Instead of starting to write my own .pro file for LibTIFF, I prefer to use the recommended nmake build instructions from their website (http://www.remotesensing.org/libtiff/build.html#PC):

          thats why i posted the link which shows you how to add a custom build command to call your makefile

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          B 1 Reply Last reply 13 Jul 2016, 11:27
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on 13 Jul 2016, 10:55 last edited by
            #5

            Hi! There is also a wiki article on this, see: https://wiki.qt.io/SUBDIRS_-_handling_dependencies. Getting this right (at least with Qt 4 and MSVC) seems to be a bit messy.

            1 Reply Last reply
            0
            • R raven-worx
              13 Jul 2016, 10:48

              @Bart_Vandewoestyne said:

              Isn't this a solution for when lib also has a .pro file? In my case (LibTIFF from http://www.remotesensing.org/libtiff/) does not have a qmake .pro file. Instead of starting to write my own .pro file for LibTIFF, I prefer to use the recommended nmake build instructions from their website (http://www.remotesensing.org/libtiff/build.html#PC):

              thats why i posted the link which shows you how to add a custom build command to call your makefile

              B Offline
              B Offline
              Bart_Vandewoestyne
              wrote on 13 Jul 2016, 11:27 last edited by
              #6

              @raven-worx said:

              @Bart_Vandewoestyne said:

              Isn't this a solution for when lib also has a .pro file? In my case (LibTIFF from http://www.remotesensing.org/libtiff/) does not have a qmake .pro file. Instead of starting to write my own .pro file for LibTIFF, I prefer to use the recommended nmake build instructions from their website (http://www.remotesensing.org/libtiff/build.html#PC):

              thats why i posted the link which shows you how to add a custom build command to call your makefile

              Following the explanation on http://doc.qt.io/qt-4.8/qmake-environment-reference.html#customizing I am currently trying this in my .pro file:

              buildLibTIFF.target = .buildLibTIFF
              buildLibTIFF.commands += cd /some/path/to/ThirdParty/LibTIFF
              buildLibTIFF.commands += nmake /f Makefile.vc
              QMAKE_EXTRA_TARGETS += buildLibTIFF
              PRE_TARGETDEPS += .buildLibTIFF
              

              but LibTIFF doesn't get built. Note that we're using Qt 4.8.7 and msbuild 4.6.1055.0 (the one that comes with Visual Studio 2012).

              I'm not sure if it has to do with this, but in the documentation for the PRE_TARGETDEPS variable in Qt 4.8 at http://doc.qt.io/qt-4.8/qmake-variable-reference.html#pre-targetdeps I find

              Some backends do not support this, these include MSVC Dsp, and ProjectBuilder .pbproj files

              but in the documentation for PRE_TARGETDEPS in Qt 5 at http://doc.qt.io/qt-5/qmake-variable-reference.html#pre-targetdeps Visual Studio is explicitly mentioned:

              Some backends, such as the generators for Visual Studio and Xcode project files, do not support this variable.

              I'm stuck at this point :-(

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 13 Jul 2016, 21:54 last edited by
                #7

                Hi,

                A bit off topic but why not use the libtiff bundled with Qt ? That could avoid you the trouble having to build an external version of it. Unless you absolutely need that specific version.

                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

                7/7

                13 Jul 2016, 21:54

                • Login

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