diff --git a/.editorconfig b/.editorconfig index 3d1c0ffc8..dd0fe32ed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,12 @@ indent_size = 4 [*.yml] indent_size = 2 + +[CMakeLists.txt] +indent_size = 2 + +[*.md] +indent_size = 2 + +[*.cmake] +indent_size = 2 diff --git a/.gitignore b/.gitignore index cfeaafc0c..f0c3ecf38 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,23 @@ c_x86_64.pch compile_commands.json .ccls-cache + +# CMake +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +*.ninja +.ninja* + +build*/ + +# VSCode +.vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..18bf0c523 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,183 @@ +cmake_minimum_required(VERSION 3.21) + +project( + YACReader + VERSION 9.14.2 + LANGUAGES C CXX) + +# enable Objective-C for macOSX +if(APPLE) + enable_language(OBJC) + enable_language(OBJCXX) +endif() + +# Extra functions +find_package(PkgConfig) +include(GNUInstallDirs) + +# Set defaults TODO: Bad practice? +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if(MSVC) + add_compile_options("-we4061") +else() + add_compile_options("-Werror=switch") +endif() + +# Set default build type to "Release" if it is empty +set(default_build_type "Release") +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message( + STATUS + "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE + "${default_build_type}" + CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +# Require out-of-source builds +file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH) +if(EXISTS "${LOC_PATH}") + message( + FATAL_ERROR + "You cannot build in a source directory (or any \ + directory with a CMakeLists.txt file). Please make a build subdirectory. \ + Feel free to remove CMakeCache.txt and CMakeFiles. + ") +endif() + +# Common build Options +if(NOT DECOMPRESSION_BACKEND) + set(DECOMPRESSION_BACKEND + "unarr" + CACHE STRING "Decompression backend for cbx files") +endif() +set_property(CACHE DECOMPRESSION_BACKEND PROPERTY STRINGS "unarr" "7zip" + "libarchive") + +if(NOT PDF_BACKEND) + set(PDF_BACKEND + "pdfium" + CACHE STRING "PDF comic rendering backend") +endif() +set_property(CACHE PDF_BACKEND PROPERTY STRINGS "pdfium" "poppler" "pdfkit") + +# TODO: OpenGL +if(NOT OPENGL) + set(OPENGL + "desktop" + CACHE STRING "OpenGL backend") +endif() +set_property(CACHE OPENGL PROPERTY STRINGS "desktop" "angle" "force-angle" + "no_opengl") + +# TODO: option(SERVER_STANDALONE "Server standalone build (no gui apps)" OFF) + +# Handle dependencies for backends +if(DECOMPRESSION_BACKEND STREQUAL "unarr") + find_package("unarr") + # old unarr only ships PKGCONFIG + if(NOT unarr_FOUND) + pkg_check_modules(unarr IMPORTED_TARGET "libunarr" REQUIRED) + endif() +elseif(DECOMPRESSION_BACKEND STREQUAL "7zip") + find_package("7zip" REQUIRED) +elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive") + find_package("LibArchive" REQUIRED) +else() + message(FATAL_ERROR "No valid decompression backend specified.") +endif() + +if(PDF_BACKEND STREQUAL "pdfium") + pkg_check_modules(PDFIUM IMPORTED_TARGET "libpdfium" REQUIRED) +elseif(PDF_BACKEND STREQUAL "poppler") + pkg_check_modules(POPPLER IMPORTED_TARGET "poppler-qt6" REQUIRED) +elseif(PDF_BACKEND STREQUAL "pdfkit") + find_package("pdfkit" REQUIRED) +elseif(PDF_BACKEND STREQUAL "no_pdf") + # Do nothing +else() + message(FATAL_ERROR "No valid PDF backend specified.") +endif() + +# Qt6 modules TODO: Server standalone +find_package( + Qt6 REQUIRED + COMPONENTS Core + Core5Compat + Gui + Network + LinguistTools + Multimedia + OpenGLWidgets + QuickControls2 + QuickWidgets + Svg + Sql + Widgets) + +# Qt project setup + +# Check if qt_standard_project_setup is available +if(COMMAND qt_standard_project_setup) + qt_standard_project_setup() +else() # Old style fallback for Qt6 < 6.3 + message( + WARNING + "qt_standard_project_setup is not available, falling back to old-style project setup" + ) + # Auto process moc, rc and ui + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) + set(CMAKE_AUTOUIC ON) +endif() + +# Modules +add_subdirectory(common) +add_subdirectory(compressed_archive) +add_subdirectory(custom_widgets) +add_subdirectory(shortcuts_management) +add_subdirectory(third_party) +add_subdirectory(YACReaderLibrary/server) + +# Executables +add_subdirectory(YACReader) +add_subdirectory(YACReaderLibrary) +add_subdirectory(YACReaderLibraryServer) + +# Install and Deployment +if(UNIX AND NOT APPLE) + if(SERVER_STANDALONE) + install( + TARGETS YACReaderLibraryServer + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/yacreader) + else() + install( + TARGETS YACReader YACReaderLibrary YACReaderLibraryServer + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/yacreader) + endif() + # Docs and runtime + install(DIRECTORY release DESTINATION ${CMAKE_INSTALL_DATADIR}/yacreader) + install(FILES README.md CHANGELOG.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) + # Manpages + install(FILES YACReader.1 YACReaderLibrary.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + # Icons, Desktop files + install(FILES YACReader.desktop YACReaderLibrary.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) + install(FILES YACReader.svg YACReaderLibrary.svg + DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) + # Translations + install(FILES ${reader_translations} ${library_translations} + DESTINATION ${CMAKE_INSTALL_DATADIR}/yacreader/release/languages) +elseif(WIN32) + # TODO +elseif(APPLE) + # TODO +endif() diff --git a/YACReader/CMakeLists.txt b/YACReader/CMakeLists.txt new file mode 100644 index 000000000..482ba5b50 --- /dev/null +++ b/YACReader/CMakeLists.txt @@ -0,0 +1,77 @@ +add_executable(YACReader main.cpp) +target_sources( + YACReader + PRIVATE bookmarks_dialog.cpp + bookmarks_dialog.h + configuration.cpp + configuration.h + goto_dialog.cpp + goto_dialog.h + goto_flow_gl.cpp + goto_flow_toolbar.cpp + goto_flow_toolbar.h + goto_flow_widget.cpp + goto_flow_widget.h + goto_flow.cpp + goto_flow.h + magnifying_glass.cpp + magnifying_glass.h + main_window_viewer.cpp + main_window_viewer.h + notifications_label_widget.cpp + notifications_label_widget.h + options_dialog.cpp + options_dialog.h + page_label_widget.cpp + page_label_widget.h + render.cpp + render.h + translator.cpp + translator.h + viewer.cpp + viewer.h + width_slider.cpp + width_slider.h + yacreader_local_client.cpp + yacreader_local_client.h) + +qt_add_resources(yr_resources yacreader_images.qrc yacreader_files.qrc) +target_sources(YACReader PRIVATE ${yr_resources}) + +qt_add_translations( + YACReader + TS_FILES + yacreader_de.ts + yacreader_en.ts + yacreader_es.ts + yacreader_fr.ts + yacreader_it.ts + yacreader_nl.ts + yacreader_pt.ts + yacreader_ru.ts + yacreader_tr.ts + yacreader_zh_CN.ts + yacreader_zh_HK.ts + yacreader_zh_TW.ts + QM_FILES_OUTPUT_VARIABLE + reader_translations) + +target_link_libraries( + YACReader + PRIVATE comic_backend + common_all + common_gui + custom_widgets_reader + naturalsort + QsLog + Qt::Gui + Qt::Multimedia + Qt::Network + Qt::OpenGLWidgets + Qt::Svg + Qt::Widgets + version_checker + yr_global + Qt::Core5Compat) +target_compile_definitions(YACReader + PRIVATE DATADIR="${CMAKE_INSTALL_FULL_DATADIR}") diff --git a/YACReaderLibrary/CMakeLists.txt b/YACReaderLibrary/CMakeLists.txt new file mode 100644 index 000000000..d8f8ef773 --- /dev/null +++ b/YACReaderLibrary/CMakeLists.txt @@ -0,0 +1,205 @@ +add_library( + library_common + bundle_creator.cpp + bundle_creator.h + comic_files_manager.cpp + comic_files_manager.h + comics_remover.cpp + comics_remover.h + initial_comic_info_extractor.cpp + initial_comic_info_extractor.h + ip_config_helper.cpp + ip_config_helper.h + libraries_update_coordinator.cpp + libraries_update_coordinator.h + library_creator.cpp + library_creator.h + package_manager.cpp + package_manager.h + xml_info_library_scanner.cpp + xml_info_library_scanner.h + xml_info_parser.cpp + xml_info_parser.h + yacreader_libraries.cpp + yacreader_libraries.h + yacreader_local_server.cpp + yacreader_local_server.h) + +target_link_libraries(library_common Qt::Network QsLog db_helper yr_global) + +add_library( + db_helper + db_helper.cpp + db_helper.h + db/comic_item.cpp + db/comic_item.h + db/comic_model.cpp + db/comic_model.h + db/comic_query_result_processor.cpp + db/comic_query_result_processor.h + db/data_base_management.cpp + db/data_base_management.h + db/folder_item.cpp + db/folder_item.h + db/folder_model.cpp + db/folder_model.h + db/folder_query_result_processor.cpp + db/folder_query_result_processor.h + db/query_lexer.cpp + db/query_lexer.h + db/query_parser.cpp + db/query_parser.h + db/reading_list_item.cpp + db/reading_list_item.h + db/reading_list_model.cpp + db/reading_list_model.h + db/reading_list.cpp + db/reading_list.h + db/search_query.cpp + db/search_query.h) + +target_link_libraries( + db_helper + comic_backend + concurrent_queue + QrCode + QsLog + Qt::Gui + Qt::Sql + Qt::Widgets + server + yr_global) +target_include_directories(db_helper PUBLIC db .) + +add_subdirectory(comic_vine) + +add_executable(YACReaderLibrary main.cpp) + +target_sources( + YACReaderLibrary + PRIVATE add_label_dialog.cpp + add_label_dialog.h + add_library_dialog.cpp + add_library_dialog.h + classic_comics_view.cpp + classic_comics_view.h + comic_flow_widget.cpp + comic_flow_widget.h + comic_flow.cpp + comic_flow.h + comics_view.cpp + comics_view.h + comics_view_transition.cpp + comics_view_transition.h + create_library_dialog.cpp + create_library_dialog.h + current_comic_view_helper.cpp + current_comic_view_helper.h + empty_container_info.cpp + empty_container_info.h + empty_folder_widget.cpp + empty_folder_widget.h + empty_label_widget.cpp + empty_label_widget.h + empty_reading_list_widget.cpp + empty_reading_list_widget.h + empty_special_list.cpp + empty_special_list.h + export_comics_info_dialog.cpp + export_comics_info_dialog.h + export_library_dialog.cpp + export_library_dialog.h + folder_content_view.cpp + folder_content_view.h + grid_comics_view.cpp + grid_comics_view.h + import_comics_info_dialog.cpp + import_comics_info_dialog.h + import_library_dialog.cpp + import_library_dialog.h + import_widget.cpp + import_widget.h + info_comics_view.cpp + info_comics_view.h + library_comic_opener.cpp + library_comic_opener.h + library_window.cpp + library_window.h + no_libraries_widget.cpp + no_libraries_widget.h + no_search_results_widget.cpp + no_search_results_widget.h + options_dialog.cpp + options_dialog.h + properties_dialog.cpp + properties_dialog.h + recent_visibility_coordinator.cpp + recent_visibility_coordinator.h + rename_library_dialog.cpp + rename_library_dialog.h + server_config_dialog.cpp + server_config_dialog.h + trayicon_controller.cpp + trayicon_controller.h + yacreader_comic_info_helper.cpp + yacreader_comic_info_helper.h + yacreader_comics_selection_helper.cpp + yacreader_comics_selection_helper.h + yacreader_content_views_manager.cpp + yacreader_content_views_manager.h + yacreader_folders_view.cpp + yacreader_folders_view.h + yacreader_history_controller.cpp + yacreader_history_controller.h + yacreader_main_toolbar.cpp + yacreader_main_toolbar.h + yacreader_navigation_controller.cpp + yacreader_navigation_controller.h + yacreader_reading_lists_view.cpp + yacreader_reading_lists_view.h) + +qt_add_resources(library qml6.qrc qml_win.qrc images.qrc images_win.qrc + files.qrc) +target_sources(YACReaderLibrary PRIVATE ${library}) + +qt_add_translations( + YACReaderLibrary + TS_FILES + yacreaderlibrary_de.ts + yacreaderlibrary_en.ts + yacreaderlibrary_es.ts + yacreaderlibrary_fr.ts + yacreaderlibrary_it.ts + yacreaderlibrary_nl.ts + yacreaderlibrary_pt.ts + yacreaderlibrary_ru.ts + yacreaderlibrary_tr.ts + yacreaderlibrary_zh_CN.ts + yacreaderlibrary_zh_HK.ts + yacreaderlibrary_zh_TW.ts + QM_FILES_OUTPUT_VARIABLE + library_translations) + +target_link_libraries( + YACReaderLibrary + comic_vine + common_all + common_gui + custom_widgets_library + db_helper + KDSignalThrottler + library_common + QsLog + Qt::Core5Compat + Qt::Network + Qt::OpenGLWidgets + Qt::QuickControls2 + Qt::QuickWidgets + Qt::Sql + Qt::Svg + server + worker + yr_global) + +target_compile_definitions(YACReaderLibrary PRIVATE SERVER_RELEASE + YACREADER_LIBRARY) diff --git a/YACReaderLibrary/comic_vine/CMakeLists.txt b/YACReaderLibrary/comic_vine/CMakeLists.txt new file mode 100644 index 000000000..f6c23e122 --- /dev/null +++ b/YACReaderLibrary/comic_vine/CMakeLists.txt @@ -0,0 +1,52 @@ +add_library(comic_vine) +target_sources( + comic_vine + PRIVATE api_key_dialog.cpp + api_key_dialog.h + comic_vine_all_volume_comics_retriever.cpp + comic_vine_all_volume_comics_retriever.h + comic_vine_client.cpp + comic_vine_client.h + comic_vine_dialog.cpp + comic_vine_dialog.h + comic_vine_json_parser.cpp + comic_vine_json_parser.h + model/comics_model.cpp + model/comics_model.h + model/json_model.cpp + model/json_model.h + model/local_comic_list_model.cpp + model/local_comic_list_model.h + model/response_parser.cpp + model/response_parser.h + model/volume_comics_model.cpp + model/volume_comics_model.h + model/volumes_model.cpp + model/volumes_model.h + scraper_lineedit.cpp + scraper_lineedit.h + scraper_results_paginator.cpp + scraper_results_paginator.h + scraper_scroll_label.cpp + scraper_scroll_label.h + scraper_selector.cpp + scraper_selector.h + scraper_tableview.cpp + scraper_tableview.h + search_single_comic.cpp + search_single_comic.h + search_volume.cpp + search_volume.h + select_comic.cpp + select_comic.h + select_volume.cpp + select_volume.h + series_question.cpp + series_question.h + sort_volume_comics.cpp + sort_volume_comics.h + title_header.cpp + title_header.h) +target_include_directories(comic_vine PUBLIC . model ..) +target_link_libraries(comic_vine Qt::Widgets yr_global naturalsort db_helper + custom_widgets_library) diff --git a/YACReaderLibrary/server/CMakeLists.txt b/YACReaderLibrary/server/CMakeLists.txt new file mode 100644 index 000000000..3b51f4a9a --- /dev/null +++ b/YACReaderLibrary/server/CMakeLists.txt @@ -0,0 +1,97 @@ +add_library( + server + # Legacy controller + controllers/v1/comiccontroller.cpp + controllers/v1/comiccontroller.h + controllers/v1/comicdownloadinfocontroller.cpp + controllers/v1/comicdownloadinfocontroller.h + controllers/v1/covercontroller.cpp + controllers/v1/covercontroller.h + controllers/v1/errorcontroller.cpp + controllers/v1/errorcontroller.h + controllers/v1/foldercontroller.cpp + controllers/v1/foldercontroller.h + controllers/v1/folderinfocontroller.cpp + controllers/v1/folderinfocontroller.h + controllers/v1/librariescontroller.cpp + controllers/v1/librariescontroller.h + controllers/v1/pagecontroller.cpp + controllers/v1/pagecontroller.h + controllers/v1/synccontroller.cpp + controllers/v1/synccontroller.h + controllers/v1/updatecomiccontroller.cpp + controllers/v1/updatecomiccontroller.h + # Current controller + controllers/v2/comiccontroller_v2.cpp + controllers/v2/comiccontroller_v2.h + controllers/v2/comiccontrollerinreadinglist_v2.cpp + controllers/v2/comiccontrollerinreadinglist_v2.h + controllers/v2/comicdownloadinfocontroller_v2.cpp + controllers/v2/comicdownloadinfocontroller_v2.h + controllers/v2/comicfullinfocontroller_v2.cpp + controllers/v2/comicfullinfocontroller_v2.h + controllers/v2/covercontroller_v2.cpp + controllers/v2/covercontroller_v2.h + controllers/v2/errorcontroller_v2.cpp + controllers/v2/errorcontroller_v2.h + controllers/v2/favoritescontroller_v2.cpp + controllers/v2/favoritescontroller_v2.h + controllers/v2/foldercontentcontroller_v2.cpp + controllers/v2/foldercontentcontroller_v2.h + controllers/v2/folderinfocontroller_v2.cpp + controllers/v2/folderinfocontroller_v2.h + controllers/v2/librariescontroller_v2.cpp + controllers/v2/librariescontroller_v2.h + controllers/v2/foldermetadatacontroller_v2.cpp + controllers/v2/foldermetadatacontroller_v2.h + controllers/v2/pagecontroller_v2.cpp + controllers/v2/pagecontroller_v2.h + controllers/v2/readingcomicscontroller_v2.cpp + controllers/v2/readingcomicscontroller_v2.h + controllers/v2/readinglistcontentcontroller_v2.cpp + controllers/v2/readinglistcontentcontroller_v2.h + controllers/v2/readinglistinfocontroller_v2.cpp + controllers/v2/readinglistinfocontroller_v2.h + controllers/v2/readinglistscontroller_v2.cpp + controllers/v2/readinglistscontroller_v2.h + controllers/v2/searchcontroller_v2.cpp + controllers/v2/searchcontroller_v2.h + controllers/v2/synccontroller_v2.cpp + controllers/v2/synccontroller_v2.h + controllers/v2/tagcontentcontroller_v2.cpp + controllers/v2/tagcontentcontroller_v2.h + controllers/v2/taginfocontroller_v2.cpp + controllers/v2/taginfocontroller_v2.h + controllers/v2/tagscontroller_v2.cpp + controllers/v2/tagscontroller_v2.h + controllers/v2/updatecomiccontroller_v2.cpp + controllers/v2/updatecomiccontroller_v2.h + # Switchter and WebUI + controllers/versioncontroller.cpp + controllers/versioncontroller.h + controllers/webui/statuspagecontroller.cpp + controllers/webui/statuspagecontroller.h + # Other + requestmapper.cpp + requestmapper.h + static.cpp + static.h + yacreader_http_server.cpp + yacreader_http_server.h + yacreader_http_session_store.cpp + yacreader_http_session_store.h + yacreader_http_session.cpp + yacreader_http_session.h + yacreader_server_data_helper.cpp + yacreader_server_data_helper.h) + +target_include_directories( + server + PRIVATE controllers controllers/v1 controllers/v2 + PUBLIC .) +target_compile_definitions( + server + PUBLIC SERVER_VERSION_NUMBER="2.0" DATADIR="${CMAKE_INSTALL_FULL_DATADIR}" + BINDIR="${CMAKE_INSTALL_FULL_BINDIR}") +target_link_libraries(server QtWebApp_httpserver QtWebApp_templateengine + Qt::Sql comic_backend db_helper) diff --git a/YACReaderLibraryServer/CMakeLists.txt b/YACReaderLibraryServer/CMakeLists.txt new file mode 100644 index 000000000..bb5ac9cc6 --- /dev/null +++ b/YACReaderLibraryServer/CMakeLists.txt @@ -0,0 +1,25 @@ +add_executable( + YACReaderLibraryServer + main.cpp console_ui_library_creator.h console_ui_library_creator.cpp + libraries_updater.h libraries_updater.cpp) + +target_compile_definitions( + YACReaderLibraryServer PRIVATE SERVER_RELEASE + DATADIR="${CMAKE_INSTALL_FULL_DATADIR}") + +target_include_directories(YACReaderLibraryServer PRIVATE ../YACReaderLibrary) + +target_link_libraries( + YACReaderLibraryServer + PRIVATE comic_backend + comic_vine + common_all + db_helper + library_common + QrCode + QsLog + Qt::Core5Compat + Qt::Gui + Qt::Network + Qt::Sql + server) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 788d828f1..6ec6ea983 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,6 +140,32 @@ jobs: make check TESTARGS="-maxwarnings 100000" displayName: 'Run tests' +# +# Linux qt6 +# + +- job: Linux_qt6_cmake + timeoutInMinutes: 90 + dependsOn: CodeFormatValidation + pool: + vmImage: 'ubuntu-22.04' + steps: + - script: | + sudo apt-get update + sudo apt-get install -y qtchooser qt6-tools-dev qt6-base-dev-tools qmake6 qmake6-bin \ + qt6-base-dev qt6-multimedia-dev qt6-tools-dev-tools libgl-dev qt6-l10n-tools \ + libqt6opengl6-dev libunarr-dev qt6-declarative-dev libqt6svg6-dev libqt6core5compat6-dev \ + ninja-build + displayName: 'Install dependencies' + - task: CMake@1 + inputs: + cmakeArgs: '-DPDF_BACKEND=no_pdf -GNinja ..' + displayName: 'Generate CMake cache' + - task: CMake@1 + inputs: + cmakeArgs: '--build .' + displayName: 'Build' + # # MacOS Qt6(universal) # diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 000000000..fc285e9bf --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,72 @@ +# Common for all targets +add_library( + common_all + bookmarks.cpp + bookmarks.h + comic_db.cpp + comic_db.h + http_worker.cpp + http_worker.h + library_item.cpp + library_item.h) +target_link_libraries(common_all PUBLIC Qt::Gui Qt::Network) +target_include_directories(common_all PUBLIC .) + +# Common for gui targets +add_library(common_gui exit_check.cpp exit_check.h opengl_checker.cpp + opengl_checker.h) +target_link_libraries(common_gui Qt::Widgets QsLog) +target_include_directories(common_gui PUBLIC .) + +add_library(version_checker check_new_version.cpp check_new_version.h) +target_link_libraries(version_checker Qt::Network Qt::Core5Compat) + +add_library(worker release_acquire_atomic.h worker_thread.h) +target_link_libraries(worker Qt::Core) + +add_library(comic_backend comic.h comic.cpp folder.h folder.cpp pdf_comic.h + pdf_comic.cpp) +target_link_libraries(comic_backend cbx_backend Qt::Gui QsLog) +target_include_directories(comic_backend PUBLIC .) + +if(PDF_BACKEND STREQUAL "pdfium") + target_compile_definitions(comic_backend PUBLIC USE_PDFIUM) + target_link_libraries(comic_backend PkgConfig::PDFIUM) +elseif(PDF_BACKEND STREQUAL "poppler") + target_link_libraries(comic_backend PkgConfig::POPPLER) +elseif(APPLE AND (PDF_BACKEND STREQUAL "pdfkit")) + # TODO +else() + target_compile_definitions(comic_backend PUBLIC NO_PDF) +endif() + +add_library(yr_global yacreader_global.h yacreader_global.cpp + yacreader_global_gui.cpp yacreader_global_gui.h) +target_link_libraries(yr_global Qt::Widgets) +target_include_directories(yr_global PUBLIC .) + +add_library(concurrent_queue concurrent_queue.h concurrent_queue.cpp) +target_link_libraries(concurrent_queue Qt::Core) +target_include_directories(concurrent_queue PUBLIC .) + +add_library(naturalsort qnaturalsorting.h qnaturalsorting.cpp) +target_include_directories(naturalsort PUBLIC .) +target_link_libraries(naturalsort Qt::Core) + +# Flow +add_library(pictureflow pictureflow.h pictureflow.cpp scroll_management.cpp + scroll_management.h) +target_link_libraries(pictureflow Qt::Widgets) +target_include_directories(pictureflow PUBLIC .) + +# GL flow is slightly different for reader and library, so we need to build it +# twice +add_library(gl_flow_reader gl/yacreader_flow_gl.cpp gl/yacreader_flow_gl.h) +target_link_libraries(gl_flow_reader pictureflow Qt::OpenGLWidgets Qt::Gui) +target_include_directories(gl_flow_reader PUBLIC gl) +target_compile_definitions(gl_flow_reader PRIVATE YACREADER) + +add_library(gl_flow_library gl/yacreader_flow_gl.cpp gl/yacreader_flow_gl.h) +target_link_libraries(gl_flow_library pictureflow Qt::OpenGLWidgets Qt::Gui) +target_include_directories(gl_flow_library PUBLIC gl) +target_compile_definitions(gl_flow_library PRIVATE YACREADER_LIBRARY) diff --git a/compressed_archive/CMakeLists.txt b/compressed_archive/CMakeLists.txt new file mode 100644 index 000000000..917b665d8 --- /dev/null +++ b/compressed_archive/CMakeLists.txt @@ -0,0 +1,33 @@ +add_library(cbx_backend) + +if(DECOMPRESSION_BACKEND STREQUAL "unarr") + + target_sources( + cbx_backend PRIVATE unarr/compressed_archive.cpp unarr/compressed_archive.h + unarr/extract_delegate.h) + target_include_directories(cbx_backend PUBLIC unarr) + target_compile_definitions(cbx_backend PUBLIC use_unarr) + if(TARGET unarr::unarr) + target_link_libraries(cbx_backend unarr::unarr Qt::Core) + else() + target_link_libraries(cbx_backend PkgConfig::unarr Qt::Core) + endif() + +elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive") + + target_sources( + cbx_backend + PRIVATE libarchive/compressed_archive.cpp libarchive/compressed_archive.h + libarchive/extract_delegate.h) + target_include_directories(cbx_backend PUBLIC libarchive) + target_compile_definitions(cbx_backend PUBLIC use_libarchive) + target_link_libraries(cbx_backend LibArchive::LibArchive Qt::Core) + +elseif(DECOMPRESSION_BACKEND STREQUAL "7zip") + # TODO + target_sources(cbx_backend PRIVATE compressed_archive.cpp + compressed_archive.h extract_delegate.h) + target_include_directories(cbx_backend PUBLIC .) + target_link_libraries(cbx_backend 7zip Qt::Core) + +endif() diff --git a/custom_widgets/CMakeLists.txt b/custom_widgets/CMakeLists.txt new file mode 100644 index 000000000..571c32d52 --- /dev/null +++ b/custom_widgets/CMakeLists.txt @@ -0,0 +1,77 @@ +add_library( + widgets_common + help_about_dialog.cpp + help_about_dialog.h + rounded_corners_dialog.cpp + rounded_corners_dialog.h + whats_new_controller.cpp + whats_new_controller.h + whats_new_dialog.cpp + whats_new_dialog.h + yacreader_busy_widget.cpp + yacreader_busy_widget.h + yacreader_field_edit.cpp + yacreader_field_edit.h + yacreader_field_plain_text_edit.cpp + yacreader_field_plain_text_edit.h + yacreader_spin_slider_widget.cpp + yacreader_spin_slider_widget.h + yacreader_tool_bar_stretch.cpp + yacreader_tool_bar_stretch.h) +target_link_libraries(widgets_common Qt::Widgets yr_global) + +add_library(custom_widgets_library) +target_sources( + custom_widgets_library + PRIVATE yacreader_deleting_progress.cpp + yacreader_deleting_progress.h + yacreader_flow_config_widget.cpp + yacreader_flow_config_widget.h + yacreader_flow.cpp + yacreader_flow.h + yacreader_gl_flow_config_widget.cpp + yacreader_gl_flow_config_widget.h + yacreader_library_item_widget.cpp + yacreader_library_item_widget.h + yacreader_library_list_widget.cpp + yacreader_library_list_widget.h + yacreader_options_dialog.cpp + yacreader_options_dialog.h + yacreader_search_line_edit.cpp + yacreader_search_line_edit.h + yacreader_sidebar.cpp + yacreader_sidebar.h + yacreader_table_view.cpp + yacreader_table_view.h + yacreader_titled_toolbar.cpp + yacreader_titled_toolbar.h + yacreader_tool_bar_stretch.cpp + yacreader_tool_bar_stretch.h + yacreader_treeview.cpp + yacreader_treeview.h) +target_link_libraries( + custom_widgets_library + db_helper + gl_flow_library + QsLog + Qt::Widgets + shortcuts_library + widgets_common + widgets_common + yr_global) +target_include_directories(custom_widgets_library PUBLIC .) + +add_library(custom_widgets_reader) +target_sources( + custom_widgets_reader + PRIVATE yacreader_flow_config_widget.cpp + yacreader_flow_config_widget.h + yacreader_flow.cpp + yacreader_flow.h + yacreader_gl_flow_config_widget.cpp + yacreader_gl_flow_config_widget.h + yacreader_options_dialog.cpp + yacreader_options_dialog.h) +target_link_libraries(custom_widgets_reader Qt::Widgets yr_global + gl_flow_reader widgets_common shortcuts_reader) +target_include_directories(custom_widgets_reader PUBLIC .) diff --git a/shortcuts_management/CMakeLists.txt b/shortcuts_management/CMakeLists.txt new file mode 100644 index 000000000..816fe3332 --- /dev/null +++ b/shortcuts_management/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(shortcuts_common) +target_sources( + shortcuts_common + PRIVATE actions_groups_model.h + actions_shortcuts_model.h + edit_shortcut_item_delegate.h + edit_shortcuts_dialog.h + edit_shortcuts_dialog.cpp + actions_groups_model.cpp + actions_shortcuts_model.cpp + edit_shortcut_item_delegate.cpp) +target_include_directories(shortcuts_common PUBLIC .) +target_link_libraries(shortcuts_common Qt::Widgets yr_global QsLog) + +add_library(shortcuts_reader shortcuts_manager.h shortcuts_manager.cpp) +target_compile_definitions(shortcuts_reader PRIVATE YACREADER) +target_include_directories(shortcuts_reader PUBLIC .) +target_link_libraries(shortcuts_reader shortcuts_common Qt::Widgets yr_global) + +add_library(shortcuts_library shortcuts_manager.h shortcuts_manager.cpp) +target_compile_definitions(shortcuts_library PRIVATE YACREADER_LIBRARY) +target_include_directories(shortcuts_library PUBLIC .) +target_link_libraries(shortcuts_library shortcuts_common Qt::Widgets yr_global) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 000000000..ac23afb93 --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1,72 @@ +add_library(QrCode STATIC QrCode/qrcodegen.hpp QrCode/qrcodegen.cpp) +target_include_directories(QrCode PUBLIC QrCode) + +add_library( + QtWebApp_httpserver STATIC + QtWebApp/httpserver/httpconnectionhandler.cpp + QtWebApp/httpserver/httpconnectionhandler.h + QtWebApp/httpserver/httpconnectionhandlerpool.cpp + QtWebApp/httpserver/httpconnectionhandlerpool.h + QtWebApp/httpserver/httpcookie.cpp + QtWebApp/httpserver/httpcookie.h + QtWebApp/httpserver/httpglobal.cpp + QtWebApp/httpserver/httpglobal.h + QtWebApp/httpserver/httplistener.cpp + QtWebApp/httpserver/httplistener.h + QtWebApp/httpserver/httprequest.cpp + QtWebApp/httpserver/httprequest.h + QtWebApp/httpserver/httprequesthandler.cpp + QtWebApp/httpserver/httprequesthandler.h + QtWebApp/httpserver/httpresponse.cpp + QtWebApp/httpserver/httpresponse.h + QtWebApp/httpserver/httpsession.cpp + QtWebApp/httpserver/httpsession.h + QtWebApp/httpserver/httpsessionstore.cpp + QtWebApp/httpserver/httpsessionstore.h + QtWebApp/httpserver/staticfilecontroller.cpp + QtWebApp/httpserver/staticfilecontroller.h) + +target_link_libraries(QtWebApp_httpserver PUBLIC Qt::Network) +target_include_directories(QtWebApp_httpserver PUBLIC QtWebApp/httpserver) +# target_compile_definitions(QtWebApp SUPERVERBOSE) + +add_library( + QtWebApp_templateengine STATIC + QtWebApp/templateengine/template.cpp + QtWebApp/templateengine/template.h + QtWebApp/templateengine/templatecache.cpp + QtWebApp/templateengine/templatecache.h + QtWebApp/templateengine/templateglobal.h + QtWebApp/templateengine/templateloader.cpp + QtWebApp/templateengine/templateloader.h) + +target_link_libraries(QtWebApp_templateengine Qt::Core5Compat) +target_include_directories(QtWebApp_templateengine + PUBLIC QtWebApp/templateengine) + +add_library( + QsLog + QsLog/QsLog.cpp + QsLog/QsLog.h + QsLog/QsLogDest.cpp + QsLog/QsLogDest.h + QsLog/QsLogDestConsole.cpp + QsLog/QsLogDestConsole.h + QsLog/QsLogDestFile.cpp + QsLog/QsLogDestFile.h + QsLog/QsLogDestFunctor.cpp + QsLog/QsLogDestFunctor.h + QsLog/QsLogDisableForThisFile.h + QsLog/QsLogLevel.cpp + QsLog/QsLogLevel.h + QsLog/QsLogMessage.cpp + QsLog/QsLogMessage.h + QsLog/QsLogSharedLibrary.h) +target_compile_definitions(QsLog PRIVATE QS_LOG_SEPARATE_THREAD) +target_include_directories(QsLog PUBLIC QsLog) +target_link_libraries(QsLog Qt::Core) + +add_library(KDSignalThrottler KDToolBox/KDSignalThrottler.h + KDToolBox/KDSignalThrottler.cpp) +target_include_directories(KDSignalThrottler PUBLIC KDToolBox) +target_link_libraries(KDSignalThrottler Qt::Core)