Skip to content

Commit

Permalink
Add PLUGINDIR cmake setting and define #7027
Browse files Browse the repository at this point in the history
By default, plugins are only searched next to the binary or next to the
other Qt plugins. This optional build variable allows another path to be
configured.

The idea is that on linux the oC packaging probably wants the binary in
something like /opt/owncloud/bin and the plugins in
/opt/owncloud/lib/plugins.

Similarly, distribution packagers probably don't want the plugins next
to the binary or next to the other Qt plugins. This flag allows them to
configure another path that the executable will look in.
  • Loading branch information
ckamm committed Mar 13, 2019
1 parent 6b467ac commit 150d2aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if(WIN32)
set(DATADIR "share")
endif(WIN32)
set(SHAREDIR ${DATADIR})
set(PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}/plugins" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.")

#####
## handle BUILD_OWNCLOUD_OSX_BUNDLE
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@

#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
#cmakedefine SHAREDIR "@SHAREDIR@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"

#endif
11 changes: 11 additions & 0 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ Application::Application(int &argc, char **argv)
if (!AbstractNetworkJob::httpTimeout)
AbstractNetworkJob::httpTimeout = cfg.timeout();

#ifdef PLUGINDIR
// Setup extra plugin search path
QString extraPluginPath = QStringLiteral(PLUGINDIR);
if (!extraPluginPath.isEmpty()) {
if (QDir::isRelativePath(extraPluginPath))
extraPluginPath = QDir(QApplication::applicationDirPath()).filePath(extraPluginPath);
qCInfo(lcApplication) << "Adding extra plugin search path:" << extraPluginPath;
addLibraryPath(extraPluginPath);
}
#endif

// Check vfs plugins
if (Theme::instance()->showVirtualFilesOption() && bestAvailableVfsMode() == Vfs::Off) {
qCWarning(lcApplication) << "Theme wants to show vfs mode, but no vfs plugins are available";
Expand Down
4 changes: 2 additions & 2 deletions src/libsync/vfs/suffix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set_target_properties("${synclib_NAME}_vfs_suffix" PROPERTIES
)

INSTALL(TARGETS "${synclib_NAME}_vfs_suffix"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/plugins"
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}/plugins"
LIBRARY DESTINATION "${PLUGINDIR}"
RUNTIME DESTINATION "${PLUGINDIR}"
)

0 comments on commit 150d2aa

Please sign in to comment.