Fix NSIS installer: revert removing useless files because NSIS have a check integrity that is computed from install() commands.

There is no way found to remove these files without changing install on all subprojects.
This commit is contained in:
Julien Wadel 2026-01-05 17:16:44 +01:00
parent d57bb585db
commit 315cabf9d9
2 changed files with 8 additions and 33 deletions

View file

@ -97,10 +97,12 @@ elseif(WIN32)
#####################################################
# Clean all unwanted files to package.
#####################################################
remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/Qt*.pdb")
# TODO: remove all pdb when CrashReporter is available. Symbols for crashing are in server so it is not needed for deployment.
# if debugging is needed, we could rebuild it and use pdb from local build instead of using official binaries.
# Warning: Do not remove files from here like below. NSIS have a check integrity that is done from install() commands.
#remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/*.pdb")
remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/Qt*.pdb")
remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/*.cmake")
remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/*.lib")
#remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/*.cmake")
#remove_file("${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*/*.lib")
endif()

View file

@ -132,35 +132,6 @@ elseif(WIN32)
endif ()
endif()
#Windeployqt hack for CPack. WindeployQt cannot be used only with a simple 'install(CODE "execute_process' or CPack will not have all required files.
#Call it from target folder
function(deployqt_hack target)
if(WIN32)
find_program(DEPLOYQT_PROGRAM windeployqt HINTS "${_qt_bin_dir}")
if (NOT DEPLOYQT_PROGRAM)
message(FATAL_ERROR "Could not find the windeployqt program. Make sure it is in the PATH.")
endif ()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/"
COMMAND "${CMAKE_COMMAND}" -E
env PATH="${_qt_bin_dir}" "${DEPLOYQT_PROGRAM}"
--qmldir "${LINPHONE_QML_DIR}"
--plugindir "${CMAKE_CURRENT_BINARY_DIR}/winqt/plugins"
--verbose 0
--no-compiler-runtime
--dir "${CMAKE_CURRENT_BINARY_DIR}/winqt/"
"$<TARGET_FILE:${target}>"
COMMENT "Deploying Qt..."
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/.."
)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION bin)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
include(InstallRequiredSystemLibraries)
endif()
endfunction()
################################################################
# CRASHPAD
################################################################
@ -245,7 +216,9 @@ if(${ENABLE_APP_PACKAGING})
set(DO_GENERATOR YES)
set(PACKAGE_EXT "exe")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION}-${BIN_ARCH}")
set(CPACK_SOURCE_IGNORE_FILES "*Qt*.pdb;*.lib;*.cmake") #Doesn't seem to work but we let the option just in case.
set(CPACK_SOURCE_IGNORE_FILES "*Qt*.pdb;*.lib;*.cmake")
set(CPACK_IGNORE_FILES ".*Qt.*\\.pdb$" ".*\\.lib$" ".*\\.cmake$") #Not documented
find_program(NSIS_PROGRAM makensis)
if(NOT NSIS_PROGRAM)
if(ENABLE_WINDOWS_TOOLS_CHECK)