]> git.lyx.org Git - lyx.git/commitdiff
Cmake build wit qt(5|6)(macos) did not include "plugins"
authorPatrick de Visschere <pdvisschere@edpnet.be>
Sat, 23 Mar 2024 10:25:27 +0000 (11:25 +0100)
committerKornel Benko <kornel@lyx.org>
Sat, 23 Mar 2024 10:28:31 +0000 (11:28 +0100)
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.

development/cmake/post_install/CMakeLists.txt

index 52a2f782afc943a06ba06ac9e4a92a2519811321..f39bb5a763ad760729e70b39be39ef6f6d0a09a6 100644 (file)
@@ -27,15 +27,25 @@ if(LYX_BUNDLE)
         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:
@@ -47,16 +57,22 @@ if(LYX_BUNDLE)
                     file(GLOB_RECURSE QTPLUGINS
                     \"\${CMAKE_INSTALL_PREFIX}/${qtplugin_dest_dir}/plugins/*/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
                     message(STATUS \"QT plugins [\${CMAKE_INSTALL_PREFIX}/${qtplugin_dest_dir}/plugins/*/*${CMAKE_SHARED_LIBRARY_SUFFIX}]: \${QTPLUGINS}\")
-                    fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${installed_lyx_path}\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIRS}\")" 
+                    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 "
             message(STATUS \"Creating the folder view options (.DS_Store)\")
             execute_process(COMMAND /bin/ln -sf /Applications \"\${CMAKE_INSTALL_PREFIX}\")
-            execute_process(COMMAND /bin/bash \"${CMAKE_CURRENT_SOURCE_DIR}/../../MacOSX/set_bundle_display_options.sh\" 
+            execute_process(COMMAND /bin/bash \"${CMAKE_CURRENT_SOURCE_DIR}/../../MacOSX/set_bundle_display_options.sh\"
             \"${CMAKE_BINARY_DIR}/ds_store\" \"${_lyx}\" \"${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png\" 560 364)
         ")
     endif()