few changes for running on windows
This commit is contained in:
6 files changed
+119
-110
No files matched your search
@@ -2,15 +2,9 @@
|
|||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(find:*)",
|
"Bash(find:*)",
|
||||||
"Bash(grep -iv -E '^\\(png|jpg|JPG|gif|mp4|exe|cache|js|css|php|java|cs|properties|class|form|PAS|CPP\\)$')",
|
|
||||||
"Bash(cmake:*)",
|
|
||||||
"Bash(for d:*)",
|
|
||||||
"Bash(do echo:*)",
|
|
||||||
"Read(//home/agel/Src/asteria/asteria-bookreader/src/components/**)",
|
|
||||||
"Bash(done)",
|
|
||||||
"Bash(ctest:*)",
|
|
||||||
"Bash(grep:*)",
|
"Bash(grep:*)",
|
||||||
"Bash(./build/ReadingModelTest 2>&1)"
|
"Bash(cmake:*)",
|
||||||
|
"Bash(ctest:*)",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,17 @@ Full target format list (derived from actual library inventory):
|
|||||||
|
|
||||||
See [README.md](README.md) for setup instructions, dependency installation, and IDE-specific build guides.
|
See [README.md](README.md) for setup instructions, dependency installation, and IDE-specific build guides.
|
||||||
|
|
||||||
|
### Windows Build Environment
|
||||||
|
|
||||||
|
**All build and test commands on Windows must be run in the MSYS2 MINGW64 shell** (`C:\msys64\mingw64`). This is the only shell where `cmake`, `ninja`, `gcc`, and all Qt/third-party libraries are on `PATH`. Do not use PowerShell, CMD, or the plain MSYS2 shell — they lack the correct toolchain and package prefix.
|
||||||
|
|
||||||
|
To run a command from Claude Code on Windows, invoke it via the MSYS2 MINGW64 bash:
|
||||||
|
```bash
|
||||||
|
/c/msys64/mingw64/bin/bash.exe -c "<command>"
|
||||||
|
# or equivalently:
|
||||||
|
C:/msys64/usr/bin/bash.exe -i -c "<command>"
|
||||||
|
```
|
||||||
|
|
||||||
## Test-Driven Development
|
## Test-Driven Development
|
||||||
|
|
||||||
**All new backend logic must be test-driven.** Follow the red-green-refactor cycle strictly:
|
**All new backend logic must be test-driven.** Follow the red-green-refactor cycle strictly:
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ find_package(Qt6 OPTIONAL_COMPONENTS Pdf DBus)
|
|||||||
# Third-party libraries
|
# Third-party libraries
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(UCHARDET REQUIRED uchardet)
|
pkg_check_modules(UCHARDET REQUIRED uchardet)
|
||||||
|
find_package(Iconv REQUIRED)
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
@@ -67,6 +68,7 @@ endif()
|
|||||||
|
|
||||||
target_include_directories(asteria-qt PRIVATE ${UCHARDET_INCLUDE_DIRS})
|
target_include_directories(asteria-qt PRIVATE ${UCHARDET_INCLUDE_DIRS})
|
||||||
target_link_libraries(asteria-qt PRIVATE ${UCHARDET_LIBRARIES})
|
target_link_libraries(asteria-qt PRIVATE ${UCHARDET_LIBRARIES})
|
||||||
|
target_link_libraries(asteria-qt PRIVATE Iconv::Iconv)
|
||||||
|
|
||||||
# Set resource aliases so src/qml/* maps to qrc:/Asteria/*
|
# Set resource aliases so src/qml/* maps to qrc:/Asteria/*
|
||||||
set_source_files_properties(src/qml/Main.qml PROPERTIES QT_RESOURCE_ALIAS Main.qml)
|
set_source_files_properties(src/qml/Main.qml PROPERTIES QT_RESOURCE_ALIAS Main.qml)
|
||||||
@@ -83,6 +85,8 @@ set_source_files_properties(src/qml/pages/ReaderPage.qml PROPERTIES QT_RESOURCE_
|
|||||||
set_source_files_properties(src/qml/pages/SettingsPage.qml PROPERTIES QT_RESOURCE_ALIAS pages/SettingsPage.qml)
|
set_source_files_properties(src/qml/pages/SettingsPage.qml PROPERTIES QT_RESOURCE_ALIAS pages/SettingsPage.qml)
|
||||||
|
|
||||||
# QML module
|
# QML module
|
||||||
|
qt_policy(SET QTP0004 NEW)
|
||||||
|
|
||||||
qt_add_qml_module(asteria-qt
|
qt_add_qml_module(asteria-qt
|
||||||
URI Asteria
|
URI Asteria
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
@@ -120,6 +124,7 @@ function(add_asteria_test TEST_NAME TEST_SOURCE)
|
|||||||
)
|
)
|
||||||
target_include_directories(${TEST_NAME} PRIVATE ${UCHARDET_INCLUDE_DIRS})
|
target_include_directories(${TEST_NAME} PRIVATE ${UCHARDET_INCLUDE_DIRS})
|
||||||
target_link_libraries(${TEST_NAME} PRIVATE ${UCHARDET_LIBRARIES})
|
target_link_libraries(${TEST_NAME} PRIVATE ${UCHARDET_LIBRARIES})
|
||||||
|
target_link_libraries(${TEST_NAME} PRIVATE Iconv::Iconv)
|
||||||
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ A cross-platform desktop book/document reader built with Qt6/C++. Reimplementati
|
|||||||
|
|
||||||
- **Qt 6.4+** (6.4 minimum for QtPdf; 6.5+ recommended)
|
- **Qt 6.4+** (6.4 minimum for QtPdf; 6.5+ recommended)
|
||||||
- **CMake 3.16+**
|
- **CMake 3.16+**
|
||||||
- **C++17 compiler** — GCC 10+ or Clang 12+ on Linux; MSVC 2022 on Windows
|
- **C++17 compiler** — GCC 10+ or Clang 12+ on Linux; MinGW-w64 (GCC) via MSYS2 on Windows
|
||||||
|
|
||||||
## Installing Dependencies
|
## Installing Dependencies
|
||||||
|
|
||||||
@@ -38,38 +38,86 @@ cmake --find-package -DNAME=Qt6 -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
**Step 1 — Install Qt 6 manually** via the Qt Online Installer (qt.io/download-open-source):
|
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.
|
||||||
- Select component: `Qt 6.x → MSVC 2022 64-bit`
|
|
||||||
- Also select: `Qt PDF`, `Qt SVG` under the same Qt version
|
|
||||||
|
|
||||||
**Step 2 — Install toolchain and third-party libs** (run in an elevated PowerShell):
|
**Step 1 — Install Git for Windows**
|
||||||
|
|
||||||
```powershell
|
Download and install from [git-scm.com/download/win](https://git-scm.com/download/win). During setup:
|
||||||
scripts\install-deps-windows.ps1
|
- Select "Git from the command line and also from 3rd-party software" (recommended PATH option)
|
||||||
|
- Use the default options for everything else
|
||||||
|
|
||||||
|
**Step 2 — Install MSYS2**
|
||||||
|
|
||||||
|
Download and run the installer from [msys2.org](https://www.msys2.org). Use the default install path (`C:\msys64`).
|
||||||
|
|
||||||
|
After installation, open the **MSYS2 MINGW64** shell (search the Start menu for "MSYS2 MINGW64" — use this shell, not MSYS2 MSYS or UCRT64) and update the package database:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman -Syu
|
||||||
```
|
```
|
||||||
|
|
||||||
Installs: VS Build Tools 2022, CMake, Ninja, Git, vcpkg, and third-party libs (QuaZip, uchardet, DjVuLibre, libwpd) via vcpkg.
|
The shell will likely close itself partway through. Reopen it and run the update again to finish:
|
||||||
|
|
||||||
**Step 3 — Configure CMake** with your Qt install path:
|
```bash
|
||||||
|
pacman -Syu
|
||||||
```powershell
|
|
||||||
cmake -B build -DCMAKE_PREFIX_PATH="C:\Qt\6.x.x\msvc2022_64" `
|
|
||||||
-DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `6.x.x` with your installed Qt version (e.g. `6.7.2`).
|
**Step 3 — Install Qt 6 and all dependencies**
|
||||||
|
|
||||||
|
In the **MSYS2 MINGW64** shell, navigate to the project folder and run the install script (MSYS2 mounts Windows drives as `/c/`, `/d/` etc.):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /c/path/to/asteria-qt
|
||||||
|
bash scripts/install-deps-windows.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Or install manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman -S --needed \
|
||||||
|
mingw-w64-x86_64-gcc \
|
||||||
|
mingw-w64-x86_64-zlib \
|
||||||
|
mingw-w64-x86_64-qt6-base \
|
||||||
|
mingw-w64-x86_64-qt6-declarative \
|
||||||
|
mingw-w64-x86_64-qt6-tools \
|
||||||
|
mingw-w64-x86_64-qt6-shadertools \
|
||||||
|
mingw-w64-x86_64-qt6-svg \
|
||||||
|
mingw-w64-x86_64-cmake \
|
||||||
|
mingw-w64-x86_64-ninja \
|
||||||
|
mingw-w64-x86_64-uchardet \
|
||||||
|
mingw-w64-x86_64-quazip \
|
||||||
|
mingw-w64-x86_64-djvulibre \
|
||||||
|
mingw-w64-x86_64-libwpd
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify the installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmake6 --version
|
||||||
|
gcc --version
|
||||||
|
cmake --version
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 4 — Clone the repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/your-org/asteria-qt.git
|
||||||
|
cd asteria-qt
|
||||||
|
```
|
||||||
|
|
||||||
## Building
|
## 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.
|
||||||
|
|
||||||
### Command Line
|
### Command Line
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Debug build (Linux — Qt6 found automatically after running install script)
|
# Debug build
|
||||||
cmake -B build -DCMAKE_BUILD_TYPE=Debug
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||||
cmake --build build --parallel
|
cmake --build build --parallel
|
||||||
|
|
||||||
# Release build
|
# Release build
|
||||||
cmake -B build-release -DCMAKE_BUILD_TYPE=Release
|
cmake -B build-release -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build build-release --parallel
|
cmake --build build-release --parallel
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
@@ -80,7 +128,7 @@ ctest --test-dir build --output-on-failure
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/asteria-qt # Linux
|
./build/asteria-qt # Linux
|
||||||
./build/asteria-qt.exe # Windows
|
./build/asteria-qt.exe # Windows (run from MSYS2 MINGW64 shell)
|
||||||
```
|
```
|
||||||
|
|
||||||
### CLion
|
### CLion
|
||||||
@@ -89,27 +137,19 @@ ctest --test-dir build --output-on-failure
|
|||||||
2. CLion auto-detects `CMakeLists.txt` and configures
|
2. CLion auto-detects `CMakeLists.txt` and configures
|
||||||
3. Select a CMake profile (Debug/Release) in Settings → Build, Execution, Deployment → CMake
|
3. Select a CMake profile (Debug/Release) in Settings → Build, Execution, Deployment → CMake
|
||||||
4. Build: `Ctrl+F9` / `⌘F9` | Run: `Shift+F10` / `⌃R`
|
4. Build: `Ctrl+F9` / `⌘F9` | Run: `Shift+F10` / `⌃R`
|
||||||
5. On Windows: set `CMAKE_PREFIX_PATH` to your Qt install path in the CMake profile options field
|
5. On Windows: set the toolchain to use MSYS2's MinGW (`C:\msys64\mingw64\bin\gcc.exe`) under Settings → Build, Execution, Deployment → Toolchains; leave GDB set to **Bundled** — MSYS2's GDB is newer than CLion supports
|
||||||
|
|
||||||
### VSCode
|
### VSCode
|
||||||
|
|
||||||
1. Install extensions: **C/C++**, **CMake Tools**
|
1. Install extensions: **C/C++**, **CMake Tools**
|
||||||
2. Open the project root
|
2. Open the project root
|
||||||
3. CMake Tools detects `CMakeLists.txt` automatically; select a kit (GCC on Linux, MSVC on Windows)
|
3. CMake Tools detects `CMakeLists.txt` automatically
|
||||||
4. On Windows, add to `.vscode/settings.json`:
|
4. On Windows: when prompted to select a kit, choose the MSYS2 MinGW64 GCC kit (points to `C:\msys64\mingw64\bin\gcc.exe`)
|
||||||
```json
|
|
||||||
{
|
|
||||||
"cmake.configureArgs": [
|
|
||||||
"-DCMAKE_PREFIX_PATH=C:\\Qt\\6.x.x\\msvc2022_64",
|
|
||||||
"-DCMAKE_TOOLCHAIN_FILE=C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
5. Build: `Ctrl+Shift+B` | Run: `F5` (with `launch.json`) or CMake Tools' Run button
|
5. Build: `Ctrl+Shift+B` | Run: `F5` (with `launch.json`) or CMake Tools' Run button
|
||||||
|
|
||||||
### Qt Creator
|
### Qt Creator
|
||||||
|
|
||||||
1. File → Open File or Project → select `CMakeLists.txt`
|
1. File → Open File or Project → select `CMakeLists.txt`
|
||||||
2. Configure the kit (Qt 6 kit must be registered under Edit → Preferences → Kits)
|
2. Configure the kit under Edit → Preferences → Kits
|
||||||
3. Build: `Ctrl+B` / `⌘B` | Run: `Ctrl+R` / `⌘R`
|
3. On Windows: add a kit pointing to MSYS2's Qt (`C:\msys64\mingw64`) and MinGW compiler
|
||||||
4. On Windows: ensure the Qt 6 MSVC kit is selected
|
4. Build: `Ctrl+B` / `⌘B` | Run: `Ctrl+R` / `⌘R`
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
# Install all development dependencies for asteria-qt on Windows.
|
|
||||||
# Requires: winget (Windows 10 1709+) and an internet connection.
|
|
||||||
# Run in an elevated (Administrator) PowerShell session.
|
|
||||||
#
|
|
||||||
# After running this script you must add Qt to your PATH / CMAKE_PREFIX_PATH.
|
|
||||||
# The default Qt install path is: C:\Qt\6.x.x\msvc2022_64\
|
|
||||||
|
|
||||||
#Requires -RunAsAdministrator
|
|
||||||
Set-StrictMode -Version Latest
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
|
|
||||||
# ── Build tools ────────────────────────────────────────────────────────────────
|
|
||||||
Write-Host "Installing build tools..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
# Visual Studio Build Tools 2022 (C++ compiler, MSBuild)
|
|
||||||
winget install --id Microsoft.VisualStudio.2022.BuildTools --silent --override `
|
|
||||||
"--wait --quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
winget install --id Kitware.CMake --silent
|
|
||||||
|
|
||||||
# Ninja
|
|
||||||
winget install --id Ninja-build.Ninja --silent
|
|
||||||
|
|
||||||
# Git
|
|
||||||
winget install --id Git.Git --silent
|
|
||||||
|
|
||||||
# ── Qt 6 ───────────────────────────────────────────────────────────────────────
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Qt 6 cannot be installed via winget in a fully unattended way." -ForegroundColor Yellow
|
|
||||||
Write-Host "Install it manually using the Qt Online Installer:" -ForegroundColor Yellow
|
|
||||||
Write-Host " https://www.qt.io/download-open-source" -ForegroundColor Cyan
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "In the installer, select Qt 6.7+ and check these components:" -ForegroundColor Yellow
|
|
||||||
Write-Host " - MSVC 2022 64-bit"
|
|
||||||
Write-Host " - Qt PDF"
|
|
||||||
Write-Host " - Qt Quick / Qt Declarative (included by default)"
|
|
||||||
Write-Host " - Qt SVG"
|
|
||||||
Write-Host " - Qt Shader Tools"
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "After installing, set CMAKE_PREFIX_PATH in your build commands:" -ForegroundColor Yellow
|
|
||||||
Write-Host ' cmake -B build -DCMAKE_PREFIX_PATH="C:\Qt\6.7.0\msvc2022_64"' -ForegroundColor Cyan
|
|
||||||
|
|
||||||
# ── vcpkg (for third-party C++ libs) ──────────────────────────────────────────
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Installing vcpkg for third-party libraries..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
$vcpkgDir = "C:\vcpkg"
|
|
||||||
if (-not (Test-Path $vcpkgDir)) {
|
|
||||||
git clone https://github.com/microsoft/vcpkg.git $vcpkgDir
|
|
||||||
& "$vcpkgDir\bootstrap-vcpkg.bat" -disableMetrics
|
|
||||||
} else {
|
|
||||||
Write-Host "vcpkg already present at $vcpkgDir" -ForegroundColor Green
|
|
||||||
}
|
|
||||||
|
|
||||||
# ── Third-party libraries via vcpkg ───────────────────────────────────────────
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Installing third-party libraries via vcpkg (x64-windows)..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
$vcpkg = "$vcpkgDir\vcpkg.exe"
|
|
||||||
& $vcpkg install `
|
|
||||||
uchardet:x64-windows `
|
|
||||||
quazip:x64-windows `
|
|
||||||
minizip:x64-windows `
|
|
||||||
djvulibre:x64-windows `
|
|
||||||
libwpd:x64-windows
|
|
||||||
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Done. Add vcpkg toolchain to your CMake configure command:" -ForegroundColor Green
|
|
||||||
Write-Host " -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -ForegroundColor Cyan
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Install all dependencies for asteria-qt on Windows via MSYS2.
|
||||||
|
# Run this script from the MSYS2 MINGW64 shell:
|
||||||
|
# bash scripts/install-deps-windows.sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Installing Qt 6 and dependencies via pacman..."
|
||||||
|
|
||||||
|
pacman -S --needed \
|
||||||
|
mingw-w64-x86_64-gcc \
|
||||||
|
mingw-w64-x86_64-zlib \
|
||||||
|
mingw-w64-x86_64-qt6-base \
|
||||||
|
mingw-w64-x86_64-qt6-declarative \
|
||||||
|
mingw-w64-x86_64-qt6-tools \
|
||||||
|
mingw-w64-x86_64-qt6-shadertools \
|
||||||
|
mingw-w64-x86_64-qt6-svg \
|
||||||
|
mingw-w64-x86_64-cmake \
|
||||||
|
mingw-w64-x86_64-ninja \
|
||||||
|
mingw-w64-x86_64-uchardet \
|
||||||
|
mingw-w64-x86_64-quazip \
|
||||||
|
mingw-w64-x86_64-djvulibre \
|
||||||
|
mingw-w64-x86_64-libwpd
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Done. Verify with:"
|
||||||
|
echo " qmake6 --version"
|
||||||
|
echo " gcc --version"
|
||||||
|
echo " cmake --version"
|
||||||
Reference in new issue
Block a user