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)
This commit is contained in:
Julien Wadel 2022-02-08 15:46:45 +01:00
parent effe5eb3aa
commit 6ec60b95e9
5 changed files with 30 additions and 20 deletions

View file

@ -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()

View file

@ -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 ()

View file

@ -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 ()

View file

@ -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@)

View file

@ -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