From 626ea031ec7a09302338f823726d5bdeebc3d7d2 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 15 Mar 2019 13:56:11 +0100 Subject: [PATCH] macOS: Fix vfs suffix plugin paths #7090 --- CMakeLists.txt | 8 +++++++- admin/osx/macdeployqt.py | 3 +++ src/libsync/vfs/suffix/CMakeLists.txt | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d136703d5..bb19880dba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,13 @@ if(WIN32) set(DATADIR "share") endif(WIN32) set(SHAREDIR ${DATADIR}) -set(PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${APPLICATION_SHORTNAME}/plugins" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.") + +if (NOT APPLE) + set(PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${APPLICATION_SHORTNAME}/plugins" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.") +else() + # Inside the .app bundle + set(PLUGINDIR "../PlugIns" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.") +endif() ##### ## handle BUILD_OWNCLOUD_OSX_BUNDLE diff --git a/admin/osx/macdeployqt.py b/admin/osx/macdeployqt.py index 79da782f7c..94658b00f7 100755 --- a/admin/osx/macdeployqt.py +++ b/admin/osx/macdeployqt.py @@ -405,6 +405,9 @@ if LooseVersion(qt_version) >= LooseVersion("5.10.0"): for plugin in QT_PLUGINS: FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin)) +# The FixPlugin function is actually for Qt plugins, but for now we abuse it for our own plugin +FixPlugin(bundle_dir+'/Contents/PlugIns/owncloudsync_vfs_suffix.dylib', '') + if LooseVersion(qt_version) >= LooseVersion("5.10.0"): args = ['plutil', '-insert', 'LSMinimumSystemVersion', '-string', '10.10.0', os.path.join(bundle_dir, 'Contents', 'Info.plist')] commands.append(args) diff --git a/src/libsync/vfs/suffix/CMakeLists.txt b/src/libsync/vfs/suffix/CMakeLists.txt index 28699dccfa..3765e02855 100644 --- a/src/libsync/vfs/suffix/CMakeLists.txt +++ b/src/libsync/vfs/suffix/CMakeLists.txt @@ -13,8 +13,22 @@ set_target_properties("${synclib_NAME}_vfs_suffix" PROPERTIES AUTOMOC TRUE ) +if(APPLE) + # for being loadable when client run from build dir + set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/") + set_target_properties("${synclib_NAME}_vfs_suffix" + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} + RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} + ) + # For being lodable when client run from install dir (after make macdeployqt) + set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") +else() + set(vfs_installdir "${PLUGINDIR}") +endif() + INSTALL(TARGETS "${synclib_NAME}_vfs_suffix" - LIBRARY DESTINATION "${PLUGINDIR}" - RUNTIME DESTINATION "${PLUGINDIR}" + LIBRARY DESTINATION "${vfs_installdir}" + RUNTIME DESTINATION "${vfs_installdir}" )