Browse Source

Move Qt DLL deployment from CMake to build.sh (windeployqt + manual fallback)

chatgui
Evgeny 3 months ago
parent
commit
666507d3fe
  1. 10
      tools/chatgui/CMakeLists.txt
  2. 29
      tools/chatgui/build.sh

10
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 $<TARGET_FILE:chatgui>
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()

29
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 ""

Loading…
Cancel
Save