Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
run: |
cmake -B build \
-DDECOMPRESSION_BACKEND=unarr \
-DPDF_BACKEND=poppler \
-DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" \
-DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel 2
Expand Down Expand Up @@ -113,6 +114,7 @@ jobs:
run: |
cmake -B build \
-DDECOMPRESSION_BACKEND=7zip \
-DPDF_BACKEND=poppler \
-DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" \
-DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel 2
Expand Down Expand Up @@ -151,7 +153,7 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: "11"
run: |
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
VERSION="$(tr -d '\r\n' < VERSION)"
SKIP_CODESIGN="${{ env.IS_FORK }}"
SKIP_CODESIGN=$(echo "$SKIP_CODESIGN" | tr '[:upper:]' '[:lower:]')
./compileOSX.sh $VERSION ${{ needs.initialization.outputs.build_number }} $SKIP_CODESIGN Qt6 universal
Expand Down Expand Up @@ -201,7 +203,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=C:\Qt\6.9.3\msvc2022_64\bin;%PATH%
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_64
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DPDF_BACKEND=pdfium -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_64
cmake --build build --parallel

- name: Run tests
Expand Down Expand Up @@ -346,7 +348,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
set PATH=C:\Qt\6.9.3\msvc2022_arm64\bin;%PATH%
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_arm64 -DQT_HOST_PATH=C:\Qt\6.9.3\msvc2022_64 -DCMAKE_SYSTEM_PROCESSOR=ARM64
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DPDF_BACKEND=pdfium -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_arm64 -DQT_HOST_PATH=C:\Qt\6.9.3\msvc2022_64 -DCMAKE_SYSTEM_PROCESSOR=ARM64
cmake --build build --parallel

- name: Upload executables for signing
Expand Down Expand Up @@ -508,7 +510,7 @@ jobs:
- name: Get version
id: version
run: |
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' ).${{ needs.initialization.outputs.build_number }}"
VERSION="$(tr -d '\r\n' < VERSION).${{ needs.initialization.outputs.build_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

Expand Down Expand Up @@ -575,7 +577,7 @@ jobs:
- name: Get version
id: version
run: |
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
VERSION="$(tr -d '\r\n' < VERSION)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

Expand Down Expand Up @@ -646,7 +648,7 @@ jobs:
- name: Get version
id: version
run: |
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' ).${{ needs.initialization.outputs.build_number }}"
VERSION="$(tr -d '\r\n' < VERSION).${{ needs.initialization.outputs.build_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ cmake --build build --config Release --target release_translations
```

Important:
- Do not run `lupdate` only on `qml.qrc` (or only on a subset of files), because that can mark unrelated translations as obsolete.
- In `YACReaderLibrary`, `qt_add_translations(...)` is configured to scan full target sources and include QML from `qml.qrc`.
- Do not run `lupdate` only on a hand-picked subset of QML files, because that can mark unrelated translations as obsolete.
- In `YACReaderLibrary`, `qt_add_translations(...)` is configured to scan full target sources and include the QML files directly.
- `update_translations` updates both locale TS files and `*_source.ts` template files for all apps.
- `*_source.ts` files are translator base templates and must not be treated as shipped locales.

Expand Down
136 changes: 77 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.25...4.3.1)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" YACREADER_VERSION)
string(STRIP "${YACREADER_VERSION}" YACREADER_VERSION)
if(NOT YACREADER_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
message(FATAL_ERROR "VERSION must contain a semantic version like x.y.z")
endif()

project(YACReader
VERSION 10.0.0
VERSION ${YACREADER_VERSION}
LANGUAGES C CXX
)

Expand Down Expand Up @@ -30,47 +36,77 @@ endif()

# Install paths
include(GNUInstallDirs)
find_package(PkgConfig)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Compiler options (MSVC flags, NOMINMAX, etc.)
# Compiler options (MSVC flags)
include(cmake/CompilerOptions.cmake)

# --- Build options ---

# Archive decompression backend (mutually exclusive)
set(DECOMPRESSION_BACKEND "" CACHE STRING "Archive backend: unarr | 7zip | libarchive")
set_property(CACHE DECOMPRESSION_BACKEND PROPERTY STRINGS "unarr" "7zip" "libarchive")

# PDF rendering backend (mutually exclusive)
set(PDF_BACKEND "" CACHE STRING "PDF backend: pdfium | poppler | pdfkit | no_pdf")
set_property(CACHE PDF_BACKEND PROPERTY STRINGS "pdfium" "poppler" "pdfkit" "no_pdf")

# Build configuration
option(BUILD_TESTS "Build tests" ON)
option(BUILD_SERVER_STANDALONE "Server standalone install (Linux only)" OFF)

# Build number (set by CI)
set(BUILD_NUMBER "" CACHE STRING "CI build number")

set(YACREADER_DECOMPRESSION_BACKENDS unarr 7zip libarchive)
set(YACREADER_PDF_BACKENDS pdfium poppler pdfkit no_pdf)

# --- Platform defaults (mirrors config.pri) ---
if(NOT DECOMPRESSION_BACKEND OR DECOMPRESSION_BACKEND STREQUAL "")
if(UNIX AND NOT APPLE)
set(DECOMPRESSION_BACKEND "unarr")
else()
set(DECOMPRESSION_BACKEND "7zip")
endif()
message(STATUS "DECOMPRESSION_BACKEND defaulted to: ${DECOMPRESSION_BACKEND}")
endif()

if(NOT PDF_BACKEND OR PDF_BACKEND STREQUAL "")
if(UNIX AND NOT APPLE)
set(PDF_BACKEND "poppler")
elseif(APPLE)
set(PDF_BACKEND "pdfkit")
else()
set(PDF_BACKEND "pdfium")
endif()
message(STATUS "PDF_BACKEND defaulted to: ${PDF_BACKEND}")
if(UNIX AND NOT APPLE)
set(_default_decompression_backend "unarr")
set(_default_pdf_backend "poppler")
elseif(APPLE)
set(_default_decompression_backend "7zip")
set(_default_pdf_backend "pdfkit")
else()
set(_default_decompression_backend "7zip")
set(_default_pdf_backend "pdfium")
endif()

# Archive decompression backend (mutually exclusive)
set(_decompression_backend_value "")
if(DEFINED CACHE{DECOMPRESSION_BACKEND})
set(_decompression_backend_value "$CACHE{DECOMPRESSION_BACKEND}")
endif()
if(_decompression_backend_value STREQUAL "")
set(_decompression_backend_value "${_default_decompression_backend}")
string(JOIN ", " _available_decompression_backends ${YACREADER_DECOMPRESSION_BACKENDS})
message(STATUS
"DECOMPRESSION_BACKEND not set, defaulting to ${_decompression_backend_value}. "
"Available: ${_available_decompression_backends}.")
endif()
set(DECOMPRESSION_BACKEND "${_decompression_backend_value}" CACHE STRING
"Archive backend: unarr | 7zip | libarchive" FORCE)
set_property(CACHE DECOMPRESSION_BACKEND PROPERTY STRINGS ${YACREADER_DECOMPRESSION_BACKENDS})
if(NOT DECOMPRESSION_BACKEND IN_LIST YACREADER_DECOMPRESSION_BACKENDS)
string(JOIN ", " _valid_decompression_backends ${YACREADER_DECOMPRESSION_BACKENDS})
message(FATAL_ERROR
"Unknown DECOMPRESSION_BACKEND: '${DECOMPRESSION_BACKEND}'. "
"Use one of: ${_valid_decompression_backends}")
endif()

# PDF rendering backend (mutually exclusive)
set(_pdf_backend_value "")
if(DEFINED CACHE{PDF_BACKEND})
set(_pdf_backend_value "$CACHE{PDF_BACKEND}")
endif()
if(_pdf_backend_value STREQUAL "")
set(_pdf_backend_value "${_default_pdf_backend}")
string(JOIN ", " _available_pdf_backends ${YACREADER_PDF_BACKENDS})
message(STATUS
"PDF_BACKEND not set, defaulting to ${_pdf_backend_value}. "
"Available: ${_available_pdf_backends}.")
endif()
set(PDF_BACKEND "${_pdf_backend_value}" CACHE STRING
"PDF backend: pdfium | poppler | pdfkit | no_pdf" FORCE)
set_property(CACHE PDF_BACKEND PROPERTY STRINGS ${YACREADER_PDF_BACKENDS})
if(NOT PDF_BACKEND IN_LIST YACREADER_PDF_BACKENDS)
string(JOIN ", " _valid_pdf_backends ${YACREADER_PDF_BACKENDS})
message(FATAL_ERROR
"Unknown PDF_BACKEND: '${PDF_BACKEND}'. "
"Use one of: ${_valid_pdf_backends}")
endif()

# macOS universal binary default
Expand All @@ -94,6 +130,7 @@ else()
Core
Core5Compat
Gui
GuiPrivate
LinguistTools
Multimedia
Network
Expand All @@ -113,14 +150,11 @@ endif()
qt_standard_project_setup()

# PDF backend detection (creates pdf_backend_iface INTERFACE target)
include(cmake/PdfBackend.cmake)
include(PdfBackend)

# Output directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

# Build number define
if(BUILD_NUMBER)
add_compile_definitions("BUILD_NUMBER=\"${BUILD_NUMBER}\"")
if(WIN32 OR APPLE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
endif()

# --- Subdirectories (dependency order) ---
Expand Down Expand Up @@ -156,37 +190,21 @@ if(BUILD_TESTS AND NOT BUILD_SERVER_STANDALONE)
add_subdirectory(tests)
endif()

# --- Linux top-level install rules ---
if(UNIX AND NOT APPLE)
# Man pages
if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.1")
install(FILES YACReader.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/YACReaderLibrary.1")
install(FILES YACReaderLibrary.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()

# Desktop files
if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.desktop")
install(FILES YACReader.desktop YACReaderLibrary.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
endif()

# Icons
if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.svg")
install(FILES YACReader.svg YACReaderLibrary.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
endif()
# Summary
if(CMAKE_CONFIGURATION_TYPES)
string(JOIN ", " _configured_build_types ${CMAKE_CONFIGURATION_TYPES})
set(_build_type_summary "multi-config (${_configured_build_types})")
else()
set(_build_type_summary "${CMAKE_BUILD_TYPE}")
endif()

# Summary
message(STATUS "")
message(STATUS "YACReader ${PROJECT_VERSION} build configuration:")
message(STATUS " Decompression backend: ${DECOMPRESSION_BACKEND}")
message(STATUS " PDF backend: ${PDF_BACKEND}")
message(STATUS " Build tests: ${BUILD_TESTS}")
message(STATUS " Server standalone: ${BUILD_SERVER_STANDALONE}")
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Build type: ${_build_type_summary}")
if(BUILD_NUMBER)
message(STATUS " Build number: ${BUILD_NUMBER}")
endif()
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.0.0
Loading
Loading