fixed windows release build

This commit is contained in:
Agel committed 2026-03-18 15:45:01 +01:00
1 parent 5598224141
commit 29af1aa15e
7 files changed
+126 -39

No files matched your search

+4 -2
View File
@@ -10,8 +10,10 @@
"Bash(*ninja.exe*)", "Bash(*ninja.exe*)",
"Bash(*ctest.exe*)", "Bash(*ctest.exe*)",
"Bash(qmake6 --version)", "Bash(qmake6 --version)",
"Bash(pkg-config --modversion Qt6Core)", "Bash(pkg-config --modversion*)",
"Bash(dpkg -l)" "Bash(dpkg -l)",
"WebSearch",
"Bash(bash scripts/test-ci-windows.sh 2>&1)"
] ]
} }
} }
+3
View File
@@ -30,6 +30,9 @@ moc_*.cpp
qrc_*.cpp qrc_*.cpp
ui_*.h ui_*.h
# Local CI output
ci-output/
# OS files # OS files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
+3 -3
View File
@@ -94,9 +94,9 @@ package-windows:
- chmod +x packaging/package-windows.sh - chmod +x packaging/package-windows.sh
- packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" . - packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" .
artifacts: artifacts:
name: "asteria-qt-windows-portable-${CI_COMMIT_SHORT_SHA}" name: "asteria-qt-windows"
paths: paths:
- asteria-qt-windows.zip - asteria-qt-windows/
expire_in: 1 day expire_in: 1 day
when: on_success when: on_success
@@ -119,7 +119,7 @@ update-wiki:
- API_URL="https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}" - API_URL="https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}"
- ARTIFACTS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw" - ARTIFACTS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw"
- LINUX_URL="${ARTIFACTS_URL}/dist/Asteria-x86_64.AppImage?job=package-linux" - LINUX_URL="${ARTIFACTS_URL}/dist/Asteria-x86_64.AppImage?job=package-linux"
- WINDOWS_URL="${ARTIFACTS_URL}/asteria-qt-windows.zip?job=package-windows" - WINDOWS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=package-windows"
- | - |
HTTP_CODE=$(curl -s -o /tmp/wiki.json -w '%{http_code}' \ HTTP_CODE=$(curl -s -o /tmp/wiki.json -w '%{http_code}' \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \ --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
+8
View File
@@ -43,6 +43,14 @@ set(SOURCES
# Executable # Executable
qt_add_executable(asteria-qt ${SOURCES}) qt_add_executable(asteria-qt ${SOURCES})
set_target_properties(asteria-qt PROPERTIES
WIN32_EXECUTABLE TRUE
)
if(WIN32)
target_link_options(asteria-qt PRIVATE -mwindows)
endif()
target_include_directories(asteria-qt PRIVATE src) target_include_directories(asteria-qt PRIVATE src)
target_link_libraries(asteria-qt PRIVATE target_link_libraries(asteria-qt PRIVATE
+5 -30
View File
@@ -21,32 +21,8 @@ cp "$BUILD_DIR/asteria-qt.exe" "$DIST_DIR/"
# windeployqt6 from the cross-compiled Qt may not work on Linux host, # windeployqt6 from the cross-compiled Qt may not work on Linux host,
# so we manually copy the required DLLs # so we manually copy the required DLLs
# Qt DLLs # Qt DLLs — copy all Qt6*.dll to avoid missing transitive dependencies
QT_DLLS=( cp "$QT_DIR/bin/"Qt6*.dll "$DIST_DIR/" 2>/dev/null || true
Qt6Core.dll
Qt6DBus.dll
Qt6Gui.dll
Qt6Qml.dll
Qt6Quick.dll
Qt6Widgets.dll
Qt6Concurrent.dll
Qt6Svg.dll
Qt6QuickControls2.dll
Qt6QuickControls2Impl.dll
Qt6QuickTemplates2.dll
Qt6QuickLayouts.dll
Qt6QmlModels.dll
Qt6QmlWorkerScript.dll
Qt6Network.dll
Qt6OpenGL.dll
Qt6QmlMeta.dll
)
for dll in "${QT_DLLS[@]}"; do
if [ -f "$QT_DIR/bin/$dll" ]; then
cp "$QT_DIR/bin/$dll" "$DIST_DIR/"
fi
done
# Qt plugins # Qt plugins
mkdir -p "$DIST_DIR/platforms" mkdir -p "$DIST_DIR/platforms"
@@ -97,7 +73,6 @@ Plugins = .
Qml2Imports = qml Qml2Imports = qml
EOF EOF
# Create zip archive # Output flat directory — GitLab zips the artifact directory on download
mkdir -p "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR/asteria-qt-windows"
cp -r "$DIST_DIR" "$OUTPUT_DIR/asteria-qt-windows" cp -r "$DIST_DIR/"* "$OUTPUT_DIR/asteria-qt-windows/"
cd "$OUTPUT_DIR" && zip -r "asteria-qt-windows.zip" asteria-qt-windows/ && rm -rf asteria-qt-windows/
+99
View File
@@ -0,0 +1,99 @@
#!/bin/bash
# Run CI build/package jobs locally using podman or docker.
# Usage: test-ci-local.sh [--linux]
# --linux also run build-linux + package-linux in addition to Windows jobs
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
OUTPUT_DIR="$PROJECT_DIR/ci-output"
DOCKERFILE="$PROJECT_DIR/docker/Dockerfile.build"
IMAGE_TAG="asteria-qt-ci-local:latest"
RUN_LINUX=false
for arg in "$@"; do
case "$arg" in
--linux) RUN_LINUX=true ;;
*) echo "Unknown argument: $arg"; exit 1 ;;
esac
done
# Detect container runtime
if command -v podman &>/dev/null; then
RUNTIME=podman
elif command -v docker &>/dev/null; then
RUNTIME=docker
else
echo "ERROR: neither podman nor docker found in PATH"
exit 1
fi
echo "Using container runtime: $RUNTIME"
# Build CI image
echo "==> Building CI image from $DOCKERFILE"
"$RUNTIME" build \
--build-arg QT_VERSION=6.10.1 \
-t "$IMAGE_TAG" \
-f "$DOCKERFILE" \
"$PROJECT_DIR"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
# Helper: run a command inside the CI container
# The project is copied into /src inside the container so the build is isolated.
run_in_container() {
local extra_args=("$@")
"$RUNTIME" run --rm \
-v "$PROJECT_DIR:/src-ro:ro" \
"${extra_args[@]}" \
"$IMAGE_TAG" \
bash -c '
set -euo pipefail
cp -r /src-ro /src
cd /src
'"$CI_SCRIPT"'
'
}
# ── Windows build ────────────────────────────────────────────────────────────
echo "==> build-windows"
CI_SCRIPT='
PKG_CONFIG_PATH="${MINGW_SYSROOT}/lib/pkgconfig" cmake -B build-windows -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-toolchain.cmake \
-DCMAKE_PREFIX_PATH="${QT_WINDOWS_DIR};${MINGW_SYSROOT}" \
-DCMAKE_FIND_ROOT_PATH="${QT_WINDOWS_DIR};${MINGW_SYSROOT}" \
-DQT_HOST_PATH="${QT_LINUX_DIR}"
cmake --build build-windows --target asteria-qt
cp -r build-windows /out/build-windows
' run_in_container -v "$OUTPUT_DIR:/out"
echo "==> package-windows"
CI_SCRIPT='
cp -r /out/build-windows build-windows
chmod +x packaging/package-windows.sh
packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" /out
' run_in_container -v "$OUTPUT_DIR:/out"
# ── Linux build (optional) ───────────────────────────────────────────────────
if [ "$RUN_LINUX" = true ]; then
echo "==> build-linux"
CI_SCRIPT='
cmake -B build-linux -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${QT_LINUX_DIR}"
cmake --build build-linux --target asteria-qt
cp build-linux/asteria-qt /out/
' run_in_container -v "$OUTPUT_DIR:/out"
echo "==> package-linux"
CI_SCRIPT='
cp /out/asteria-qt build-linux/asteria-qt
chmod +x packaging/package-linux.sh
packaging/package-linux.sh build-linux "${QT_LINUX_DIR}" /out
' run_in_container -v "$OUTPUT_DIR:/out"
fi
echo ""
echo "==> Done. Artifacts in $OUTPUT_DIR/"
ls -lh "$OUTPUT_DIR/"
+4 -4
View File
@@ -35,10 +35,10 @@ ApplicationWindow {
interval: 500 interval: 500
repeat: false repeat: false
onTriggered: { onTriggered: {
appState.setWindowWidth(window.width) appState.windowWidth = window.width
appState.setWindowHeight(window.height) appState.windowHeight = window.height
appState.setWindowX(window.x) appState.windowX = window.x
appState.setWindowY(window.y) appState.windowY = window.y
} }
} }