From 666507d3fe1dd1100bfe5a795e210e96a84761a7 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 13 Jul 2026 07:30:56 +0300 Subject: [PATCH] Move Qt DLL deployment from CMake to build.sh (windeployqt + manual fallback) --- tools/chatgui/CMakeLists.txt | 10 ---------- tools/chatgui/build.sh | 29 ++++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/tools/chatgui/CMakeLists.txt b/tools/chatgui/CMakeLists.txt index 819925c0..6be0904a 100644 --- a/tools/chatgui/CMakeLists.txt +++ b/tools/chatgui/CMakeLists.txt @@ -85,16 +85,6 @@ target_compile_definitions(chatgui PRIVATE SQLITE_THREADSAFE=1 USE_SQLITE) set_source_files_properties(db/sqlite3.c transport/chat_core.c transport/chat_sync.c transport/db_sync_stub.c PROPERTIES LANGUAGE C) if(WIN32) target_link_libraries(chatgui PRIVATE ${QT_LIBS} rlottie::rlottie ZLIB::ZLIB OpenSSL::Crypto ZXing::ZXing utun pthread) - find_program(WINDEPLOYQT windeployqt) - message(STATUS "windeployqt found: ${WINDEPLOYQT}") - if(WINDEPLOYQT) - add_custom_command(TARGET chatgui POST_BUILD - COMMAND ${WINDEPLOYQT} --no-translations --no-compiler-runtime $ - COMMENT "Deploying Qt DLLs to build directory..." - ) - else() - message(WARNING "windeployqt not found in PATH — Qt DLLs will NOT be deployed!") - endif() else() target_link_libraries(chatgui PRIVATE ${QT_LIBS} rlottie::rlottie ZLIB::ZLIB OpenSSL::Crypto ZXing::ZXing utun pthread dl) endif() diff --git a/tools/chatgui/build.sh b/tools/chatgui/build.sh index da946fd2..8fe5511a 100755 --- a/tools/chatgui/build.sh +++ b/tools/chatgui/build.sh @@ -18,17 +18,40 @@ log "Source: $SRC_DIR" log "Build: $BUILD_DIR" log "" -log "[1/3] Configuring CMake..." +log "[1/4] Configuring CMake..." cmake -S "$SRC_DIR" -B "$BUILD_DIR" -G "MSYS Makefiles" 2>&1 | tee -a "$LOG_FILE" test ${PIPESTATUS[0]} -eq 0 || { log "CMake configure FAILED"; exit 1; } log "" -log "[2/3] Building..." +log "[2/4] Building..." cmake --build "$BUILD_DIR" 2>&1 | tee -a "$LOG_FILE" test ${PIPESTATUS[0]} -eq 0 || { log "Build FAILED"; exit 1; } log "" -log "[3/3] Copying runtime DLLs..." +log "[3/4] Deploying runtime DLLs..." +WINDEPLOYQT="/ucrt64/bin/windeployqt" +if [ -x "$WINDEPLOYQT" ]; then + log " Running $WINDEPLOYQT..." + "$WINDEPLOYQT" --no-translations --no-compiler-runtime "$BUILD_DIR/chatgui.exe" 2>&1 | tee -a "$LOG_FILE" + RC=${PIPESTATUS[0]} + if [ $RC -eq 0 ]; then + log " OK: windeployqt completed" + else + log " WARN: windeployqt failed (exit $RC), trying manual copy..." + for dll in Qt5Core Qt5Gui Qt5Widgets Qt5Network; do + cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: ${dll}.dll" || log " WARN: ${dll}.dll not found" + done + for dll in libssl-3-x64 libcrypto-3-x64 zlib1; do + cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null || true + done + fi +else + log " WARN: $WINDEPLOYQT not found (install: pacman -S mingw-w64-ucrt-x86_64-qt5-tools)" + log " Copying DLLs manually..." + for dll in Qt5Core Qt5Gui Qt5Widgets Qt5Network libssl-3-x64 libcrypto-3-x64 zlib1; do + cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: ${dll}.dll" || log " WARN: ${dll}.dll not found" + done +fi cp "$SRC_DIR/rlottie_build/librlottie.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: librlottie.dll" || log " WARN: librlottie.dll not found" log ""