Results 1 to 6 of 6

Thread: qmake: dependency of application on common shared library

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qmake: dependency of application on common shared library

    Hello,

    Thanks again for your idea. However, I do not fully agree with this approach as the library pushes the output to its "clients", so it has to know by whom it is being used. This would be like the model has to know about its views in a model/view paradigm.

    Another issue is, if you are only interested in one leaf project and the parent project (library) it depends on, you need to compile the top level project, which would compile all leaf projects.

    In my opinion, it should be the other way round. If an application requires a library, it should pull it in, even if it means to copy necessary files into the project.

    I tried to add an additional build step for the project setting where I copy the .dll from the library path (debug|release) into the respective application build dir. However, it did not work under Windows.

    Still searching for a proper solution.
    peter

  2. #2
    Join Date
    Feb 2009
    Posts
    29
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake: dependency of application on common shared library

    I'm working in a similar issue though I didn't use Qt Creator.

    I have a library stored in one path in Subversion. It's currently being brought into to my project via SVN's externals - but that's beside the point here. Needless to say, it's a shared set of static libraries that multiple applications will be using. Each project it gets brought into needs to ensure that it (or its respective subprojects) get built before the project itself is built. The structure is basically as follows

    Qt Code:
    1. application\
    2. application.pro
    3. application.sln
    4. application.vcproj
    5. deps\
    6. lib\
    7. lib.debug\
    8. include\
    9. src\
    10. src.pro
    11. <subproject>\
    12. <subproject>.pro
    13. <subproject files>
    To copy to clipboard, switch view to plain text mode 

    The src.pro uses the 'subdirs' template, and each project under it puts its output (static library and PRL file) into lib or lib.debug (for release and debug builds respectively). I find this works very well as then the application only has to know about one (or two) places for linking.

    I do, however, have the same problem - I want the application to be able to build the static libraries it needs by simply adding something to the application's project file (e.g. application.pro). Thus far I have tried:

    Qt Code:
    1. include (deps/src/src.pro)
    To copy to clipboard, switch view to plain text mode 

    However, that doesn't seem to work and I have to manually run the library build before the applications build. This is complicated by having to support both VS and Qmake/Make (under Linux).

    Further, I have numerous static libraries being generated and it'd be nice to be able to only build what I actually need and use.

    Per working directly Qt via Visual Studios, I found the following to be helpful to run from a 'build' directory in parallel to the 'src' directory for the shared libraries:

    Qt Code:
    1. $ qmake -tp vc -r ../src/src.pro
    To copy to clipboard, switch view to plain text mode 

    This generates the required solutions and project files, but requires that anyone modifying the qmake project files also update the solutions/projects by re-running this command when they're done and committing the results into source control. Fortunately it can be run on Windows _or_ other systems (e.g. Linux) (Okay for now, but not good as a long term solution.)

    As the OP stated - we need to be able to build the dependency. Using the SUBDIR template for the application doesn't seem like a solution - since it would require an entirely different application source layout that just doesn't make sense for the project - I don't need two directories for what could be accomplished in one.

    Scripting is problematic as there would have to be a script for Windows and a script for everything else.

    I think QMake could easily resolve this solution - whether it already does (if so how?) or by modification to do so. Something like the include solution would be great.

    In reading through the docs, the 'features' solution sounds like a good possibility, but it doesn't seem like Qt supports having features in sub-projects in this manner.

Similar Threads

  1. Replies: 11
    Last Post: 18th May 2007, 10:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.