Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
237 changes: 100 additions & 137 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

51 changes: 20 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ dependencies/create-dmg
signapps.sh
lib7zip
libp7zip
YACReader/build
YACReaderLibrary/build
YACReaderLibraryServer/build
build/

# C++ objects and libs
*.slo
Expand All @@ -24,58 +20,51 @@ build/
*.pch
*.obj

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
# Qt generated files
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.build*
*.app*
*.pbxproj
*.mak
*.xcworkspace*
*xcshareddata*
*.swp
*.qm

# Qt unit tests
target_wrapper.*

# QtCreator
.qtcreator/
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*
*.stash
*build-*
*.build*

# CMake
build*/
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
CMakeUserPresets.json

# IDE / platform
*.app*
*.pbxproj
*.xcworkspace*
*xcshareddata*
*.swp
*.plist
*.dmg

YACReaderLibrary/YACReaderLibrary\.xcodeproj/
.DS_Store
compressed_archive/libp7zip
c_x86_64.pch

compile_commands.json
.ccls-cache

compressed_archive/libp7zip
c_x86_64.pch

# Claude Code
.claude/
191 changes: 191 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
cmake_minimum_required(VERSION 3.25)

project(YACReader
VERSION 10.0.0
LANGUAGES C CXX
)

# Enable Objective-C/C++ on Apple platforms
if(APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif()

# Enforce out-of-source build
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" _in_source_check)
if(EXISTS "${_in_source_check}")
message(FATAL_ERROR "In-source builds are not allowed. Use: cmake -B build")
endif()

# C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Default build type (single-config generators only)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# Install paths
include(GNUInstallDirs)
find_package(PkgConfig)

# Compiler options (MSVC flags, NOMINMAX, etc.)
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")

# --- 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}")
endif()

# macOS universal binary default
if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target architectures")
endif()

# --- Qt ---
# BUILD_SERVER_STANDALONE only needs Qt 6.4+ (no GUI/shader components required)
if(BUILD_SERVER_STANDALONE)
find_package(Qt6 6.4 REQUIRED COMPONENTS
Core
Core5Compat
Gui
LinguistTools
Network
Sql
)
else()
find_package(Qt6 6.7 REQUIRED COMPONENTS
Core
Core5Compat
Gui
LinguistTools
Multimedia
Network
OpenGLWidgets
Quick
QuickControls2
QuickWidgets
Qml
ShaderTools
Sql
Svg
Test
Widgets
)
endif()
qt_standard_project_setup()

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

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

# Build number define
if(BUILD_NUMBER)
add_compile_definitions("BUILD_NUMBER=\"${BUILD_NUMBER}\"")
endif()

# --- Subdirectories (dependency order) ---
add_subdirectory(third_party)
add_subdirectory(compressed_archive)
add_subdirectory(common)

# GUI-only subdirectories (not needed for server-standalone builds)
if(NOT BUILD_SERVER_STANDALONE)
add_subdirectory(shortcuts_management)
add_subdirectory(custom_widgets)
endif()

add_subdirectory(YACReaderLibrary/server)

if(NOT BUILD_SERVER_STANDALONE)
add_subdirectory(YACReaderLibrary/comic_vine)
endif()

# Always add YACReaderLibrary: defines library_common and db_helper (shared with server)
# When BUILD_SERVER_STANDALONE=ON, only those shared targets are built (not the app)
add_subdirectory(YACReaderLibrary)

if(NOT BUILD_SERVER_STANDALONE)
add_subdirectory(YACReader)
endif()

add_subdirectory(YACReaderLibraryServer)

if(BUILD_TESTS AND NOT BUILD_SERVER_STANDALONE)
enable_testing()
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()
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}")
if(BUILD_NUMBER)
message(STATUS " Build number: ${BUILD_NUMBER}")
endif()
message(STATUS "")
Loading