MantisBT - CMake
View Issue Details
0011145CMakeModulespublic2010-08-18 07:202011-05-02 14:45
Mike McQuaid 
Clinton Stimpson 
normalminoralways
closedfixed 
CMake-2-8 
 
0011145: FindQt4 doesn't provide plugin variables
It would be good if FindQt4 looked for the various plugins that can be installed with Qt and gave the path to them (both release and debug versions) and searched using the various filenames that are possible.

I'd suggest providing variables like:
QT_SQLITE_PLUGIN_LIBRARY_RELEASE

In addition, it would be good if these variables pointed to the DLLs on Windows, rather than the LIB files, as the plugins would only be used for installation. Also, it would be even better if there was a simplified way to install the plugins and know what directory they should go to, as obviously GetPrerequisites cannot help with this.

For example:
INSTALL(FILES ${QT_SQLITE_PLUGIN_LIBRARY_RELEASE} DESTINATION ${QT_SQLDRIVERS_DIRECTORY} )
where QT_SQLDRIVERS_DIRECTORY is something like "plugins/sqldrivers"

Let me know if any patches for this would be accepted and I can write one if so.

Thanks!
No tags attached.
patch 0001-Add-support-to-FindQt4-for-finding-Qt-plugins.patch (3,457) 2010-12-13 07:09
https://public.kitware.com/Bug/file/3567/0001-Add-support-to-FindQt4-for-finding-Qt-plugins.patch
Issue History
2010-08-18 07:20Mike McQuaidNew Issue
2010-08-18 19:27Clinton StimpsonNote Added: 0021813
2010-08-19 03:34Mike McQuaidNote Added: 0021820
2010-08-19 04:45Mike McQuaidNote Added: 0021825
2010-08-19 09:34Clinton StimpsonNote Added: 0021839
2010-08-19 10:00Mike McQuaidNote Added: 0021842
2010-12-13 07:09Mike McQuaidFile Added: 0001-Add-support-to-FindQt4-for-finding-Qt-plugins.patch
2010-12-13 07:12Mike McQuaidNote Added: 0023918
2010-12-13 07:13Mike McQuaidNote Edited: 0023918bug_revision_view_page.php?bugnote_id=23918#r46
2010-12-15 11:39David ColeAssigned To => Clinton Stimpson
2010-12-15 11:39David ColeStatusnew => assigned
2011-01-01 20:18Clinton StimpsonNote Added: 0024352
2011-01-01 20:18Clinton StimpsonStatusassigned => resolved
2011-01-01 20:18Clinton StimpsonResolutionopen => fixed
2011-05-02 14:45David ColeNote Added: 0026301
2011-05-02 14:45David ColeStatusresolved => closed

Notes
(0021813)
Clinton Stimpson   
2010-08-18 19:27   
Also to consider is the case of using the Qt plugin .lib files if Qt is a static build. Currently there is no support for that, and no one has asked for it yet.
See: http://doc.trolltech.com/4.2/plugins-howto.html#static-plugins [^]
So something like QT_SQLITE_PLUGIN_LIBRARY_RELEASE should point to the .lib file.

I'm wondering if a deploy macro would be suitable. Where one passes in the modules being used (QtSql, QtGui, etc...) and it copies the plugins to a given location with the correct layout. One can compare this macro to code found in macdeployqt.
What do people normally do with Qt apps built by qmake on non-Mac systems?
(0021820)
Mike McQuaid   
2010-08-19 03:34   
Yep, the static files would be a good point too.

A deploy macro sounds like exactly what I want, supporting all three platforms using the Qt deployment guides. They should also provide scope for creating a qt.conf file on OSX (which is pretty easy really) and installing all the needed plugins. The rest can be handled by BundleUtilities (once http://public.kitware.com/Bug/view.php?id=10417 [^] is fixed too). On Linux, you could also perhaps create a script which will set LD_LIBRARY_PATH correctly.

For non-Mac systems, you just need to remember to install the plugins manually to the correct location and decide whether or not you need any other runtime libraries. However, in the Qt projects I've worked on, the main problem is finding the plugins and knowing which ones need to be installed.

Another suggestion for this is that it could be done just at the packaging stage, rather than the install stage, using my suggestions in http://public.kitware.com/Bug/view.php?id=11142 [^] .

Let me know your thoughts and what I can do to help. I'd really like to get deploying Qt applications on Windows/Mac/Linux using CPack to be as easy as possible, ideally a one-liner. I think quite a lot of people use CMake with Qt so making deployment as easy (or easier) than with QMake would be really useful to getting CPack more widely used.
(0021825)
Mike McQuaid   
2010-08-19 04:45   
Having a look at the source/output of macdeployqt, it looks like it just installs all the relevant plugins for a module when it installs the plugin. Considering all the plugins are, uncompressed, 3MB on OSX, this probably isn't a bad idea.

http://public.kitware.com/Bug/view.php?id=11126 [^] is probably relevant to the discussion here.
(0021839)
Clinton Stimpson   
2010-08-19 09:34   
I'd leave the script/LD_LIBRARY_PATH thing to the user. If its installed with a prefix of /usr, a script isn't always necessary.
If the user does something like this:
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  set(CMAKE_INSTALL_RPATH "\$ORIGIN")
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
then a script isn't necessary.

Can you try this:
http://www.cmake.org/Wiki/BundleUtilitiesExample [^]

Then think about how you want that to be simpler.
(0021842)
Mike McQuaid   
2010-08-19 10:00   
I'll slightly repeat myself from the other bug (http://public.kitware.com/Bug/view.php?id=11126 [^]) but here goes:
- That RPATH stuff should be automatic on Linux or at least an option
- Various plugin-related functionality to get the install directory, setup a qt.conf file and get the paths to the plugins to install should be available, possibly using the macdeployqt style of just installing the plugins relevant to each module used
- You should be able to do this stuff only at package-time rather than install-time, as an option
- There should be a function to do all the INSTALL(CODE) stuff for you
- The BundleUtilities documentation and naming should be improved
(0023918)
Mike McQuaid   
2010-12-13 07:12   
(edited on: 2010-12-13 07:13)
I attached an initial patch for this. It's tested on OSX and Windows with dynamic plugins. Adding static plugins and Linux support should be trivial, if they don't work already.

Can you please review this patch and let me know if I need to fix the other platforms/static plugins before this would be merged.

This would be the first step to having a CMake-equivalent of macdeployqt, something that can trivially deploy a Qt application.

Thanks!

(0024352)
Clinton Stimpson   
2011-01-01 20:18   
Support for static/dynamic plugins has been added to FindQt4.cmake, and pushed into the next branch in the git repository.

Also new macros for deploying Qt plugins have been added, such as qt4_deploy_default_plugins()

Please give it a try and provide feedback.

To use static plugins, one does:
add_executable(testqt main.cpp)
target_link_libraries(testqt ${QT_QGIF_LIBRARY})
target_link_libraries(testqt ${QT_LIBRARIES})
with a Q_IMPORT_PLUGIN(qgif) in the code somewhere.


To use the plugin deploy stuff, one could do:
include(CPack)
install(TARGETS testqt DESTINATION bin)
qt4_deploy_default_plugins(bin/plugins)
(0026301)
David Cole   
2011-05-02 14:45   
Closing resolved issues that have not been updated in more than 3 months.