diff --git a/deploy/build_windows.bat b/deploy/build_windows.bat index 0a1f93187..f18474334 100644 --- a/deploy/build_windows.bat +++ b/deploy/build_windows.bat @@ -108,95 +108,77 @@ if defined QT_HOST_BIN_DIR ( echo "ERROR: ARM64 exe file not found: %OUT_APP_DIR%\%APP_FILENAME%" exit /b 1 ) - REM For ARM64, manually copy Qt DLLs instead of using windeployqt - REM windeployqt has issues with cross-compilation paths - echo "Manually copying ARM64 Qt DLLs instead of using windeployqt" + REM For ARM64 cross-compilation, use windeployqt from host (x64) Qt + REM Set Qt environment variables to point to ARM64 Qt + echo "Using host windeployqt for ARM64 cross-compilation" + echo "ARM64 Qt path: %QT_BIN_DIR:"=%" + echo "Host Qt path: %QT_HOST_BIN_DIR:"=%" - REM Debug: Check if Qt bin directory exists - echo "Checking Qt bin directory: %QT_BIN_DIR:"=%" - if exist "%QT_BIN_DIR:"=%" ( - echo "Qt bin directory exists" - dir "%QT_BIN_DIR:"=%\Qt6*.dll" 2>nul - ) else ( - echo "ERROR: Qt bin directory does not exist: %QT_BIN_DIR:"=%" - exit /b 1 - ) + REM Set environment variables to help windeployqt find ARM64 Qt + set "PATH=%QT_BIN_DIR:"=%;%PATH%" + set "QT_PLUGIN_PATH=%QT_BIN_DIR:"=%\..\plugins" + set "QML2_IMPORT_PATH=%QT_BIN_DIR:"=%\..\qml" - REM Copy Qt DLLs - if exist "%QT_BIN_DIR:"=%\Qt6Core.dll" ( - echo "Copying all Qt6 DLLs from %QT_BIN_DIR:"=%" - copy "%QT_BIN_DIR:"=%\*.dll" "%OUT_APP_DIR:"=%\" >nul 2>&1 + REM Use host windeployqt with --dir parameter to specify ARM64 Qt location + REM The --libdir parameter tells windeployqt where to find the ARM64 Qt libraries + echo "Running windeployqt..." + "%QT_HOST_BIN_DIR:"=%\windeployqt" --release --qmldir "%PROJECT_DIR:"=%\client" --libdir "%QT_BIN_DIR:"=%" --plugindir "%QT_BIN_DIR:"=%\..\plugins" --force --no-translations --compiler-runtime "%OUT_APP_DIR:"=%\%APP_FILENAME:"=%" + + echo "Checking output directory after windeployqt..." + echo "Listing all files and directories in output directory:" + dir "%OUT_APP_DIR:"=%" /s + REM Check if windeployqt succeeded + if not exist "%OUT_APP_DIR:"=%\Qt6Core.dll" ( + echo "WARNING: windeployqt may have failed, Qt6Core.dll not found" + echo "Attempting fallback: manual copy of Qt ARM64 DLLs..." - REM Copy Qt6 plugins - if exist "%QT_BIN_DIR:"=%\..\plugins" ( - echo "Copying Qt6 plugins" - xcopy "%QT_BIN_DIR:"=%\..\plugins" "%OUT_APP_DIR:"=%\plugins\" /s /e /y /i >nul 2>&1 + if exist "%QT_BIN_DIR:"=%\Qt6Core.dll" ( + echo "Copying Qt DLLs from %QT_BIN_DIR:"=%" + copy "%QT_BIN_DIR:"=%\*.dll" "%OUT_APP_DIR:"=%\" >nul 2>&1 + + REM Copy all essential Qt directories + if exist "%QT_BIN_DIR:"=%\..\plugins" ( + echo "Copying Qt plugins (all subdirectories)" + xcopy "%QT_BIN_DIR:"=%\..\plugins" "%OUT_APP_DIR:"=%\" /s /e /y /i >nul 2>&1 + ) + + REM Copy QML modules + if exist "%QT_BIN_DIR:"=%\..\qml" ( + echo "Copying QML modules" + xcopy "%QT_BIN_DIR:"=%\..\qml" "%OUT_APP_DIR:"=%\qml\" /s /e /y /i >nul 2>&1 + ) + + REM Copy translations + if exist "%QT_BIN_DIR:"=%\..\translations" ( + echo "Copying Qt translations" + xcopy "%QT_BIN_DIR:"=%\..\translations" "%OUT_APP_DIR:"=%\translations\" /s /e /y /i >nul 2>&1 + ) + + REM Copy resources + if exist "%QT_BIN_DIR:"=%\..\resources" ( + echo "Copying Qt resources" + xcopy "%QT_BIN_DIR:"=%\..\resources" "%OUT_APP_DIR:"=%\resources\" /s /e /y /i >nul 2>&1 + ) + + echo "Fallback copy completed" + + REM Verify that Qt DLLs were copied + if exist "%OUT_APP_DIR:"=%\Qt6Core.dll" ( + echo "Success: Qt6Core.dll found after fallback copy" + ) else ( + echo "ERROR: Qt6Core.dll still not found after fallback copy" + echo "Listing DLL files in output directory:" + dir "%OUT_APP_DIR:"=%\*.dll" + exit /b 1 + ) + ) else ( + echo "ERROR: Qt DLLs not found in %QT_BIN_DIR:"=%" + exit /b 1 ) - - REM Copy Qt6 QML modules - if exist "%QT_BIN_DIR:"=%\..\qml" ( - echo "Copying Qt6 QML modules" - xcopy "%QT_BIN_DIR:"=%\..\qml" "%OUT_APP_DIR:"=%\qml\" /s /e /y /i >nul 2>&1 - ) - - REM Copy translations if needed - if exist "%QT_BIN_DIR:"=%\..\translations" ( - echo "Copying Qt6 translations" - xcopy "%QT_BIN_DIR:"=%\..\translations\qt*.qm" "%OUT_APP_DIR:"=%\translations\" /y /i >nul 2>&1 - ) - - REM Copy resources directories - if exist "%QT_BIN_DIR:"=%\..\resources" ( - echo "Copying Qt6 resources" - xcopy "%QT_BIN_DIR:"=%\..\resources" "%OUT_APP_DIR:"=%\resources\" /s /e /y /i >nul 2>&1 - ) - - REM Copy iconengines - if exist "%QT_BIN_DIR:"=%\..\plugins\iconengines" ( - echo "Copying iconengines" - xcopy "%QT_BIN_DIR:"=%\..\plugins\iconengines" "%OUT_APP_DIR:"=%\iconengines\" /s /e /y /i >nul 2>&1 - ) - - REM Copy imageformats - if exist "%QT_BIN_DIR:"=%\..\plugins\imageformats" ( - echo "Copying imageformats" - xcopy "%QT_BIN_DIR:"=%\..\plugins\imageformats" "%OUT_APP_DIR:"=%\imageformats\" /s /e /y /i >nul 2>&1 - ) - - REM Copy platforms - if exist "%QT_BIN_DIR:"=%\..\plugins\platforms" ( - echo "Copying platforms" - xcopy "%QT_BIN_DIR:"=%\..\plugins\platforms" "%OUT_APP_DIR:"=%\platforms\" /s /e /y /i >nul 2>&1 - ) - - REM Copy styles - if exist "%QT_BIN_DIR:"=%\..\plugins\styles" ( - echo "Copying styles" - xcopy "%QT_BIN_DIR:"=%\..\plugins\styles" "%OUT_APP_DIR:"=%\styles\" /s /e /y /i >nul 2>&1 - ) - - REM Copy tls - if exist "%QT_BIN_DIR:"=%\..\plugins\tls" ( - echo "Copying tls" - xcopy "%QT_BIN_DIR:"=%\..\plugins\tls" "%OUT_APP_DIR:"=%\tls\" /s /e /y /i >nul 2>&1 - ) - - REM Copy networkinformation - if exist "%QT_BIN_DIR:"=%\..\plugins\networkinformation" ( - echo "Copying networkinformation" - xcopy "%QT_BIN_DIR:"=%\..\plugins\networkinformation" "%OUT_APP_DIR:"=%\networkinformation\" /s /e /y /i >nul 2>&1 - ) - - REM Copy generic - if exist "%QT_BIN_DIR:"=%\..\plugins\generic" ( - echo "Copying generic" - xcopy "%QT_BIN_DIR:"=%\..\plugins\generic" "%OUT_APP_DIR:"=%\generic\" /s /e /y /i >nul 2>&1 - ) - - echo "Successfully copied Qt ARM64 libraries and resources" ) else ( - echo "ERROR: Qt DLLs not found in %QT_BIN_DIR:"=%" - exit /b 1 + echo "windeployqt completed successfully" + echo "Verifying Qt6Core.dll exists:" + dir "%OUT_APP_DIR:"=%\Qt6Core.dll" ) ) else ( "%QT_BIN_DIR:"=%\windeployqt" --release --qmldir "%PROJECT_DIR:"=%\client" --force --no-translations "%OUT_APP_DIR:"=%\%APP_FILENAME:"=%"