diff --git a/.gitattributes b/.gitattributes index e417c1cdd..e69de29bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +0,0 @@ -*.qch filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/auto-doxygen.yml b/.github/workflows/auto-doxygen.yml deleted file mode 100644 index ee132fe8b..000000000 --- a/.github/workflows/auto-doxygen.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Auto-build doxygen docs -on: - push: - tags: - - '**' - - - -jobs: - doxygen: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - show-progress: '' - - name: Setup and run doxygen - run: sudo apt update && sudo apt install doxygen graphviz qhelpgenerator-qt5 -y - - name: Set up Git LFS - run: | - git lfs install - git lfs track "*.qch" - - name: Run doxygen - run: doxygen Doxyfile - - name: Create Pull Request - uses: peter-evans/create-pull-request@v8 - with: - token: ${{ secrets.MR_TOKEN }} - commit-message: update QCH file - committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - title: Update QCH Help file - body: | - - Updating QT Help file following commit ${{ github.sha }}. - - Auto-generated by [create-pull-request][1] - - [1]: https://github.com/peter-evans/create-pull-request - branch: update-qch - labels: | - qch - cicd - delete-branch: true - add-paths: doc/*.qch - - uses: actions/upload-pages-artifact@v3 - with: - path: ${{ github.workspace }}/doc/html/ - deploy: - # Add a dependency to the build job - needs: doxygen - - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - # Specify runner + deployment step - runs-on: ubuntu-latest - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml new file mode 100644 index 000000000..26dfa39b2 --- /dev/null +++ b/.github/workflows/linux-build.yml @@ -0,0 +1,81 @@ +# Linux build, unit tests, and the IPC open-forwarding regression gate. +# +# The existing workflows build Windows and generate documentation; nothing +# builds QElectroTech on Linux or runs tests/ in CI. This does both. +# +# It runs inside an ubuntu:26.04 container rather than directly on the runner +# because the IPC gate below needs Qt 6.10.2. The ubuntu-latest image ships +# Qt 6.4, and whether the crash that gate covers reproduces on 6.4 has never +# been checked -- a gate that cannot go red is worse than no gate. +name: Linux build and tests + +on: + push: + branches: [master] + pull_request: + workflow_dispatch: + +jobs: + linux: + name: Build and test (Qt 6, Debug) + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - name: Install build and test dependencies + run: | + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates build-essential cmake ninja-build git pkg-config \ + qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \ + libqt6svg6-dev libqt6sql6-sqlite libcups2-dev libsqlite3-dev \ + libxkbcommon-x11-0 \ + xvfb openbox xdotool x11-utils + # extra-cmake-modules and the KF6 libraries are installed rather than + # left to FetchContent: without them CMake builds extra-cmake-modules + # from source, and its Qt Help documentation target then demands + # Qt6{Core,Gui,Widgets,DBus}Tools, failing the configure with an error + # that appears to be about QElectroTech and is not. + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + extra-cmake-modules libkf6coreaddons-dev libkf6widgetsaddons-dev \ + qt6-svg-plugins + + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Configure + # Debug, not Release. Whether a use-after-free faults depends on what + # the allocator does with the freed block: the commit before #868 + # crashes every time built Debug and survives every time built + # -O3 -DNDEBUG, so a Release job would never catch a regression here. + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + cmake -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DQT_VERSION_MAJOR=6 \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DQET_EXPORT_PROJECT_DB=ON + + - name: Build + run: cmake --build build --parallel $(nproc) + + - name: Unit tests + run: xvfb-run -a ctest --test-dir build --output-on-failure + + - name: IPC open-forwarding regression (#868) + # Fails the job only on an actual crash. An inconclusive run means the + # crash path was not exercised -- it proves nothing, which is not the + # same as a regression, and failing on it would make this job flaky + # rather than informative. + run: | + set +e + tests/ipc-regression/run.sh --binary build/qelectrotech + status=$? + set -e + case $status in + 0) echo "::notice::IPC gate passed" ;; + 2) echo "::warning::IPC gate inconclusive -- the crash path was not exercised, nothing was proven" ;; + *) echo "::error::IPC gate failed -- forwarded files are being opened inside the socket handler again" + exit 1 ;; + esac diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index dd5cdfb45..3b5f37d67 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -11,356 +11,7 @@ concurrency: jobs: # ============================================================================= - # Job 1: Qt5 build (stable track) - # ============================================================================= - build-windows: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 - with: - submodules: recursive - fetch-depth: 0 - - - name: Install MSYS2 - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - update: true - cache: true - install: >- - git - mingw-w64-ucrt-x86_64-ccache - mingw-w64-ucrt-x86_64-gcc - mingw-w64-ucrt-x86_64-cmake - mingw-w64-ucrt-x86_64-ninja - mingw-w64-ucrt-x86_64-qt5-base - mingw-w64-ucrt-x86_64-qt5-svg - mingw-w64-ucrt-x86_64-qt5-tools - mingw-w64-ucrt-x86_64-qt5-translations - mingw-w64-ucrt-x86_64-qt5-pdf - mingw-w64-ucrt-x86_64-sqlite3 - mingw-w64-ucrt-x86_64-pkg-config - mingw-w64-ucrt-x86_64-kwidgetsaddons - mingw-w64-ucrt-x86_64-kcoreaddons - mingw-w64-ucrt-x86_64-extra-cmake-modules - mingw-w64-ucrt-x86_64-nsis - mingw-w64-ucrt-x86_64-angleproject - - - name: Cache ccache - uses: actions/cache@v5 - with: - path: C:\Users\runneradmin\AppData\Local\ccache - key: ccache-windows-${{ github.ref_name }}-${{ github.sha }} - restore-keys: | - ccache-windows-${{ github.ref_name }}- - ccache-windows- - - - name: Configure ccache - shell: msys2 {0} - run: | - /ucrt64/bin/ccache --set-config=max_size=500M - /ucrt64/bin/ccache --set-config=compression=true - /ucrt64/bin/ccache -z - echo "=== ccache config ===" - /ucrt64/bin/ccache -p - - - name: Patch NSIS Welcome page — fix title font size - shell: msys2 {0} - run: | - set -euo pipefail - WELCOME_NSH=$(find /ucrt64 -path "*/Modern UI 2/Pages/Welcome.nsh" | head -1) - if [ -z "$WELCOME_NSH" ]; then - echo "WARNING: Welcome.nsh not found, skipping font patch" - else - echo "Patching: $WELCOME_NSH" - sed -i '/WelcomePage\.Title\.Font/s/"[0-9]\+" "700"/"10" "700"/' "$WELCOME_NSH" - grep 'WelcomePage.Title.Font' "$WELCOME_NSH" - echo " OK font size patched to 10" - fi - - FINISH_NSH=$(find /ucrt64 -path "*/Modern UI 2/Pages/Finish.nsh" | head -1) - if [ -z "$FINISH_NSH" ]; then - echo "WARNING: Finish.nsh not found, skipping font patch" - else - echo "Patching: $FINISH_NSH" - sed -i '/FinishPage\.Title\.Font/s/"[0-9]\+" "700"/"10" "700"/' "$FINISH_NSH" - grep 'FinishPage.Title.Font' "$FINISH_NSH" - echo " OK font size patched to 10" - fi - - - name: Force Qt5 — remove Qt6 cmake + tools - shell: msys2 {0} - run: | - set -euo pipefail - rm -rf /ucrt64/lib/cmake/Qt6 - pacman -R --noconfirm mingw-w64-ucrt-x86_64-qt6-tools 2>/dev/null || true - echo "=== windeployqt binaries ===" - ls /ucrt64/bin/windeployqt* || echo "NO windeployqt found!" - - - name: Build with cmake - shell: msys2 {0} - run: | - set -euo pipefail - cd "$GITHUB_WORKSPACE" - mkdir build && cd build - NPROC=$(nproc) - echo "Available CPUs: $NPROC" - - cmake -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=/ucrt64 \ - -DQt5_DIR=/ucrt64/lib/cmake/Qt5 \ - -DQT_VERSION_MAJOR=5 \ - -DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON \ - -DBUILD_TESTING=OFF \ - -DCMAKE_POLICY_DEFAULT_CMP0077=NEW \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \ - -DCMAKE_C_COMPILER_LAUNCHER=/ucrt64/bin/ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=/ucrt64/bin/ccache \ - -DSQLite3_INCLUDE_DIR=/ucrt64/include \ - -DSQLite3_LIBRARY=/ucrt64/lib/libsqlite3.dll.a \ - .. - ninja -j"$NPROC" - - - name: Show ccache stats - shell: msys2 {0} - run: | - echo "=== ccache statistics ===" - /ucrt64/bin/ccache -s - - - name: Verify exe was built - shell: msys2 {0} - run: | - set -euo pipefail - EXE=$(find "$GITHUB_WORKSPACE/build" -maxdepth 3 -iname "qelectrotech.exe" | head -1) - if [ -z "$EXE" ]; then - echo "ERROR: no qelectrotech.exe found in build/" - find "$GITHUB_WORKSPACE/build" -maxdepth 3 -name "*.exe" || true - exit 1 - fi - SIZE=$(stat -c%s "$EXE") - echo "Exe found: $EXE ($SIZE bytes)" - [ "$SIZE" -gt 100000 ] || { echo "ERROR: exe too small"; exit 1; } - - - name: Deploy — copy exe + windeployqt + DLLs - shell: msys2 {0} - run: | - set -euo pipefail - NSIS_ROOT="$GITHUB_WORKSPACE/nsis_root" - FILES="$NSIS_ROOT/files" - BIN="$FILES/bin" - mkdir -p "$BIN" - - EXE=$(find "$GITHUB_WORKSPACE/build" -maxdepth 3 -iname "qelectrotech.exe" | head -1) - echo "Copying exe: $EXE -> $BIN/QElectroTech.exe" - cp "$EXE" "$BIN/QElectroTech.exe" - - cd "$BIN" - /ucrt64/bin/windeployqt-qt5 \ - --release \ - --no-translations \ - --no-compiler-runtime \ - ./QElectroTech.exe || true - - echo "=== 3-pass transitive DLL scan ===" - set +e - for PASS in 1 2 3; do - echo "-- Pass $PASS --" - for bin_file in "$BIN"/*.dll "$BIN"/*.exe "$BIN"/sqldrivers/*.dll "$BIN"/platforms/*.dll "$BIN"/imageformats/*.dll; do - [ -f "$bin_file" ] || continue - while IFS= read -r line; do - dll_path=$(echo "$line" | awk '{print $3}') - [ -f "$dll_path" ] || continue - dll_name=$(basename "$dll_path") - dst="$BIN/$dll_name" - if [ ! -f "$dst" ]; then - cp "$dll_path" "$dst" - echo " Copied (pass $PASS): $dll_name" - fi - done < <(ldd "$bin_file" 2>/dev/null | grep -i '/ucrt64/bin/') - done - done - set -e - - DLL_COUNT=$(find "$BIN" -name "*.dll" | wc -l) - echo "=== $DLL_COUNT DLLs present after scan ===" - ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; } - [ "$DLL_COUNT" -gt 5 ] || { echo "ERROR: too few DLLs"; exit 1; } - cd "$GITHUB_WORKSPACE" - - cp /ucrt64/bin/libgcc_s_seh-1.dll "$BIN/" - cp /ucrt64/bin/libstdc++-6.dll "$BIN/" - cp /ucrt64/bin/libwinpthread-1.dll "$BIN/" - SQLITE=$(find /ucrt64/bin -name "libsqlite3*.dll" | head -1) - if [ -n "$SQLITE" ]; then - cp "$SQLITE" "$BIN/" - echo "SQLite3 copied: $(basename $SQLITE)" - else - echo "WARNING: libsqlite3 not found in /ucrt64/bin/" - fi - - cp "$GITHUB_WORKSPACE/build-aux/windows/QET64.nsi" "$NSIS_ROOT/" - cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra.nsh" "$NSIS_ROOT/" - cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra_fr.nsh" "$NSIS_ROOT/" - cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra_missing.nsh" "$NSIS_ROOT/" - cp -r "$GITHUB_WORKSPACE/build-aux/windows/nsis_base/." "$NSIS_ROOT/" - - curl -fsSL \ - "https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/refs/heads/master/misc/Lancer%20QET.bat" \ - -o "$FILES/Lancer QET.bat" - cp -r "$GITHUB_WORKSPACE/elements" "$FILES/elements" || true - cp -r "$GITHUB_WORKSPACE/titleblocks" "$FILES/titleblocks" || true - cp -r "$GITHUB_WORKSPACE/examples" "$FILES/examples" || true - cp -r "$GITHUB_WORKSPACE/fonts" "$FILES/fonts" || true - - cp -r "$GITHUB_WORKSPACE/lang" "$FILES/lang" || true - find "$GITHUB_WORKSPACE/build" -name "*.qm" -exec cp {} "$FILES/lang/" \; 2>/dev/null || true - echo "=== .qm files in files/lang/ ===" - ls "$FILES/lang/"*.qm 2>/dev/null | wc -l || echo "0 .qm files" - - for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE; do - cp "$GITHUB_WORKSPACE/$f" "$FILES/$f" 2>/dev/null || true - done - - echo "=== Verification of key files in files/ ===" - for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE \ - qet_uninstall_file_associations.reg register_filetypes.bat "Lancer QET.bat"; do - [ -f "$FILES/$f" ] \ - && echo " OK : $f" \ - || echo " MISSING: $f" - done - for d in ico elements lang titleblocks fonts examples bin; do - [ -d "$FILES/$d" ] \ - && echo " OK : $d/" \ - || echo " MISSING: $d/" - done - - - name: Extract version for installer name - shell: msys2 {0} - id: qet_version - run: | - set -euo pipefail - - GITCOMMIT=$(git -C "$GITHUB_WORKSPACE" rev-parse --short HEAD) - - A=$(git -C "$GITHUB_WORKSPACE" rev-list HEAD --count) - HEAD=$(( A + 473 )) - - VERSION=$(grep 'return QVersionNumber{' "$GITHUB_WORKSPACE/sources/qetversion.cpp" \ - | head -1 \ - | awk -F '{' '{ print $2 }' \ - | awk -F '}' '{ print $1 }' \ - | sed -e 's/,/./g' -e 's/ //g') - [ -z "$VERSION" ] && VERSION="dev" - - FULL_VERSION="${VERSION}-r${HEAD}-${GITCOMMIT}_x86_64-win64" - echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT" - echo "base_version=$VERSION" >> "$GITHUB_OUTPUT" - echo "gitcommit=$GITCOMMIT" >> "$GITHUB_OUTPUT" - echo "head=$HEAD" >> "$GITHUB_OUTPUT" - echo "VERSION : $VERSION" - echo "GITCOMMIT : $GITCOMMIT" - echo "HEAD (rev) : $HEAD" - echo "FULL : $FULL_VERSION" - - - name: Patch QET64.nsi — version + exe name + absolute paths - shell: msys2 {0} - run: | - set -euo pipefail - VERSION="${{ steps.qet_version.outputs.version }}" - NSI="$GITHUB_WORKSPACE/nsis_root/QET64.nsi" - FILES_WIN=$(cygpath -w "$GITHUB_WORKSPACE/nsis_root/files") - SCRIPT="$GITHUB_WORKSPACE/build-aux/windows/patch_nsi.py" - - python3 "$SCRIPT" "$NSI" "$VERSION" "$FILES_WIN" - - echo "=== Verification ===" - grep 'SOFT_VERSION' "$NSI" | head -1 - grep -m2 'nsis_root' "$NSI" | head -2 - echo "=== Contents of nsis_root/files/ ===" - ls "$GITHUB_WORKSPACE/nsis_root/files/" - - - name: Build NSIS installer - shell: msys2 {0} - run: | - set -euo pipefail - NSIS_ROOT="$GITHUB_WORKSPACE/nsis_root" - cd "$NSIS_ROOT" - echo "=== CWD : $(pwd) ===" - MSYS2_ARG_CONV_EXCL="*" makensis /V4 QET64.nsi - RC=$? - echo "=== Contents of nsis_root after makensis ===" - ls "$NSIS_ROOT/" - [ $RC -eq 0 ] || { echo "ERROR: makensis failed (exit $RC)"; exit 1; } - - - name: Move installer to dist/ - shell: msys2 {0} - run: | - set -euo pipefail - mkdir -p "$GITHUB_WORKSPACE/dist" - INSTALLER=$(find "$GITHUB_WORKSPACE/nsis_root" -maxdepth 1 -iname "installer_*.exe" | head -1) - if [ -z "$INSTALLER" ]; then - echo "ERROR: no installer .exe found in nsis_root/" - ls "$GITHUB_WORKSPACE/nsis_root/" - exit 1 - fi - echo "Moving: $INSTALLER -> dist/" - mv "$INSTALLER" "$GITHUB_WORKSPACE/dist/" - - - name: Upload build logs on failure - if: failure() - uses: actions/upload-artifact@v7 - with: - name: build-logs - path: | - build/CMakeFiles/*.log - nsis_root/files/bin/ - if-no-files-found: warn - - - name: Zip portable (readytouse) - id: zip_portable - shell: pwsh - run: | - $version = "${{ steps.qet_version.outputs.base_version }}" - $head = "${{ steps.qet_version.outputs.head }}" - $zipName = "qelectrotech-${version}+git${head}-x86-win64-readytouse.zip" - $src = "$env:GITHUB_WORKSPACE\nsis_root\files" - $dst = "$env:GITHUB_WORKSPACE\dist\$zipName" - $7z = "C:\Program Files\7-Zip\7z.exe" - - New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\dist" | Out-Null - & $7z a -tzip -mx=5 -mmt=on $dst "$src\*" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - $sizeMB = [math]::Round((Get-Item $dst).Length / 1MB, 1) - Write-Output "ZIP created: $zipName ($sizeMB MB)" - "zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append - - - name: Upload portable (files/ without installer) - uses: actions/upload-artifact@v7 - with: - name: qelectrotech-${{ steps.qet_version.outputs.base_version }}+git${{ steps.qet_version.outputs.head }}-x86-win64-readytouse - path: dist/${{ steps.zip_portable.outputs.zip_name }} - retention-days: 40 - - - name: Upload NSIS installer - uses: actions/upload-artifact@v7 - with: - name: qelectrotech-windows-installer - path: dist/Installer_*.exe - retention-days: 40 - - - name: Upload portable (nom fixe pour le workflow MSI) - uses: actions/upload-artifact@v7 - with: - name: qelectrotech-windows-portable - path: nsis_root/files/ - retention-days: 40 - - # ============================================================================= - # Job 2: Qt6 build (EXPERIMENTAL track) + # Job 1: Windows build (Qt6/KF6 — sole track since the Qt5 track was removed) # # Version label: the C++ source (sources/qetversion.cpp) intentionally stays # Qt-agnostic — QT_VERSION-based detection inside the binary proved unreliable @@ -368,6 +19,9 @@ jobs: # certainty which Qt major version it configured (-DQT_VERSION_MAJOR=6), so it # is safe to label the *package* "0.200.1" at this level, without touching # QetVersion::currentVersion() or making the binary self-detect its Qt build. + # + # Job id kept as "build-windows-qt6" (not renamed to "build-windows") in case + # branch protection / required status checks reference this exact job name. # ============================================================================= build-windows-qt6: runs-on: windows-latest @@ -397,8 +51,12 @@ jobs: mingw-w64-ucrt-x86_64-qt6-pdf mingw-w64-ucrt-x86_64-sqlite3 mingw-w64-ucrt-x86_64-pkg-config + mingw-w64-ucrt-x86_64-kwidgetsaddons + mingw-w64-ucrt-x86_64-kcoreaddons + mingw-w64-ucrt-x86_64-extra-cmake-modules mingw-w64-ucrt-x86_64-nsis mingw-w64-ucrt-x86_64-angleproject + mingw-w64-ucrt-x86_64-qt6-declarative - name: Cache ccache uses: actions/cache@v5 @@ -456,11 +114,12 @@ jobs: -DCMAKE_PREFIX_PATH=/ucrt64 \ -DQt6_DIR=/ucrt64/lib/cmake/Qt6 \ -DQT_VERSION_MAJOR=6 \ - -DBUILD_WITH_KF5=OFF \ + -DBUILD_WITH_KF=ON \ + -DBUILD_KF=OFF \ -DPACKAGE_TESTS=OFF \ -DCMAKE_POLICY_DEFAULT_CMP0077=NEW \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \ + -DQET_EXPORT_PROJECT_DB=ON \ -DCMAKE_C_COMPILER_LAUNCHER=/ucrt64/bin/ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=/ucrt64/bin/ccache \ -DSQLite3_INCLUDE_DIR=/ucrt64/include \ @@ -559,10 +218,71 @@ jobs: cp -r "$GITHUB_WORKSPACE/examples" "$FILES/examples" || true cp -r "$GITHUB_WORKSPACE/fonts" "$FILES/fonts" || true - cp -r "$GITHUB_WORKSPACE/lang" "$FILES/lang" || true - find "$GITHUB_WORKSPACE/build" -name "*.qm" -exec cp {} "$FILES/lang/" \; 2>/dev/null || true - echo "=== .qm files in files/lang/ ===" - ls "$FILES/lang/"*.qm 2>/dev/null | wc -l || echo "0 .qm files" + # --- Translations --- + # Since PR #751 the .qm files are no longer tracked in git: lrelease + # generates them in build/lang/ (OUTPUT_LOCATION "lang", relative to + # the build dir). Expected set = the .ts listed in TS_FILES + # (cmake/qet_compilation_vars.cmake): a missing .qm fails the job + # instead of silently shipping an untranslated build; a .ts present + # in lang/ but not listed in TS_FILES only raises a warning. + # find/grep only, no shell glob: $GITHUB_WORKSPACE is a Windows path + # (D:\a\...) and its backslashes break glob patterns. + QM_SRC="$GITHUB_WORKSPACE/build/lang" + mkdir -p "$FILES/lang" + TS_LISTED=$(grep -o 'lang/qet_[A-Za-z_]*\.ts' "$GITHUB_WORKSPACE/cmake/qet_compilation_vars.cmake" \ + | sed -e 's#^lang/##' -e 's#\.ts$##' | LC_ALL=C sort -u || true) + [ -n "$TS_LISTED" ] || { echo "ERROR: cannot read TS_FILES from cmake/qet_compilation_vars.cmake"; exit 1; } + TS_PRESENT=$(find "$GITHUB_WORKSPACE/lang" -maxdepth 1 -name 'qet_*.ts' -exec basename {} .ts \; | LC_ALL=C sort) + UNLISTED=$(LC_ALL=C comm -13 <(echo "$TS_LISTED") <(echo "$TS_PRESENT")) + if [ -n "$UNLISTED" ]; then + echo "::warning::.ts files not in TS_FILES, no .qm built:" $UNLISTED + fi + find "$QM_SRC" -maxdepth 1 -name 'qet_*.qm' -exec cp {} "$FILES/lang/" \; 2>/dev/null || true + QM_PRESENT=$(find "$FILES/lang" -maxdepth 1 -name 'qet_*.qm' -exec basename {} .qm \; | LC_ALL=C sort) + MISSING=$(LC_ALL=C comm -23 <(echo "$TS_LISTED") <(echo "$QM_PRESENT")) + QM_COUNT=$(printf '%s\n' "$QM_PRESENT" | grep -c . || true) + TS_COUNT=$(printf '%s\n' "$TS_LISTED" | grep -c .) + echo "=== $QM_COUNT .qm files copied to files/lang/ (expected: $TS_COUNT) ===" + if [ -n "$MISSING" ]; then + echo "ERROR: missing translations:" $MISSING + find "$GITHUB_WORKSPACE/build" -name '*.qm' || true + exit 1 + fi + + # Qt's own translations (OK/Cancel buttons, standard dialogs...): + # they come from qtbase_XX.qm, not from QET's .ts, and windeployqt + # runs with --no-translations. QETApp::setLanguage() falls back to + # lang/qt_XX.qm, so copy each qtbase_XX.qm there under that name + # (qtbase_XX.qm is standalone, unlike Qt's qt_XX.qm meta catalogs). + QT_TR_DIR=/ucrt64/share/qt6/translations + if [ ! -d "$QT_TR_DIR" ]; then + QT_TR_DIR=$(cygpath -u "$(/ucrt64/bin/qtpaths6 --query QT_INSTALL_TRANSLATIONS 2>/dev/null)" 2>/dev/null || true) + fi + find "$QT_TR_DIR" -maxdepth 1 -name 'qtbase_*.qm' 2>/dev/null | while read -r f; do + l=$(basename "$f" .qm) + cp "$f" "$FILES/lang/qt_${l#qtbase_}.qm" + done + # QET languages Qt only ships with a region (pt -> pt_PT, zh -> zh_CN): + # QTranslator only shortens codes (fr_FR -> fr), it never extends them. + for q in $TS_LISTED; do + l=${q#qet_} + if [ ! -e "$FILES/lang/qt_$l.qm" ]; then + if [ -e "$QT_TR_DIR/qtbase_${l}_${l^^}.qm" ]; then + alt="$QT_TR_DIR/qtbase_${l}_${l^^}.qm" + else + alt=$(find "$QT_TR_DIR" -maxdepth 1 -name "qtbase_${l}_*.qm" 2>/dev/null | LC_ALL=C sort | head -1 || true) + fi + if [ -n "$alt" ]; then + cp "$alt" "$FILES/lang/qt_$l.qm" + fi + fi + done + QT_QM_COUNT=$(find "$FILES/lang" -maxdepth 1 -name 'qt_*.qm' | wc -l) + echo "=== $QT_QM_COUNT Qt translation files (qt_*.qm) copied from $QT_TR_DIR ===" + if [ "$QT_QM_COUNT" -eq 0 ]; then + echo "ERROR: no qtbase_*.qm found in '$QT_TR_DIR' (mingw-w64-ucrt-x86_64-qt6-translations installed?)" + exit 1 + fi for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE; do cp "$GITHUB_WORKSPACE/$f" "$FILES/$f" 2>/dev/null || true @@ -594,8 +314,8 @@ jobs: # Deliberately NOT parsed from sources/qetversion.cpp: the CI job # already knows for certain it configured Qt6 (-DQT_VERSION_MAJOR=6), - # so the "0.200.1" experimental-track label is set here explicitly - # rather than relying on in-binary Qt version detection. + # so the "0.200.1" version label is set here explicitly rather than + # relying on in-binary Qt version detection. VERSION="0.200.1" FULL_VERSION="${VERSION}-qt6-r${HEAD}-${GITCOMMIT}_x86_64-win64" @@ -704,43 +424,47 @@ jobs: retention-days: 40 # --------------------------------------------------------------------------- - # Job 3 : Publie les assets nightly (exe + zip, Qt5 et Qt6) sur la release + # Job 2 : Publie les assets nightly (exe + zip) sur la release # Ne tourne que sur push master (pas sur les PRs) # --------------------------------------------------------------------------- publish-nightly-assets: - needs: [build-windows, build-windows-qt6] + needs: [build-windows-qt6] runs-on: ubuntu-latest if: github.event_name != 'pull_request' permissions: contents: write steps: - - name: Download installer artifacts (Qt5 + Qt6) + - name: Download installer artifact uses: actions/download-artifact@v8 with: pattern: qelectrotech-windows-installer* path: downloaded/installer/ merge-multiple: true - - name: Download portable artifacts (Qt5 + Qt6) + - name: Download portable artifact uses: actions/download-artifact@v8 with: pattern: qelectrotech-*-readytouse path: downloaded/portable/ merge-multiple: true - - name: Delete old nightly assets (.exe and .zip) + # Only Qt6-tagged assets are deleted/replaced here. Assets without "qt6" + # in the name are the frozen Qt5 legacy build (last one ever published, + # before the Qt5 CI job was removed) — deliberately left untouched so + # they stay downloadable indefinitely instead of disappearing. + - name: Delete old nightly Qt6 assets (.exe and .zip) env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} run: | gh release view nightly --repo "$REPO" --json assets \ - --jq '.assets[] | select(.name | test("\\.(exe|zip)$")) | .name' \ + --jq '.assets[] | select(.name | test("qt6")) | select(.name | test("\\.(exe|zip)$")) | .name' \ | while read -r name; do - echo "Deleting old asset: $name" + echo "Deleting old Qt6 asset: $name" gh release delete-asset nightly "$name" --repo "$REPO" --yes done - echo "Old .exe and .zip assets deleted." + echo "Old Qt6 .exe and .zip assets deleted (legacy Qt5 assets left untouched)." - name: Update nightly release uses: softprops/action-gh-release@v3 @@ -759,8 +483,7 @@ jobs: > ⚠️ This is a development version; it introduces new features you want, but may cause bugs that have not yet been identified yet. > For stable releases, see the [Releases page](https://github.com/${{ github.repository }}/releases). - > 🧪 **Qt6 builds are experimental.** Files tagged `-qt6-` are built against Qt6 and are not yet - > as tested as the Qt5 track. Expect rough edges; report issues clearly labelled "Qt6". + > 🗄️ Files without `-qt6-` in the name are the last Qt5 build ever published (frozen, unmaintained). Files tagged `-qt6-` are the actively maintained build. prerelease: true make_latest: false files: | @@ -769,4 +492,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} # GitHub Pages is generated and deployed by windows-msi.yml - # after the MSI upload, so that all URLs (exe/zip/msi, Qt5+Qt6) are known. + # after the MSI upload, so that all URLs (exe/zip/msi) are known. diff --git a/.github/workflows/windows-msi.yml b/.github/workflows/windows-msi.yml index 3020a179c..1a9751c4e 100644 --- a/.github/workflows/windows-msi.yml +++ b/.github/workflows/windows-msi.yml @@ -25,26 +25,27 @@ jobs: strategy: fail-fast: false + # Single-entry matrix kept on purpose (rather than flattening the job): + # matrix.flavor is used as part of the MSI ProductCode seed, so changing + # it would generate a new ProductCode and break upgrade detection for + # existing installs. Keeping "qt6" here preserves continuity. matrix: include: - - flavor: qt5 - portable_artifact: qelectrotech-windows-portable - version_source: qetversion # parsed from sources/qetversion.cpp - label_suffix: "" - experimental: false - flavor: qt6 portable_artifact: qelectrotech-windows-portable-qt6 version_source: hardcoded # see note in "Extract version" step - label_suffix: "-qt6-EXPERIMENTAL" - experimental: true + label_suffix: "-qt6" + experimental: false permissions: contents: write pages: write id-token: write # Required by SignPath + env: + SIGNPATH_API_TOKEN: ${{ secrets.SIGNPATH_API_TOKEN }} + outputs: - qt5_msi: ${{ steps.export.outputs.msi_name_qt5 }} qt6_msi: ${{ steps.export.outputs.msi_name_qt6 }} steps: @@ -58,28 +59,50 @@ jobs: # ---------------------------------------------------------------- # 2. Download the portable artifact for this flavor + # + # Wrapped in nick-fields/retry: actions/download-artifact@v8 has + # shown repeated "Artifact download failed after 5 retries" + # failures on this cross-workflow download (via run-id) — not a + # real content/digest problem, just flaky Azure blob delivery. + # Two separate occurrences observed within days of each other + # (different artifact IDs/digests, same failure signature), each + # one enough to fail build-msi outright and block the rest of the + # pipeline. Retrying the whole download 3x is cheap insurance. + # Switched to `gh run download` here because nick-fields/retry + # can only retry a shell command, not re-invoke a `uses:` step. # ---------------------------------------------------------------- - name: Download portable artifact - uses: actions/download-artifact@v8 + uses: nick-fields/retry@v3 with: - name: ${{ matrix.portable_artifact }} - path: artifact\files - # workflow_run => use the triggering run's ID - # workflow_dispatch => use input run_id if provided, otherwise current run - run-id: ${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }} - github-token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }} + timeout_minutes: 10 + max_attempts: 3 + retry_wait_seconds: 30 + shell: pwsh + command: | + if (Test-Path "artifact\files") { Remove-Item -Recurse -Force "artifact\files" } + New-Item -ItemType Directory -Force -Path "artifact\files" | Out-Null + + $runId = "${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }}" + gh run download $runId ` + --repo "${{ github.repository }}" ` + --name "${{ matrix.portable_artifact }}" ` + --dir "artifact\files" + + if ($LASTEXITCODE -ne 0) { + Write-Error "gh run download failed (exit $LASTEXITCODE)" + exit $LASTEXITCODE + } + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # ---------------------------------------------------------------- # 3. Extract version - # Qt5: parsed from sources/qetversion.cpp (single source of truth - # for the software's own reported version). # Qt6: hardcoded "0.200.1" here — deliberately NOT parsed from the # binary/source, since Qt-version self-detection inside the # compiled code proved unreliable (see commit e1aa65f). The CI # matrix entry already knows for certain which flavor it is - # packaging, so the experimental-track label is set explicitly - # at the packaging level instead. + # packaging, so the version label is set explicitly at the + # packaging level instead. # ---------------------------------------------------------------- - name: Extract version id: version @@ -125,10 +148,9 @@ jobs: Write-Host "Version MSI : $verMsi" Write-Host "Version display : $verDisplay" - # Qt platform argument: only Qt5 needs the QTBUG-83161 font-rendering - # workaround (GDI backend). Qt6 uses DirectWrite by default and does - # not need it. Computed once here so both the bundled "Lancer QET.bat" - # and the MSI shortcuts (wix build -d QtPlatformArgs=...) stay in sync. + # Qt platform argument: kept from the Qt5 era (QTBUG-83161 + # font-rendering workaround, GDI backend). Qt6 uses DirectWrite by + # default and does not need it, so this always resolves empty now. if ("${{ matrix.flavor }}" -eq "qt5") { $qtArgs = "-platform windows:fontengine=freetype" } else { @@ -228,10 +250,10 @@ jobs: Write-Host "Lancer QET.bat replaced for MSI installation (qtArgs: '$qtArgs')." # ---------------------------------------------------------------- - # 9. Build the MSI (unsigned) - # Qt6 (experimental) uses a distinct ProductCode seed so it never - # collides with / upgrades over the Qt5 MSI — they must be able to - # coexist as clearly separate installs. + # 9. Build the MSI (unsigned at this stage — signing happens below) + # Qt6 keeps its own ProductCode seed (distinct from the retired Qt5 + # MSI), so a machine that still has the old Qt5 MSI installed gets a + # separate, coexisting install rather than an unexpected upgrade. # ---------------------------------------------------------------- - name: Build MSI shell: pwsh @@ -289,12 +311,20 @@ jobs: retention-days: 1 if-no-files-found: error - # Qt6 stays on the unsigned/experimental track (no signing request for - # this flavor), and forks never have the SignPath secrets, so guard on - # both: only qt5, and only in the upstream repo. + # Qt6 is now signed too (previously excluded while Qt5 was the stable + # track and Qt6 was experimental-only). The remaining guard is the fork + # check: forks never have the SignPath secrets, and a fork-originated + # PR/run must never attempt a signing request. # (cf. DieterMayerOSS:fix/msi-signing-fork-guard, d3f60c88) + # continue-on-error: SignPath's certificate is still pending validation + # (Sept 2026) — the signing request currently fails with a 500 on the + # SignPath side. Kept non-blocking so the nightly MSI still ships + # (unsigned) while the certificate is pending. Remove + # continue-on-error once the certificate is confirmed active. - name: Sign MSI via SignPath - if: matrix.flavor == 'qt5' && github.repository == 'qelectrotech/qelectrotech-source-mirror' + id: sign + if: github.repository == 'qelectrotech/qelectrotech-source-mirror' && env.SIGNPATH_API_TOKEN != '' + continue-on-error: true uses: signpath/github-action-submit-signing-request@v2 with: api-token: ${{ secrets.SIGNPATH_API_TOKEN }} @@ -306,7 +336,22 @@ jobs: wait-for-completion: true output-artifact-directory: 'dist\' + # If signing succeeded, SignPath already overwrote dist\*.msi with the + # signed copy (output-artifact-directory above) — nothing to do here. + # If it failed/was skipped, dist\*.msi is still the unsigned MSI from + # the "Build MSI" step, so the rest of the pipeline just ships that. + - name: Report signing status + if: always() + shell: pwsh + run: | + if ("${{ steps.sign.outcome }}" -eq "success") { + Write-Host "MSI signed successfully via SignPath." + } else { + Write-Warning "MSI signing skipped or failed (outcome: ${{ steps.sign.outcome }}) — shipping UNSIGNED MSI. Likely cause: SignPath certificate still pending validation." + } + - name: Upload signed MSI artifact + if: always() uses: actions/upload-artifact@v7 with: name: qelectrotech-windows-msi-${{ matrix.flavor }} @@ -314,21 +359,28 @@ jobs: retention-days: 40 if-no-files-found: error - - name: Delete old nightly .msi asset for this flavor + - name: Delete old nightly .msi asset + # Only run if a new MSI actually exists in dist/ — otherwise the old + # (still working) nightly .msi would be deleted without anything to + # replace it, leaving the nightly release with no MSI at all until + # the next successful build (see windows-msi-pipeline notes, + # run 35694391567: an upstream artifact-download failure meant + # dist\*.msi never existed for that run). + if: always() && hashFiles('dist/*.msi') != '' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} run: | - $pattern = if ("${{ matrix.flavor }}" -eq "qt6") { "-qt6-EXPERIMENTAL.*\\.msi$" } else { "\\.msi$" } + $pattern = "-qt6.*\\.msi$" $names = gh release view nightly --repo $env:REPO --json assets --jq ".assets[] | select(.name | test(`"$pattern`")) | .name" foreach ($name in ($names -split "`n" | Where-Object { $_ })) { - if ("${{ matrix.flavor }}" -eq "qt5" -and $name -match "-qt6-EXPERIMENTAL") { continue } Write-Host "Deleting old asset: $name" gh release delete-asset nightly $name --repo $env:REPO --yes } shell: pwsh - name: Upload MSI to nightly release + if: always() uses: softprops/action-gh-release@v3 with: tag_name: nightly @@ -342,11 +394,7 @@ jobs: shell: pwsh run: | $name = "$env:MSI_NAME" - if ("${{ matrix.flavor }}" -eq "qt6") { - echo "msi_name_qt6=$name" >> $env:GITHUB_OUTPUT - } else { - echo "msi_name_qt5=$name" >> $env:GITHUB_OUTPUT - } + echo "msi_name_qt6=$name" >> $env:GITHUB_OUTPUT - name: Summary if: always() @@ -354,16 +402,29 @@ jobs: run: | Write-Host "=== MSI build summary (${{ matrix.flavor }}) ===" Write-Host "Version : ${{ steps.version.outputs.VERSION_DISPLAY }}" - Write-Host "Experimental : ${{ matrix.experimental }}" + Write-Host "Signed : ${{ steps.sign.outcome == 'success' }}" # --------------------------------------------------------------------------- - # Job 2 : Génère et déploie la page GitHub Pages une fois les DEUX MSI - # (Qt5 + Qt6) publiés, pour que toutes les URLs soient connues. + # Job 2 : Génère et déploie la page GitHub Pages une fois le MSI publié, + # pour que toutes les URLs soient connues. # --------------------------------------------------------------------------- deploy-pages: needs: build-msi runs-on: ubuntu-latest - if: always() && needs.build-msi.result == 'success' + # Regenerate the page whenever the MSI job actually ran (success OR + # packaging/signing failure) — not only on full success. + # generate-page.py queries the published assets on the "nightly" + # release itself (line 407: `gh release view nightly --json assets`), + # so it already handles a missing MSI natively (empty MSI_NAME -> no + # MSI button on the page). The page only needs the exe/zip already + # published by windows-build.yml, independent of the MSI's fate. + # Only "skipped"/"cancelled" are excluded: if build-msi never ran at + # all (e.g. Windows Build itself failed), there is nothing new to + # publish and regenerating the page would be pointless. + if: > + always() && + needs.build-msi.result != 'skipped' && + needs.build-msi.result != 'cancelled' permissions: contents: write pages: write @@ -388,13 +449,17 @@ jobs: ASSETS=$(gh release view nightly --repo "$REPO" --json assets --jq '.assets[].name') - EXE_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.exe$' | head -1) - ZIP_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.zip$' | head -1) - MSI_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.msi$' | head -1 || echo "") + EXE_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.exe$' | head -1) + ZIP_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.zip$' | head -1) + MSI_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.msi$' | head -1 || echo "") - EXE_QT6_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.exe$' | head -1 || echo "") - ZIP_QT6_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.zip$' | head -1 || echo "") - MSI_QT6_NAME=$(echo "$ASSETS" | grep 'qt6' | grep '\.msi$' | head -1 || echo "") + # Legacy Qt5 assets (no "qt6" in the name): last ever published, + # frozen — windows-build.yml/windows-msi.yml no longer delete or + # replace these, so they keep pointing at the same files release + # after release. Rendered as a separate "legacy" section if present. + LEGACY_EXE_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.exe$' | head -1 || echo "") + LEGACY_ZIP_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.zip$' | head -1 || echo "") + LEGACY_MSI_NAME=$(echo "$ASSETS" | grep -v 'qt6' | grep '\.msi$' | head -1 || echo "") BASE="https://github.com/$REPO/releases/download/nightly" INSTALLER_URL="$BASE/$EXE_NAME" @@ -402,12 +467,12 @@ jobs: MSI_URL="" [ -n "$MSI_NAME" ] && MSI_URL="$BASE/$MSI_NAME" - INSTALLER_QT6_URL="" - PORTABLE_QT6_URL="" - MSI_QT6_URL="" - [ -n "$EXE_QT6_NAME" ] && INSTALLER_QT6_URL="$BASE/$EXE_QT6_NAME" - [ -n "$ZIP_QT6_NAME" ] && PORTABLE_QT6_URL="$BASE/$ZIP_QT6_NAME" - [ -n "$MSI_QT6_NAME" ] && MSI_QT6_URL="$BASE/$MSI_QT6_NAME" + LEGACY_INSTALLER_URL="" + LEGACY_PORTABLE_URL="" + LEGACY_MSI_URL="" + [ -n "$LEGACY_EXE_NAME" ] && LEGACY_INSTALLER_URL="$BASE/$LEGACY_EXE_NAME" + [ -n "$LEGACY_ZIP_NAME" ] && LEGACY_PORTABLE_URL="$BASE/$LEGACY_ZIP_NAME" + [ -n "$LEGACY_MSI_NAME" ] && LEGACY_MSI_URL="$BASE/$LEGACY_MSI_NAME" SHA="${{ github.event.workflow_run.head_sha || github.sha }}" SHORT="${SHA:0:7}" @@ -417,7 +482,7 @@ jobs: export DATE SHORT REPO SHA RUN_URL RUN_NUMBER export INSTALLER_URL PORTABLE_URL MSI_URL - export INSTALLER_QT6_URL PORTABLE_QT6_URL MSI_QT6_URL + export LEGACY_INSTALLER_URL LEGACY_PORTABLE_URL LEGACY_MSI_URL python3 source/build-aux/generate-page.py diff --git a/.gitignore b/.gitignore index 94e81b2fc..b82fdca84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.snap .flatpak-builder +__pycache__/ +*.pyc # Qt build output *.user # doxygen Doxyfile output diff --git a/CMakeLists.txt b/CMakeLists.txt index 45b539de4..6eab8e105 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ include(cmake/hoto_update_cmake_message.cmake) cmake_minimum_required(VERSION 3.5...4.2) project(qelectrotech - VERSION 0.100.1 + VERSION 0.200.1 DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features." HOMEPAGE_URL "https://qelectrotech.org/" LANGUAGES C CXX) @@ -28,39 +28,12 @@ include(cmake/copyright_message.cmake) set(QET_DIR ${PROJECT_SOURCE_DIR}) -# QT_VERSION_MAJOR is chosen explicitly by whoever configures the build, -# via -DQT_VERSION_MAJOR=5 or -DQT_VERSION_MAJOR=6. -# Default to Qt5 (current stable) when not specified, so existing -# CI/scripts that don't pass this option keep working unchanged. -# This must happen BEFORE add_subdirectory(tests) and the fetch_*.cmake -# includes below, so every subdirectory and every FetchContent dependency -# sees a consistent, already-defined value. -if(NOT DEFINED QT_VERSION_MAJOR) - set(QT_VERSION_MAJOR 5) -endif() - -# Some third-party CMake projects we pull in via FetchContent (e.g. -# SingleApplication) don't know about QET_VERSION_MAJOR: they follow Qt's -# own "QT_DEFAULT_MAJOR_VERSION" convention instead, and silently default -# to Qt5 if it isn't set. Propagate our choice so they stay in sync, -# otherwise they can end up linked against a different Qt major version -# than the rest of QET, which breaks AUTOMOC with an -# INTERFACE_QT_MAJOR_VERSION mismatch at generate time. -set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use (5 or 6)" FORCE) - -# Add sub directories -option(PACKAGE_TESTS "Build the tests" ON) -if(PACKAGE_TESTS) - message("Add sub directory tests") - add_subdirectory(tests) -endif() include(cmake/paths_compilation_installation.cmake) include(cmake/start_options.cmake) include(cmake/developer_options.cmake) include(cmake/git_update_submodules.cmake) include(cmake/git_last_commit_sha.cmake) -include(cmake/fetch_kdeaddons.cmake) include(cmake/fetch_singleapplication.cmake) include(cmake/fetch_pugixml.cmake) include(cmake/qet_compilation_vars.cmake) @@ -73,17 +46,76 @@ SET(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package( - Qt${QT_VERSION_MAJOR} + Qt6 COMPONENTS ${QET_COMPONENTS} REQUIRED) -# Qt6 only creates the Qt::GuiPrivate target (used for QPdfEngine::drawHyperlink) -# when the GuiPrivate component is explicitly requested. Qt5 has no such -# component package and creates the target implicitly with Gui, so only -# request it on Qt6 - requesting it on Qt5 fails the whole configure. -if(QT_VERSION_MAJOR GREATER_EQUAL 6) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS GuiPrivate) +# (QPdfEngine::drawHyperlink) needs Qt's private GUI module. +# Qt >= 6.7 ships it as a proper find_package component, but some distro +# packages (e.g. Ubuntu's qt6-base-private-dev) omit Qt6GuiPrivateConfig.cmake +# and only provide the implicit Qt6::GuiPrivate target created alongside +# Qt6::Gui. Try the component quietly, then verify the target below so a +# missing private-headers package fails here instead of at compile time. +find_package(Qt6 QUIET COMPONENTS GuiPrivate) + +if(NOT TARGET Qt6::GuiPrivate) + message(FATAL_ERROR + "Qt6::GuiPrivate was not found. It is required for PDF hyperlink " + "support (). Install the Qt6 private headers " + "(e.g. 'qt6-base-private-dev' on Debian/Ubuntu) or use a Qt build " + "that provides the GuiPrivate component.") +endif() + +# PDF page import (toolbar "Ajouter un PDF") needs the QtPdf module and, +# specifically, QPdfDocument::pagePointSize() which only exists since Qt 6.4. +# Unlike GuiPrivate above, a missing QtPdf module is NOT fatal here: some +# Qt6 distributions (e.g. the Flatpak org.kde.Platform runtime) don't ship +# it at all, since it lives in the qtwebengine source tree rather than Qt6 +# core. When it's missing, or too old, the feature is silently disabled - +# see the QT_VERSION_CHECK / QET_HAS_QTPDF guards in diagrameventaddpdf.* +# and pdfpagesdialog.*. +set(QET_HAS_QTPDF FALSE) +find_package(Qt6 QUIET COMPONENTS Pdf) +if(TARGET Qt6::Pdf AND NOT Qt6_VERSION VERSION_LESS 6.4.0) + set(QET_HAS_QTPDF TRUE) + list(APPEND QET_PRIVATE_LIBRARIES Qt::Pdf) + add_compile_definitions(QET_HAS_QTPDF) +else() + message(STATUS "QtPdf module not available (or Qt < 6.4): PDF page import feature disabled") +endif() + +# JavaScript scripting (bugtracker #162: `--run script.js`, and later a +# "Run Script..." menu action) needs QJSEngine, in the Qml module. As with +# QtPdf above, this is not fatal when missing: some minimal Qt6 packagings +# may not ship it, and scripting is optional functionality nothing else in +# the application depends on. When it's missing the feature is silently +# disabled - see the QET_HAS_SCRIPTING guard in qetscripting.*. +set(QET_HAS_SCRIPTING FALSE) +find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Qml) +if(TARGET Qt${QT_VERSION_MAJOR}::Qml) + set(QET_HAS_SCRIPTING TRUE) + list(APPEND QET_PRIVATE_LIBRARIES Qt::Qml) + add_compile_definitions(QET_HAS_SCRIPTING) +else() + message(STATUS "Qt Qml module not available: JavaScript scripting (--run) disabled") +endif() + +# The crash handler writes a backtrace into the dump. Detecting this with +# __has_include() is not enough: the header is present on FreeBSD +# too, but backtrace() lives in a separate libexecinfo there, so the compile +# succeeds and the link fails. FindBacktrace resolves both the header and +# whichever library actually provides the symbol, so gate on it instead - see +# the QET_CRASH_BACKTRACE guard in sources/logging/crashhandler.cpp. +find_package(Backtrace QUIET) +if(Backtrace_FOUND) + list(APPEND QET_PRIVATE_LIBRARIES ${Backtrace_LIBRARIES}) + include_directories(${Backtrace_INCLUDE_DIRS}) + add_compile_definitions(QET_CRASH_BACKTRACE) +else() + message(STATUS + "backtrace() not available: crash dumps will carry the log ring " + "without a backtrace") endif() find_package(SQLite3 REQUIRED) @@ -100,25 +132,15 @@ endif() set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui) -# The default build only compiles the tracked .ts files to .qm (lrelease). -# Refreshing the .ts from the sources (lupdate) is a developer action behind -# the explicit "update_translations" target below: running lupdate on every -# build rewrote tracked files as a side effect, and under high parallelism -# lupdate rewriting a .ts while lrelease read the same file made the build -# fail with "Premature end of document". -set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang") -if(QT_VERSION_MAJOR EQUAL 6) - qt6_add_translation(QM_FILES ${TS_FILES}) -else() - qt5_add_translation(QM_FILES ${TS_FILES}) -endif() +include(cmake/fetch_kdeaddons.cmake) -add_custom_target(update_translations - COMMAND $ ${CMAKE_SOURCE_DIR}/sources -ts ${TS_FILES} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Updating .ts files from sources/ (lupdate) - developer target, run explicitly" - VERBATIM -) +# Add sub directories +option(PACKAGE_TESTS "Build the tests" ON) +if(PACKAGE_TESTS) + message("Add sub directory tests") + enable_testing() + add_subdirectory(tests) +endif() # als laatse include(cmake/define_definitions.cmake) @@ -134,6 +156,7 @@ if(WIN32) ${QET_SRC_FILES} ${QM_FILES} ${QET_DIR}/qelectrotech.qrc + ${QET_DIR}/ico/icon-themes.qrc ) else() add_executable( @@ -142,9 +165,91 @@ else() ${QET_SRC_FILES} ${QM_FILES} ${QET_DIR}/qelectrotech.qrc + ${QET_DIR}/ico/icon-themes.qrc ) endif() +if(APPLE) + # CFBundleIdentifier must not be empty. CMake's default Info.plist + # template fills it from MACOSX_BUNDLE_GUI_IDENTIFIER; with that unset + # the bundle ships an empty identifier, LaunchServices never registers + # the .app, and AppKit's open/save panel service (which is keyed on the + # client's bundle id) silently presents nothing -- every + # QFileDialog::getOpenFileName()/getSaveFileName() call returns an empty + # string without a panel ever appearing, so File > Open and File > Save + # as do nothing at all. + set_target_properties(${PROJECT_NAME} PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_GUI_IDENTIFIER "org.qelectrotech.QElectroTech" + MACOSX_BUNDLE_BUNDLE_NAME "QElectroTech" + MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}" + MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}" + MACOSX_BUNDLE_COPYRIGHT "Copyright 2006-2026 The QElectroTech Team" + ) +endif() + +# The default build only compiles the tracked .ts files to .qm (lrelease). +# Refreshing the .ts from the sources (lupdate) is a developer action behind +# the explicit "update_translations" target below: running lupdate on every +# build rewrote tracked files as a side effect, and under high parallelism +# lupdate rewriting a .ts while lrelease read the same file made the build +# fail with "Premature end of document". +set_source_files_properties( + ${TS_FILES} + PROPERTIES OUTPUT_LOCATION "lang" +) +if(Qt6_VERSION VERSION_LESS "6.2") + # Qt 6.0–6.1 + qt6_add_translation(QM_FILES ${TS_FILES}) + + # qt6_add_translation() only creates custom commands. Something must + # depend on their outputs for them to run during the default build. + add_custom_target(${PROJECT_NAME}_lrelease ALL + DEPENDS ${QM_FILES} + ) + + add_custom_target(update_translations + COMMAND + $ + "${CMAKE_SOURCE_DIR}/sources" + -ts ${TS_FILES} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + COMMENT + "Updating .ts files from sources/ (lupdate) - developer target" + VERBATIM + ) + +elseif(Qt6_VERSION VERSION_LESS "6.7") + # Qt 6.2–6.6: old target-based signature + qt_add_lrelease( + ${PROJECT_NAME} + TS_FILES ${TS_FILES} + QM_FILES_OUTPUT_VARIABLE QM_FILES + ) + + # Automatically creates the update_translations umbrella target. + qt_add_lupdate( + ${PROJECT_NAME} + TS_FILES ${TS_FILES} + ) + +else() + # Qt 6.7+: new signature + qt_add_lrelease( + TS_FILES ${TS_FILES} + LRELEASE_TARGET ${PROJECT_NAME}_lrelease + QM_FILES_OUTPUT_VARIABLE QM_FILES + ) + + qt_add_lupdate( + SOURCE_TARGETS ${PROJECT_NAME} + TS_FILES ${TS_FILES} + LUPDATE_TARGET update_translations + NO_GLOBAL_TARGET + ) +endif() + + # Optional precompiled headers -- see QET_ENABLE_PCH in # cmake/developer_options.cmake for what this trades away. # @@ -180,7 +285,7 @@ target_link_libraries( pugixml::pugixml SingleApplication::SingleApplication SQLite3::SQLite3 - ${KF5_PRIVATE_LIBRARIES} + ${KF_PRIVATE_LIBRARIES} ${QET_PRIVATE_LIBRARIES} ) @@ -213,7 +318,6 @@ target_include_directories( ${QET_DIR}/sources/NameList ${QET_DIR}/sources/NameList/ui ${QET_DIR}/sources/utils - ${QET_DIR}/pugixml/src ${QET_DIR}/sources/dataBase ${QET_DIR}/sources/dataBase/ui ${QET_DIR}/sources/factory/ui @@ -221,7 +325,7 @@ target_include_directories( ${QET_DIR}/sources/svg ) -if(NOT BUILD_WITH_KF5) +if(NOT BUILD_WITH_KF) target_include_directories( ${PROJECT_NAME} PRIVATE @@ -229,7 +333,9 @@ if(NOT BUILD_WITH_KF5) ) endif() -install(TARGETS ${PROJECT_NAME}) +install(TARGETS ${PROJECT_NAME} + BUNDLE DESTINATION . +) if (NOT MINGW) install(DIRECTORY ico/breeze-icons/16x16 DESTINATION ${QET_ICONS_PATH}) diff --git a/ChangeLog_full.md b/ChangeLog_full.md index e72d5f4bc..869ca1ff4 100644 --- a/ChangeLog_full.md +++ b/ChangeLog_full.md @@ -20,6 +20,7 @@ All notable changes to QElectroTech are documented here. ### 🐛 Bug Fixes +- Fix #798: clamp element-editor and diagram-view zoom to prevent view-transform overflow crash on scroll-wheel zoom ([3ca5d4a](../../commit/3ca5d4ab2)) - Fix(windows-msi): inject rev into MSI Version Build field ([e19f523](../../commit/e19f5232277efb37435cb65a83563d73333d62ec)) - Fix #391: use wide-char path for pugixml on Windows to handle Unicode paths ([31edf30](../../commit/31edf30c619213368e9b592b51be6ca8190db831)) - Fix(#283): restore center alignment when loading table config ([f55ba56](../../commit/f55ba568f68293e06436899bcc831431e9d27295)) diff --git a/Doxyfile b/Doxyfile index 86052291d..02f275398 100644 --- a/Doxyfile +++ b/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = QElectroTech # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = " 0.100.0-dev" +PROJECT_NUMBER = " 0.200.1" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/ELEMENTS.LICENSE b/ELEMENTS.LICENSE index 4ac88b654..ed97f9c28 100644 --- a/ELEMENTS.LICENSE +++ b/ELEMENTS.LICENSE @@ -1,3 +1,20 @@ +[ca] +La col·lecció d'elements que s'inclou amb QElectrotech es proporciona tal com és +i sense cap garantia que sigui adequada per al vostre ús o que funcioni correctament. +L'ús, la modificació i la integració d'aquests elements en esquemes elèctrics +estan permesos sense restriccions, independentment de la llicència final que regeixi +els esquemes. +No es permet utilitzar aquest programari ni cap fitxer associat +com a dades de mostra per crear models d'aprenentatge automàtic. + +Si redistribuïu la totalitat o una part de la col·lecció QElectroTech, +amb o sense modificacions, fora d'un esquema elèctric, heu de complir +les condicions de la llicència CC-BY: +Aquesta obra està subjecta a la llicència Reconeixement 3.0, +disponible en línia a http://creativecommons.org/licenses/by/3.0/ o bé +sol·licitant-la per correu a Creative Commons, 171 Second Street, Suite 300, San Francisco, +Califòrnia 94105, EUA. + [en] The elements collection provided along with QElectroTech is provided as is and without any warranty of fitness for your purpose or working. @@ -96,19 +113,6 @@ Para ver una copia de esta licencia, visite http://creativecommons.org/licenses/by/3.0/ o envie una carta a Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA. -[ca] -La col·lecció de símbols QElectrotech és distribuïda tal qual i sense cap -garantia d'idoneïtat d'ús ni de funcionament. -Es permet incondicionalment, amb independència de la llicència final, emprar, -editar, i incloure aquests símbols en esquemes elèctrics. -Si vostè redistribueix una part de la col·lecció de QElectrotech o tota ella, -amb condicions o sense, separadament d'un esquema elèctric, haurà de respectar -les condicions de la llicència CC-BY: -Aquesta obra es troba sota una llicència Reconeixement 3.0 de Creative Commons. -Per veure una còpia d'aquesta llicència visiti -http://creativecommons.org/licenses/by/3.0/ o enviï una carta a Creative -Commons, 171 Second Street, Suite 300, San Francisco, California 94105, - [cs] Sbírka prvků poskytovaná společně s QElectroTechem je poskytována tak, jak je, bez záruky nebo vhodnosti pro váš účal nebo práci. diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 04817c0cf..000000000 --- a/INSTALL +++ /dev/null @@ -1,179 +0,0 @@ -[Qt6 / CMake] -Building the Qt6 line with CMake additionally requires the private -development headers of QtGui. On Debian/Ubuntu these live in a separate -package that is NOT pulled in by qt6-base-dev: - - apt install qt6-base-private-dev - -(other distributions: install your Qt 6 "private headers" development -package, e.g. qt6-qtbase-private-devel on Fedora) - -QET needs the private QtGui API (QPdfEngine) for clickable hyperlinks in -the PDF export. Without the package, find_package(Qt6 ... GuiPrivate) -succeeds but CMake later fails at generate time with: -"Imported target Qt6::GuiPrivate includes non-existent path". - -[ca] -Dependències: -libQt5 (paquets libqt5*) -cupsys-bsd per imprimir - -Com compilar: -$ qmake (qmake-qt5 pels sistemes basats en Debian) -$ make -# umask 0022 -# make install - -[en] -Requirements : -libQt5 (see packages libqt5*) -cupsys-bsd for printing - -Howto compile : -$ qmake (qmake-qt5 for Debian-based systems) -$ make -# umask 0022 -# make install - -[fr] -Pré-requis : -libQt5 (paquets libqt5*) -cupsys-bsd pour l'impression - -Comment compiler : -$ qmake (qmake-qt5 pour les systèmes basés sur Debian) -$ make -# umask 0022 -# make install - -[de] -Abhängigkeiten: -libQt5 (Pakete libqt5*) -cupsys-bsd zum Drucken - -Kompilieren: -$ qmake (qmake-qt5 für Debian-basierende Systeme) -$ make -# umask 0022 -# make install - -[ru] -Зависимости: -libQt5 (пакет libqt5*) -cupsys-bsd для печати - -Как компилировать?: -$ qmake (qmake-qt5 для систем основанных на Debian) -$ make -# umask 0022 -# make install - -[pt] -Dependências: -libQt5 (ver pacotes libqt5*) -cupsys-bsd para impressão - -Como compilar: -$ qmake (qmake-qt5 para sistemas baseados em Debian) -$ make -# umask 0022 -# make install - -[es] -Dependencias: -libQt5 (paquetes libqt5*) -cupsys-bsd para imprimir - -Cómo compilar: -$ qmake (qmake-qt5 para los sistemas basados en Debian) -$ make -# umask 0022 -# make install - -[cs] -Požadavky : -libQt5 (viz balíček libqt5*) -cupsys-bsd kvůli tisku - -Jak program sestavit : -$ qmake (qmake-qt5 u systémů založených na Debianu) -$ make -# umask 0022 -# make install - -[pl] -Zależności: -libQt5 (pakiety libqt5 *) -cupsys-bsd do druku - -Sposób kompilacji: -$ qmake (qmake-qt5 dla systemów opartych na Debianie) -$ make -# umask 0022 -# make install - -[it] -Dipendenze: -libQt5 (vedi pacchetti libqt5*) -cupsys-bsd per la stampa - -Come compilare: -$ qmake (qmake-qt5 per sistemi basati su Debian) -$ make -# umask 0022 -# make install - -[el] -Απαιτήσεις: -libQt5 (δείτε για πακέτα libqt5*) -cupsys-bsd για εκτύπωση - -Πως να το μεταγλωττίσετε: -$ qmake (qmake-qt5 για συστήματα βασισμένα σε Debian) -$ make -# umask 0022 -# make install - -[nl] -vereisten: -libqt5 (zie pakketten libqt5 *) -cupsys-bsd om af te drukken - -Hoe te compileren: - $ Qmake (qmake-qt5 voor Debian-gebaseerde systemen) - $ make - # Umask 0022 - # Make install - -[be] -Vereisten: -libQt5 (pakketten libqt5*) -cupsys-bsd voor het afdrukken - -Hoe te compileren : -$ qmake (qmake-qt5 voor systemen op basis van Debian) -$ make -# umask 0022 -# make install - -[da] -Krav: -libQt5 (se pakke libqt5*) -cupsys-bsd til udskrivning - -Hvordan man kompilerer: -$ qmake (qmake-qt5 for Debian baserede systemer) -$ make -# umask 0022 -# make install - -[ja] -必要条件 : -libQt5 (パッケージ libqt5* を参照) -cupsys-bsd 印刷用 - -コンパイルの方法 : -$ qmake (Debian ベースのシステムでは qmake-qt5) -$ make -# umask 0022 -# make install diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 000000000..eeb14e741 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,365 @@ +# Building QElectroTech from source + +QElectroTech is built with **CMake** and requires the **current Qt6 only**; Qt5 and the +old `qmake`-based build described in earlier versions of this file have +been retired. + +## 1. Getting the source + +QET uses git submodules, so clone recursively: + +```sh +git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror.git +cd qelectrotech-source-mirror +``` + +If you already have a non-recursive clone: + +```sh +git submodule update --init --recursive +``` + +## 2. Requirements + +| Component | Status | Notes | +|---|---|---| +| CMake ≥ 3.5 | required | CMake 4.3+ is also fine, see note below | +| C++17 compiler | required | GCC or Clang on Unix-like platforms; MSVC or MinGW-w64 g++ on Windows — see [Choosing a compiler](#3-choosing-a-compiler-unix) / [Building on Windows](#6-building-on-windows-msvc--mingw) | +| Qt6 base + widgets | required | | +| Qt6 **GuiPrivate** headers | required | needed for clickable PDF hyperlinks; **hard build failure** at CMake generate time if missing, see below | +| SQLite3 | required | used by the nomenclature/summary database | +| Qt Linguist tools (`lrelease`) | required | compiles the tracked `.ts` files into `.qm` as part of every normal build | +| pugixml | handled automatically | fetched and built via CMake FetchContent if not already present on the system — see [pugixml](#8-pugixml) below | +| Qt Test module | required if building tests | `PACKAGE_TESTS` is `ON` by default; QtTest ships as part of the base Qt6 dev packages listed below on every platform, no extra package needed | +| KDE Frameworks (KF6) | optional | see [Building without KDE Frameworks](#9-building-without-kde-frameworks) | +| QtPdf module | optional | see [PDF page import](#7-pdf-page-import-qtpdf) | + +A note on CMake versions: the project declares a minimum of 3.5 but is +routinely built with much newer releases; if your CMake is older than 4.3 it +simply won't have the newer `SQLite3::SQLite3` target name, which the build +script compensates for automatically. There is nothing you need to do either +way. + +## 3. Building (out-of-source build) + +Always build in a separate directory from the source tree — in-source builds +are not supported. + +```sh +mkdir build +cd build +cmake .. +cmake --build . --parallel +``` + +For a Unix-like platform you'll usually also want an explicit build type, +since CMake's default (empty) build type means no optimization and no +debug info either: + +```sh +cmake .. -DCMAKE_BUILD_TYPE=Release +``` + +To install (default prefix is `/usr/local`; adjust with +`-DCMAKE_INSTALL_PREFIX=...` at the configure step if needed): + +```sh +sudo cmake --install . +``` + +Useful configure-time options (pass as `-D