cmake build with qt6 (macos) does not include "plugins"
pdv
pdvisschere at edpnet.be
Thu Mar 21 22:21:18 UTC 2024
On 20/03/2024 11:26, Pavel Sanda wrote:
> On Tue, Mar 19, 2024 at 04:02:34PM +0100, pdv wrote:
>> These steps have been added to my previous patch (new patch included) and I
>> also derived the QT_PLUGINS_DIR and QT_LIBRARY_DIRS variables from the
>> existing Qt6_DIR/Qt5_DIR variable, so they must not longer be supplied.
>
> I see there is some very old bug related to osx budles, pehaps it should be closed?
> https://www.lyx.org/trac/ticket/9018
>
>> I only tested this with Qt6.
>
> Unf we are staying out of Qt6 for mac because of serious issues we were not able to solve
> (see bug https://www.lyx.org/trac/ticket/12641 ).
>
> Pavel
That will not be so easy (with cmake).
The signing issue also holds for Qt5.
I've done my homework again.
I realized that my previous solution (although it worked for me) was not
ideal. I can't remember why anymore but for Qt6 I copied just all the
plugins, which of course worked but was ineffective.
It's clear now that (for installing a bundle on macos with cmake) there
is no difference between Qt5 (supposed the version is GTE 5.10) and Qt6.
This makes things much simpler.
But at least with the latest macos tools (Sonoma and XCode15) a bundle
refuses to run if it 's not signed properly.
Both issues are solved with the patch included and have now been tested
with Qt5.15 and Qt6.7.
For completeness: I've checked the font-emph shortcut issue and, as
reported in the ticket mentioned, ^CmdE works with Qt5.15 but not with
Qt6.7. However the sequence ^C E does work. I don't know whether this is
intended as a workaround for this issue or was already implemented.
pdv
-------------- next part --------------
diff --git a/development/cmake/post_install/CMakeLists.txt b/development/cmake/post_install/CMakeLists.txt
index 52a2f782af..b2346cac44 100644
--- a/development/cmake/post_install/CMakeLists.txt
+++ b/development/cmake/post_install/CMakeLists.txt
@@ -26,18 +26,28 @@ if(LYX_BUNDLE)
set(qtplugin_dest_dir "${LYX_BUNDLE_NAME}.app/Contents")
set(qt_conf_path "${LYX_BUNDLE_NAME}.app/Contents/Resources/qt.conf")
endif()
-
- if(Qt5Core_FOUND)
- file(GLOB QT_PLUGIN_DIRECTORIES "${QT_PLUGINS_DIR}/imageformats")
- install(DIRECTORY ${QT_PLUGIN_DIRECTORIES} DESTINATION "${qtplugin_dest_dir}/plugins/" COMPONENT Runtime REGEX "\\_debug\\.dylib$" EXCLUDE)
- if(APPLE)
- if(Qt5Core_VERSION VERSION_GREATER_EQUAL 5.10.0)
- install_qt_plugin("Qt5::QMacStylePlugin")
- endif()
- install_qt_plugin("Qt5::QCocoaIntegrationPlugin")
+
+ if(${LYX_USE_QT} STREQUAL "QT5")
+ set(QtScope "Qt5")
+ elseif(${LYX_USE_QT} STREQUAL "QT6")
+ set(QtScope "Qt6")
+ endif()
+
+ get_target_property( MyLoc "${QtScope}::QSvgPlugin" LOCATION)
+ get_filename_component(MyDir ${MyLoc} PATH)
+ set(QT_PLUGINS_DIR ${MyDir}/..)
+ set(QT_LIBRARY_DIRS ${QT_PLUGINS_DIR}/../lib)
+
+ file(GLOB QT_PLUGIN_DIRECTORIES "${QT_PLUGINS_DIR}/imageformats")
+ install(DIRECTORY ${QT_PLUGIN_DIRECTORIES} DESTINATION "${qtplugin_dest_dir}/plugins/" COMPONENT Runtime REGEX "\\_debug\\.dylib$" EXCLUDE)
+
+ if(APPLE)
+ if(Qt6Core_FOUND OR (Qt5Core_FOUND AND (Qt5Core_VERSION VERSION_GREATER_EQUAL 5.10.0)))
+ install_qt_plugin("${QtScope}::QMacStylePlugin")
endif()
+ install_qt_plugin("${QtScope}::QCocoaIntegrationPlugin")
endif()
-
+
# Install code does the following:
# - Creates the qt.conf file
# - install the platform specific plugins (with Qt5)
@@ -50,7 +60,13 @@ if(LYX_BUNDLE)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${installed_lyx_path}\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIRS}\")"
COMPONENT Runtime
)
-
+
+ if(APPLE)
+ # fixup_bundle invalidates the codesign, so the app must be signed again.
+ add_custom_target(sign_install WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+ COMMAND /usr/bin/codesign --deep --force --sign "${CPACK_BUNDLE_APPLE_CERT_APP}" "LyX2.4.app" VERBATIM)
+ endif()
+
if (APPLE AND LYX_DMG)
# Setup the disk image layout
install(CODE "
More information about the lyx-devel
mailing list