From 6ec60b95e9d8e0ee5e5848e0f07eb7ece5f39ae2 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 8 Feb 2022 15:46:45 +0100 Subject: [PATCH] Fully deploy webview (Linux). Note : This is a workaround because of LinuxDeployQt which doesn't do it. Windows fix : - x64 build on Windows. - webview deployment + workaround (Qt plugins need to be in plugins folder alongside bin) --- CMakeLists.txt | 9 +------- linphone-app/CMakeLists.txt | 8 +++++-- .../linphone_package/CMakeLists.txt | 8 ++++++- .../linphone_package/packaging.cmake.in | 4 ++-- linphone-app/tools/create_appimage.sh | 21 ++++++++++++------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8de3b685..76b0e5d23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,14 +38,7 @@ endforeach() if(ENABLE_BUILD_VERBOSE) message("User Args : ${USER_ARGS}") endif() -if(WIN32) - if(NOT ${CMAKE_GENERATOR} MATCHES "Ninja") - if(NOT CMAKE_GENERATOR_PLATFORM) - set(CMAKE_GENERATOR_PLATFORM "Win32") - message(STATUS "Setting Platform to ${CMAKE_GENERATOR_PLATFORM}") - endif() - endif() -elseif( APPLE ) +if( APPLE ) if( NOT CMAKE_OSX_DEPLOYMENT_TARGET) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") endif() diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index 68867c1eb..049310c61 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -96,13 +96,14 @@ if( WIN32) endif() set(CMAKE_INCLUDE_CURRENT_DIR ON)#useful for config.h -set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network Test WebView) +set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network Test WebView WebEngine WebEngineCore) if (UNIX AND NOT APPLE) list(APPEND QT5_PACKAGES DBus) endif () set(QT5_PACKAGES_OPTIONAL TextToSpeech) set(CMAKE_AUTOMOC ON) + find_package(Qt5 COMPONENTS ${QT5_PACKAGES} REQUIRED) find_package(Qt5 COMPONENTS ${QT5_PACKAGES_OPTIONAL} QUIET) @@ -552,7 +553,10 @@ foreach (package ${QT5_PACKAGES}) # `qt5_create_translation` is provided from `LinguistTools` package. # But the `Qt5::LinguistTools` lib does not exist. Remove it. if (NOT (${package} STREQUAL LinguistTools)) - list(APPEND LIBRARIES ${Qt5${package}_LIBRARIES}) + # list(APPEND LIBRARIES ${Qt5${package}_LIBRARIES}) + target_link_libraries(${APP_LIBRARY} Qt5::${package}) + target_link_libraries(${APP_PLUGIN} Qt5::${package}) + target_link_libraries(${TARGET_NAME} Qt5::${package}) endif () endforeach () diff --git a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt index 27c982400..d57790666 100644 --- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt +++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt @@ -34,6 +34,7 @@ if (POLICY CMP0079) endif () set(LINPHONE_QML_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../ui") +set(QT_PATH "${Qt5Core_DIR}/../../..") # ============================================================================== # Build package version. @@ -148,7 +149,10 @@ if (WIN32) RUNTIME DESTINATION "${LIBDIR}" ) - install(CODE "execute_process(COMMAND ${DEPLOYQT_PROGRAM} \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${EXECUTABLE_NAME}.exe\" -qmldir=${LINPHONE_QML_DIR} --compiler-runtime)")# -verbose=2)" COMPONENT binary_application) + install(CODE "execute_process(COMMAND ${DEPLOYQT_PROGRAM} \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${EXECUTABLE_NAME}.exe\" --qmldir=${LINPHONE_QML_DIR} --plugindir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/plugins --compiler-runtime)")# -verbose=2)" COMPONENT binary_application) +#Workaround windeployqt bug on webview plugin : folder "webview" can be in bin/ where it should be in bin/plugins. Else, we got "Webview plugin not found" + + #On Windows, OpenLDAP couldn't be build with static libraries. Add them in installation for deployment. find_program(MSYS2_PROGRAM NAMES msys2_shell.cmd @@ -296,6 +300,8 @@ else()# Not Windows and Apple LIBRARY DESTINATION "${LIBDIR}" RUNTIME DESTINATION "${LIBDIR}" ) +# WEBVIEW + install(FILES "${QT_PATH}/plugins/webview/libqtwebview_webengine.so" DESTINATION "plugins/webview") #Workaround : linuxdeploy doesn't deploy it endif () diff --git a/linphone-app/cmake_builder/linphone_package/packaging.cmake.in b/linphone-app/cmake_builder/linphone_package/packaging.cmake.in index ed0b76d04..f210bef52 100644 --- a/linphone-app/cmake_builder/linphone_package/packaging.cmake.in +++ b/linphone-app/cmake_builder/linphone_package/packaging.cmake.in @@ -63,9 +63,9 @@ if (NOT "${CMAKE_INSTALL_PREFIX}" MATCHES .*/_CPack_Packages/.*) set(ENV QML_MODULES_PATHS="@QML_MODULES_PATHS@") execute_process( COMMAND mkdir -p "WORK/Packages/AppImageDir/" WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/..") execute_process( COMMAND cp -rf "@CMAKE_CURRENT_SOURCE_DIR@/../../ui" "WORK/Packages/AppImageDir/" WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/..") - execute_process( COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh" @EXECUTABLE_NAME@ @CPACK_PACKAGE_FILE_NAME@ @LINPHONE_BUILDER_SIGNING_IDENTITY@ @LINPHONE_BUILDER_SIGNING_PASSPHRASE@ RESULT_VARIABLE CPACK_COMMAND_RESULT WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/.." ) + execute_process( COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh" @EXECUTABLE_NAME@ @CPACK_PACKAGE_FILE_NAME@ @QT_PATH@ @LINPHONE_BUILDER_SIGNING_IDENTITY@ @LINPHONE_BUILDER_SIGNING_PASSPHRASE@ RESULT_VARIABLE CPACK_COMMAND_RESULT WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/.." ) if(CPACK_COMMAND_RESULT) - message(FATAL_ERROR "Failed to create AppImage package with this command : '@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh @EXECUTABLE_NAME@ @APP_PROJECT_VERSION@' at @CMAKE_INSTALL_PREFIX@/..\nMaybe the .appimage already exists and is running. Please remove the file before packaging if it is the case.") + message(FATAL_ERROR "Failed to create AppImage package with this command : '@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh @EXECUTABLE_NAME@ @QT_PATH@ @APP_PROJECT_VERSION@' at @CMAKE_INSTALL_PREFIX@/..\nMaybe the .appimage already exists and is running. Please remove the file before packaging if it is the case.") endif() endif() if (@PERFORM_SIGNING@) diff --git a/linphone-app/tools/create_appimage.sh b/linphone-app/tools/create_appimage.sh index d3399c01b..3fcb2999a 100755 --- a/linphone-app/tools/create_appimage.sh +++ b/linphone-app/tools/create_appimage.sh @@ -22,10 +22,12 @@ # Arguments : # $1 = Executable Name # $2 = Output Filename -# $3 = Key of the code sign (optional but mendatory if code signing) -# $4 = Passphrase of the code sign (Optional) +# $3 = Qt root path (eg. "~/Qt/5.15.2/gcc_64") +# $4 = Key of the code sign (optional but mendatory if code signing) +# $5 = Passphrase of the code sign (Optional) APP_NAME="$1" +QT_PATH="$3" BIN_SOURCE_DIR="OUTPUT/" @@ -45,6 +47,8 @@ rm -rf "${WORK_DIR}/AppDir/usr/lib64" mkdir -p "${WORK_DIR}/AppDir/usr/lib" cp -f "${BIN_SOURCE_DIR}/lib"/libsoci_sqlite3* "${WORK_DIR}/AppDir/usr/lib/" cp -f "${BIN_SOURCE_DIR}/lib"/libapp-plugin* "${WORK_DIR}/AppDir/usr/lib/" +cp -f "${BIN_SOURCE_DIR}/lib64"/libsoci_sqlite3* "${WORK_DIR}/AppDir/usr/lib/" +cp -f "${BIN_SOURCE_DIR}/lib64"/libapp-plugin* "${WORK_DIR}/AppDir/usr/lib/" if [ -d "${BIN_SOURCE_DIR}/lib64/mediastreamer" ]; then mkdir -p "${WORK_DIR}/AppDir/usr/plugins/" @@ -70,11 +74,14 @@ else chmod +x "${WORK_DIR}/AppBin/linuxdeploy-plugin-qt-x86_64.AppImage" fi - +########################################################################################### export QML_SOURCES_PATHS=${QML_SOURCES_PATHS}:${WORK_DIR}/.. +export LD_LIBRARY_PATH=${QT_PATH}/lib +#export EXTRA_QT_PLUGINS=webenginecore;webview;webengine + echo "-- Generating AppDir for AppImage" -if [ -z "$3" ]; then +if [ -z "$4" ]; then ./${WORK_DIR}/AppBin/linuxdeploy-x86_64.AppImage --appdir=${WORK_DIR}/AppDir -e ${WORK_DIR}/AppDir/usr/bin/${APP_NAME} --output appimage --desktop-file=${WORK_DIR}/AppDir/usr/share/applications/${APP_NAME}.desktop -i ${WORK_DIR}/AppDir/usr/share/icons/hicolor/scalable/apps/${APP_NAME}.svg --plugin qt else if [ -f "${WORK_DIR}/AppBin/appimagetool-x86_64.AppImage" ]; then @@ -86,10 +93,10 @@ else ./${WORK_DIR}/AppBin/linuxdeploy-x86_64.AppImage --appdir=${WORK_DIR}/AppDir -e ${WORK_DIR}/AppDir/usr/bin/${APP_NAME} --desktop-file=${WORK_DIR}/AppDir/usr/share/applications/${APP_NAME}.desktop -i ${WORK_DIR}/AppDir/usr/share/icons/hicolor/scalable/apps/${APP_NAME}.svg --plugin qt #./linuxdeploy-x86_64.AppImage --appdir=${WORK_DIR}/ -e ${WORK_DIR}/app/bin/${APP_NAME} --output appimage --desktop-file=${WORK_DIR}/app/share/applications/${APP_NAME}.desktop -i ${WORK_DIR}/app/share/icons/hicolor/scalable/apps/${APP_NAME}.svg echo "-- Code Signing of AppImage" - if [ -z "$4" ]; then - ./${WORK_DIR}/AppBin/appimagetool-x86_64.AppImage ${WORK_DIR}/AppDir --sign --sign-key $3 + if [ -z "$5" ]; then + ./${WORK_DIR}/AppBin/appimagetool-x86_64.AppImage ${WORK_DIR}/AppDir --sign --sign-key $4 else - ./${WORK_DIR}/AppBin/appimagetool-x86_64.AppImage ${WORK_DIR}/AppDir --sign --sign-key $3 --sign-args "--pinentry-mode loopback --passphrase $4" + ./${WORK_DIR}/AppBin/appimagetool-x86_64.AppImage ${WORK_DIR}/AppDir --sign --sign-key $4 --sign-args "--pinentry-mode loopback --passphrase $5" fi fi