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. More thorough tutorials/examples for subdirs projects?
Forum Updated to NodeBB v4.3 + New Features

More thorough tutorials/examples for subdirs projects?

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 2 Posters 2.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.
  • W Offline
    W Offline
    wrosecrans
    wrote on last edited by
    #1

    I have recently started playing with 'TEMPLATE = subdirs' in my project file, but this seems to be a bit sparsely documented. Basically, my goal is to build one or more shared libraries, some tests, and an application which depends on the shared libraries, deploy everything into the right spot, and easily let me run/debug my application. Eventually, I also want to include automating some SWIG stuff for generating python bindings to my shared library as part of the automatic build process.

    I have found some trivial examples, which build a simple library, but automatically put it in a spot that is easy to link to the application is quite a bit of extra work. At the moment, I am hard coding library paths and names on Linux and Windows, and it sort of works on Windows. But, while I have gotten it to link on Linux, the dynamic linker doesn't look in the local directory at run time, so I can't run the app from the IDE. If I set LD_LIBRARY_PATH=. I can run the app from a shell, but that's obviously not ideal.

    Is there any sort of end-to-end tutorial that covers best practices for this sort of 'advanced' qmake usage? Or some repository of good example projects for how to do these things? Qmake seems quite powerful, but once you get off the beaten path, it seems to become quite mysterious...

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Not exactly a tutorial, but feel free to take a look at my spdr project: "link":https://github.com/sierdzio/spdr.

      Does exactly what you want to achieve: there is a library (libspdr) that is being linked to some apps (CLI and GUI) and tests.

      Especially take a look at libraryincludes.pri file and definitions.pri file: they are used throughout my project. You can open the main .pro in Qt Creator and it should work out of the box (just remember to turn of shadow builds).

      (Z(:^

      1 Reply Last reply
      1
      • W Offline
        W Offline
        wrosecrans
        wrote on last edited by
        #3

        Thanks for this. I haven't had a chance to fully dig into you example as I've been dealing with some other projects, but I am looking forward to making some time this week. Much appreciated.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wrosecrans
          wrote on last edited by
          #4

          So, I did eventually convert my application to generating a few shared libraries, with an app and tests that depend on them. It's pretty sweet. (Haven't tried to build on Windows since I refactored it. I probably have some import/export nonsense to deal with there, but it should be manageable.) But, losing shadow builds is a bit of a bummer. Have you looked at this?

          http://qt-project.org/doc/qt-5/qmake-function-reference.html#shadowed-path

          I think my next step will be to try using that to get the .pro files working with shadow building again, even with the shared lib generation. Slowly piecing it all together. I think I'll finally have qmake figured out just in time for it to be deprecated in favor of qbs...

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Ha, I did not know about shadowed() function, it sure looks useful! Thanks :-)

            (Z(:^

            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