Warning, /graphics/peruse/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_policy(SET CMP0048 NEW)
0002 project(peruse VERSION "1.80.0")
0003 cmake_minimum_required(VERSION 3.16.0)
0004 
0005 set(KF5_DEP_VERSION "5.98.0") # handled by release scripts
0006 set(QT5_DEP_VERSION "5.15")
0007 
0008 if(POLICY CMP0063)
0009     cmake_policy (SET CMP0063 NEW)
0010 endif(POLICY CMP0063)
0011 
0012 include(FeatureSummary)
0013 
0014 option(USE_PERUSE_PDFTHUMBNAILER "Use the internal thumbnail generator for PDF files (defaults to true on windows)" OFF)
0015 add_feature_info(USE_PERUSE_PDFTHUMBNAILER ${USE_PERUSE_PDFTHUMBNAILER} "Use the internal thumbnail generator for PDF files (defaults to true on windows)")
0016 if(WIN32)
0017     set(USE_PERUSE_PDFTHUMBNAILER ON)
0018 endif()
0019 
0020 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0021 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0022 
0023 find_package(ECM ${KF5_DEP_VERSION} REQUIRED NO_MODULE)
0024 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH})
0025 
0026 # Android has no DBus, so we can't use that. Sniff things and tell the code
0027 if(CMAKE_SYSTEM_NAME STREQUAL Android)
0028     message("Building for Android - this means no dbus, and other small details. Work with that")
0029     add_definitions(-DANDROID)
0030     SET(QT_QMAKE_EXECUTABLE "$ENV{Qt5_android}/bin/qmake")
0031 elseif(WIN32)
0032     message("Building for Windows - this means no dbus, and other small details. Work with that")
0033     add_definitions(-DWINDOWS)
0034 endif()
0035 
0036 find_package(Qt5 ${QT5_DEP_VERSION} REQUIRED NO_MODULE COMPONENTS Qml Quick Gui Widgets OpenGL Sql)
0037 
0038 find_package(KF5 ${KF5_DEP_VERSION} REQUIRED
0039     COMPONENTS
0040     Archive
0041     Config
0042     Crash
0043     Declarative
0044     GuiAddons
0045     FileMetaData
0046     I18n
0047     IconThemes
0048     KIO
0049     NewStuffQuick
0050     # For some reason, these show up in the OPTIONAL section if they're not explicitly listed, and that's just confusing, so...
0051     Attica
0052     Codecs
0053     Completion
0054     ConfigWidgets
0055     CoreAddons
0056     ItemViews
0057     JobWidgets
0058     NewStuffCore
0059     Package
0060     Service
0061     Solid
0062     WidgetsAddons
0063     WindowSystem
0064     XmlGui
0065 )
0066 
0067 if (NOT WIN32)
0068     find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Auth)
0069 endif()
0070 
0071 find_package(KF5Baloo ${KF5_DEP_VERSION}) # optional - we'll just let it pass if it's missing
0072 set_package_properties(KF5Baloo PROPERTIES
0073     DESCRIPTION "KDE's Framework which implements file indexing"
0074     PURPOSE "Used by the ContentLister library to find books on the system if available (if unavailable, we will fall back to a classic file system scraper)"
0075     TYPE OPTIONAL
0076 )
0077 find_package(KF5Kirigami2 ${KF5_DEP_VERSION})
0078 set_package_properties(KF5Kirigami2 PROPERTIES
0079     DESCRIPTION "KDE's lightweight user interface framework for mobile and convergent applications"
0080     URL "https://techbase.kde.org/Kirigami"
0081     PURPOSE "Required at runtime to display the GUI"
0082     TYPE RUNTIME
0083 )
0084 
0085 find_package(KF${QT_MAJOR_VERSION}KirigamiAddons 0.11)
0086 set_package_properties(KF${QT_MAJOR_VERSION}KirigamiAddons PROPERTIES
0087     TYPE REQUIRED
0088     PURPOSE "Provides additional visual components"
0089 )
0090 
0091 find_package(ZLIB)
0092 set_package_properties(ZLIB PROPERTIES
0093     PURPOSE "Required for the unarr based rar support used for reading books in the CBR format"
0094     TYPE REQUIRED
0095 )
0096 
0097 # The following checks for the QQuickTextNode private header
0098 # The original checking code can be found in QtWebKit
0099 include(CheckCXXSourceCompiles)
0100 macro(CHECK_QT5_PRIVATE_INCLUDE_DIRS _qt_component _header)
0101     set(INCLUDE_TEST_SOURCE
0102     "
0103         #include <${_header}>
0104         int main() { return 0; }
0105     "
0106     )
0107     set(CMAKE_REQUIRED_INCLUDES ${Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS})
0108     set(CMAKE_REQUIRED_LIBRARIES Qt5::${_qt_component})
0109 
0110     # Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!)
0111     check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt5${_qt_component}_PRIVATE_HEADER_FOUND)
0112 
0113     unset(INCLUDE_TEST_SOURCE)
0114     unset(CMAKE_REQUIRED_INCLUDES)
0115     unset(CMAKE_REQUIRED_LIBRARIES)
0116 
0117     if (NOT Qt5${_qt_component}_PRIVATE_HEADER_FOUND)
0118         message(FATAL_ERROR "Header ${_header} is not found. Please make sure that:
0119     1. Private headers of Qt5${_qt_component} are installed
0120     2. Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS is correctly defined in Qt5${_qt_component}Config.cmake")
0121     endif ()
0122 endmacro()
0123 CHECK_QT5_PRIVATE_INCLUDE_DIRS(Quick private/qquicktextnode_p.h)
0124 
0125 include(KDEInstallDirs)
0126 include(KDECMakeSettings)
0127 include(KDECompilerSettings)
0128 include(GenerateExportHeader)
0129 include(ECMAddAppIcon)
0130 include(ECMAddQch)
0131 include(ECMInstallIcons)
0132 include(ECMSetupVersion)
0133 include(ECMQtDeclareLoggingCategory)
0134 
0135 set(CMAKE_AUTORCC ON)
0136 
0137 kde_enable_exceptions()
0138 
0139 ecm_setup_version(${PROJECT_VERSION}
0140     VARIABLE_PREFIX PERUSE
0141     SOVERSION ${PROJECT_VERSION_MAJOR}
0142     VERSION_HEADER "${CMAKE_BINARY_DIR}/config-peruse.h"
0143 )
0144 
0145 add_subdirectory(src)
0146 
0147 ki18n_install(po)
0148 
0149 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)