diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 871206e..cff1e79 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -8,7 +8,10 @@ "Bash(ctest:*)", "Bash(*cmake.exe*)", "Bash(*ninja.exe*)", - "Bash(*ctest.exe*)" + "Bash(*ctest.exe*)", + "Bash(qmake6 --version)", + "Bash(pkg-config --modversion Qt6Core)", + "Bash(dpkg -l)" ] } } diff --git a/README.md b/README.md index fef11cd..5bb0b85 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A cross-platform desktop book/document reader built with Qt6/C++. Reimplementati ## Prerequisites -- **Qt 6.4+** (6.4 minimum for QtPdf; 6.5+ recommended) +- **Qt 6.10.x** (installed via `aqtinstall` to `/opt/qt`; Ubuntu apt only ships 6.4 which is too old) - **CMake 3.16+** - **C++17 compiler** — GCC 10+ or Clang 12+ on Linux; MinGW-w64 (GCC) via MSYS2 on Windows @@ -18,24 +18,17 @@ A cross-platform desktop book/document reader built with Qt6/C++. Reimplementati sudo scripts/install-deps-ubuntu.sh ``` -The script installs the following package groups: +The script installs Qt 6.10.1 via `aqtinstall` to `/opt/qt/6.10.1/gcc_64`, plus the following apt packages: | Group | Packages | Required? | |---|---|---| -| Qt6 core | `qt6-base-dev`, `qt6-declarative-dev`, `qt6-tools-dev` | Required | -| Qt6 extras | `libqt6svg6-dev`, `qt6-shader-baker` | Required | -| Qt6 PDF | `libqt6pdf6-dev` | Optional (PDF support) | +| Build tools | `build-essential`, `cmake`, `ninja-build`, `git` | Required | +| Qt compile deps | `libgl1-mesa-dev`, `libxkbcommon-dev` | Required | | Encoding | `libuchardet-dev` | Required (TXT encoding detection) | -| Archive | `libquazip-qt6-dev`, `libminizip-dev` | Required (EPUB/ZIP) | +| Archive | `libminizip-dev` | Required (EPUB/ZIP) | | DjVu | `libdjvulibre-dev` | Optional (DjVu support) | | DOC | `libwpd-dev` | Optional (legacy .doc support) | -After the script runs it prints a CMake verify step — run it to confirm Qt6 is found: - -```bash -cmake --find-package -DNAME=Qt6 -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST -``` - ### Windows All Windows dependencies — Qt 6, MinGW-w64, CMake, Ninja, and all third-party libraries — are installed through **MSYS2**, a Linux-like environment for Windows with a proper package manager (`pacman`). This ensures everything is compiled with the same GCC toolchain with no ABI mismatches. @@ -107,17 +100,23 @@ cd asteria-qt ## Building -All build commands run in the **MSYS2 MINGW64** shell on Windows, or a regular terminal on Linux. No extra CMake flags are needed on Windows — MSYS2 installs everything to a standard prefix that CMake finds automatically. +All build commands run in the **MSYS2 MINGW64** shell on Windows, or a regular terminal on Linux. + +On Linux, pass `-DCMAKE_PREFIX_PATH=/opt/qt/6.10.1/gcc_64` so CMake finds the aqt-installed Qt. On Windows, MSYS2 installs everything to a standard prefix that CMake finds automatically. ### Command Line ```bash -# Debug build +# Debug build (Linux) +cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt/6.10.1/gcc_64 +cmake --build build --parallel + +# Debug build (Windows — no prefix needed) cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug cmake --build build --parallel -# Release build -cmake -B build-release -G Ninja -DCMAKE_BUILD_TYPE=Release +# Release build (Linux) +cmake -B build-release -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/qt/6.10.1/gcc_64 cmake --build build-release --parallel # Run tests diff --git a/scripts/install-deps-ubuntu.sh b/scripts/install-deps-ubuntu.sh index 2f3a5e6..7cd6f99 100755 --- a/scripts/install-deps-ubuntu.sh +++ b/scripts/install-deps-ubuntu.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # Install all development dependencies for asteria-qt on Ubuntu/Debian. # Tested on Ubuntu 24.04. Run with sudo or as root. +# Qt 6.10.x is installed via aqtinstall to /opt/qt — the Ubuntu apt repo only +# ships Qt 6.4, which is too old (qt_policy QTP0004 requires Qt 6.8+). set -euo pipefail @@ -13,33 +15,18 @@ apt-get install -y \ ninja-build \ git -# ── Qt 6 core development ────────────────────────────────────────────────────── -# qt6-base-dev : Core, Gui, Widgets, Network, SQL, ... -# qt6-declarative-* : QML / Qt Quick -# qt6-tools-* : CMake find_package integration, lupdate, lrelease -# qt6-shadertools : Required by Qt Quick renderer -# qt6-svg-dev : SVG icon support +# ── OpenGL and XKB headers (required by Qt at compile time) ─────────────────── apt-get install -y \ - qt6-base-dev \ - qt6-base-dev-tools \ - qt6-declarative-dev \ - qt6-declarative-dev-tools \ - qt6-tools-dev \ - qt6-tools-dev-tools \ - qt6-shadertools-dev \ - qt6-svg-dev - -# ── Qt 6 PDF (for PDF format support) ───────────────────────────────────────── -apt-get install -y qt6-pdf-dev + libgl1-mesa-dev \ + libxkbcommon-dev # ── Encoding detection ───────────────────────────────────────────────────────── apt-get install -y libuchardet-dev # ── ZIP extraction (EPUB, DOCX, ODT) ────────────────────────────────────────── -# QuaZip is the Qt-idiomatic wrapper; minizip is the underlying C lib. -apt-get install -y \ - libquazip1-qt6-dev \ - libminizip-dev +# minizip is the underlying C lib; QuaZip will be built from source against the +# aqt Qt when EPUB support is added. +apt-get install -y libminizip-dev # ── DjVu support ─────────────────────────────────────────────────────────────── apt-get install -y libdjvulibre-dev @@ -47,9 +34,24 @@ apt-get install -y libdjvulibre-dev # ── Legacy .doc support (libwpd) ─────────────────────────────────────────────── apt-get install -y libwpd-dev +# ── Qt 6.10.1 via aqtinstall ────────────────────────────────────────────────── +# We use a temporary venv so aqtinstall doesn't pollute the system Python env. +apt-get install -y python3-venv + echo "" -echo "All dependencies installed. Qt6 version:" -dpkg -l qt6-base-dev | awk '/^ii/{print $3}' +echo "Installing Qt 6.10.1 via aqtinstall → /opt/qt ..." +python3 -m venv /tmp/aqt-venv +/tmp/aqt-venv/bin/pip install --quiet aqtinstall +/tmp/aqt-venv/bin/aqt install-qt linux desktop 6.10.1 linux_gcc_64 \ + --outputdir /opt/qt \ + --log /tmp/aqt-install.log +rm -rf /tmp/aqt-venv /tmp/aqt-install.log + echo "" -echo "Verify CMake can find Qt6:" -echo " cmake -B /tmp/qt6-test -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/cmake" +echo "All dependencies installed." +echo "" +echo "Qt 6.10.1 is at /opt/qt/6.10.1/gcc_64" +echo "" +echo "Build with:" +echo " cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt/6.10.1/gcc_64" +echo " cmake --build build --parallel"