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

0001 #
0002 # SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0003 # SPDX-FileCopyrightText: 2015      by Veaceslav Munteanu, <veaceslav dot munteanu90 at gmail dot com>
0004 # SPDX-FileCopyrightText: 2015      by Mohamed_Anwer, <m_dot_anwer at gmx dot com>
0005 #
0006 # SPDX-License-Identifier: BSD-3-Clause
0007 #
0008 
0009 # NOTE: Look rules extension scripts located at core/cmake/rules/
0010 
0011 APPLY_COMMON_POLICIES()
0012 
0013 # ==============================================================================
0014 
0015 message(STATUS "----------------------------------------------------------------------------------")
0016 message(STATUS "Check dependencies for ${PROJECT_NAME} version ${DIGIKAM_VERSION_STRING}")
0017 message(STATUS "")
0018 
0019 set(KF${QT_VERSION_MAJOR}_MIN_VERSION       "5.95.0")
0020 set(EXIV2_MIN_VERSION                       "0.27.1")
0021 set(OPENCV_MIN_VERSION                      "3.3.0")
0022 set(LENSFUN_MIN_VERSION                     "0.2.6.0")      # For Lens auto-correction plugin
0023 set(KSANE_MIN_VERSION                       "21.12.0")      # For digital scanner support.
0024 set(CALENDAR_MIN_VERSION                    "5.89.0")       # Calendar Core dependency for plugin.
0025 set(AKONADI_MIN_VERSION                     "5.19.0")       # Akonadi Contact dependency.
0026 
0027 cmake_minimum_required(VERSION ${CMAKE_MIN_VERSION})
0028 
0029 # ==============================================================================
0030 
0031 include(RulesOptionDefinitions)
0032 
0033 ############## Find Packages ###################
0034 
0035 # Now detect the whole Qt6 or Qt5 framework.
0036 
0037 include(RulesQtFramework)
0038 
0039 # KDE frameworks dependencies
0040 
0041 include(RulesKDEFramework)
0042 
0043 # ==============================================================================
0044 # Dependencies Rules
0045 
0046 # mandatory
0047 
0048 include(RulesLibJpeg)
0049 
0050 find_package(TIFF)
0051 find_package(PNG)
0052 find_package(Boost)
0053 find_package(LCMS2)
0054 find_package(EXPAT)         # For DNGWriter: XMP SDK need Expat library to compile.
0055 find_package(Threads)       # For DNGWriter and LibRaw which needs native threads support.
0056 find_package(Libheif)       # For HEIF support.
0057 
0058 if(HEIF_FOUND)
0059 
0060     find_package(X265)      # For HEIF encoding support.
0061 
0062     if(NOT X265_FOUND)
0063 
0064         set(X265_LIBRARIES "")
0065 
0066     endif()
0067 
0068 endif()
0069 
0070 # -- Exiv2 checks and adjustements ---------------------------------------------
0071 
0072 include(RulesLibExiv2)
0073 
0074 # -- OpenCV checks and adjustements --------------------------------------------
0075 
0076 include(RulesLibOpenCV)
0077 
0078 # -- optionals -----------------------------------------------------------------
0079 
0080 find_package(FLEX)                                 # For Panorama tool.
0081 find_package(BISON)                                # For Panorama tool.
0082 
0083 find_package(LibXslt)                              # For HTMLGallery tool.
0084 find_package(LibXml2)                              # For HTMLGallery tool.
0085 
0086 if(ENABLE_GEOLOCATION)
0087 
0088     set(MARBLE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utilities/geolocation/marble
0089                            ${CMAKE_CURRENT_SOURCE_DIR}/utilities/geolocation/marble/geodata/data
0090     )
0091 
0092 else()
0093 
0094     set(MARBLE_INCLUDE_DIR "")
0095 
0096 endif()
0097 
0098 find_package(PkgConfig)
0099 find_package(Jasper)                               # For JPEG 2000 support.
0100 find_package(Eigen3)                               # For Refocus tool.
0101 
0102 # -- ImageMagick checks and adjustements --------------------------------------
0103 
0104 include(RulesLibMagick)
0105 
0106 # -- X11 checks and adjustements ----------------------------------------------
0107 
0108 include(RulesX11)
0109 
0110 # -- OpenGL checks and adjustments --------------------------------------------
0111 
0112 include(RulesLibOpenGL)
0113 
0114 # -- Media player dependencies checks and adjustments---------------------------
0115 
0116 include(RulesFFmpeg)
0117 include(RulesMediaPlayer)
0118 
0119 # -- Print Install Paths from ECM ---------------------------------------------
0120 
0121 include(RulesInstallPaths)
0122 
0123 # -- Windows compilation and linking adjustements -----------------------------
0124 
0125 include(RulesWindows)
0126 
0127 # -- MacOS compilation and linking adjustements -----------------------------
0128 
0129 include(RulesMacOS)
0130 
0131 # -- To link under Solaris (see bug #274484) ----------------------------------
0132 
0133 if(NOT WIN32)
0134 
0135     find_library(MATH_LIBRARY m)
0136 
0137 endif()
0138 
0139 if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
0140 
0141     find_library(KVM_LIBRARY kvm)
0142 
0143 endif()
0144 
0145 # ==============================================================================
0146 # More Optional Dependencies and Rules
0147 
0148 find_package(Doxygen)
0149 find_package(GLIB2)
0150 
0151 if(BUILD_WITH_CCACHE)
0152 
0153     message(STATUS "Looking for ccache...")
0154     find_program(CCACHE_FOUND ccache)
0155     message(STATUS "ccache program found: ${CCACHE_FOUND}...")
0156 
0157 endif()
0158 
0159 # -- Check libgphoto2 library for camera devices support -----------------------
0160 
0161 include(RulesLibgphoto2)
0162 
0163 # -- Check LensFun library for Lens auto-correction tool -----------------------
0164 
0165 include(RulesLiblensfun)
0166 
0167 # -- Check dependencies for Panorama tool --------------------------------------
0168 
0169 if(FLEX_FOUND AND BISON_FOUND AND KF${QT_VERSION_MAJOR}ThreadWeaver_FOUND)
0170 
0171     set(HAVE_PANORAMA 1)
0172 
0173 else()
0174 
0175     set(HAVE_PANORAMA 0)
0176 
0177 endif()
0178 
0179 # -- Check dependencies for HTMLGallery tool -----------------------------------
0180 
0181 if(LibXml2_FOUND AND LibXslt_FOUND)
0182 
0183     set(HAVE_HTMLGALLERY 1)
0184 
0185 else()
0186 
0187     set(HAVE_HTMLGALLERY 0)
0188 
0189 endif()
0190 
0191 # -- Check dependencies for libraw ---------------------------------------------
0192 
0193 include(RulesLibraw)
0194 
0195 # -- Debug Symbols rules under MacOS -------------------------------------------
0196 
0197 MACOS_DEBUG_POLICIES()
0198 
0199 # -- Compilation options definitions -------------------------------------------
0200 
0201 message(STATUS "--------------------------------------------------")
0202 message(STATUS "")
0203 
0204 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}Sane_FOUND                HAVE_KSANE)
0205 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}FileMetaData_FOUND        HAVE_KFILEMETADATA)
0206 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}CalendarCore_FOUND        HAVE_KCALENDAR)
0207 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}Notifications_FOUND       HAVE_KNOTIFICATIONS)
0208 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}NotifyConfig_FOUND        HAVE_KNOTIFYCONFIG)
0209 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}KIO_FOUND                 HAVE_KIO)
0210 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}IconThemes_FOUND          HAVE_KICONTHEMES)
0211 MACRO_BOOL_TO_01(KF${QT_VERSION_MAJOR}Sonnet_FOUND              HAVE_SONNET)
0212 MACRO_BOOL_TO_01(LensFun_FOUND                                  HAVE_LENSFUN)
0213 MACRO_BOOL_TO_01(Gphoto2_FOUND                                  HAVE_GPHOTO2)
0214 MACRO_BOOL_TO_01(Jasper_FOUND                                   HAVE_JASPER)
0215 MACRO_BOOL_TO_01(Eigen3_FOUND                                   HAVE_EIGEN3)
0216 MACRO_BOOL_TO_01(ENABLE_GEOLOCATION                             HAVE_GEOLOCATION)
0217 MACRO_BOOL_TO_01(ENABLE_AKONADICONTACTSUPPORT                   HAVE_AKONADICONTACT)
0218 MACRO_BOOL_TO_01(ENABLE_MYSQLSUPPORT                            HAVE_MYSQLSUPPORT)
0219 MACRO_BOOL_TO_01(ENABLE_INTERNALMYSQL                           HAVE_INTERNALMYSQL)
0220 MACRO_BOOL_TO_01(ENABLE_MEDIAPLAYER                             HAVE_MEDIAPLAYER)
0221 MACRO_BOOL_TO_01(ENABLE_QTMULTIMEDIA                            HAVE_QTMULTIMEDIA)
0222 MACRO_BOOL_TO_01(ENABLE_DBUS                                    HAVE_DBUS)
0223 MACRO_BOOL_TO_01(ENABLE_APPSTYLES                               HAVE_APPSTYLE_SUPPORT)
0224 MACRO_BOOL_TO_01(ENABLE_QWEBENGINE                              HAVE_QWEBENGINE)
0225 MACRO_BOOL_TO_01(ENABLE_DRMINGW                                 HAVE_DRMINGW)
0226 MACRO_BOOL_TO_01(ImageMagick_FOUND                              HAVE_IMAGE_MAGICK)
0227 MACRO_BOOL_TO_01(HEIF_FOUND                                     HAVE_HEIF)
0228 MACRO_BOOL_TO_01(X265_FOUND                                     HAVE_X265)
0229 MACRO_BOOL_TO_01(Qt5XmlPatterns_FOUND                           HAVE_QTXMLPATTERNS)
0230 MACRO_BOOL_TO_01(CCACHE_FOUND                                   HAVE_CCACHE)
0231 
0232 # Set config files accordingly with optional dependencies
0233 
0234 configure_file(app/utils/digikam_config.h.cmake.in
0235                ${CMAKE_CURRENT_BINARY_DIR}/app/utils/digikam_config.h)
0236 
0237 # ==============================================================================
0238 # Log messages
0239 
0240 message(STATUS "")
0241 message(STATUS "----------------------------------------------------------------------------------")
0242 message(STATUS " digiKam ${DIGIKAM_VERSION_STRING} dependencies results   <https://www.digikam.org>")
0243 message(STATUS "")
0244 
0245 PRINT_COMPONENT_COMPILE_STATUS("MySQL Database Support"                     ENABLE_MYSQLSUPPORT)
0246 PRINT_COMPONENT_COMPILE_STATUS("MySQL Internal Support"                     ENABLE_INTERNALMYSQL)
0247 PRINT_COMPONENT_COMPILE_STATUS("Showfoto Support"                           ENABLE_SHOWFOTO)
0248 PRINT_COMPONENT_COMPILE_STATUS("DBUS Support"                               ENABLE_DBUS)
0249 PRINT_COMPONENT_COMPILE_STATUS("App. Style Support"                         ENABLE_APPSTYLES)
0250 PRINT_COMPONENT_COMPILE_STATUS("QWebEngine Support"                         ENABLE_QWEBENGINE)
0251 PRINT_COMPONENT_COMPILE_STATUS("Geolocation Support"                        ENABLE_GEOLOCATION)
0252 PRINT_COMPONENT_COMPILE_STATUS("Media Player Support"                       ENABLE_MEDIAPLAYER)
0253 PRINT_COMPONENT_COMPILE_STATUS("QtMultimedia Support"                       ENABLE_QTMULTIMEDIA)
0254 
0255 # ==============================================================================
0256 
0257 PRINT_LIBRARY_STATUS("libboostgraph" "https://github.com/boostorg/boost"                 "(version >= 1.43.0)"                Boost_FOUND)
0258 
0259 if(LibExiv2_FOUND)
0260 
0261     PRINT_LIBRARY_STATUS("LibExiv2"  "https://github.com/Exiv2/exiv2"                    "(version >= ${EXIV2_MIN_VERSION}"   LibExiv2_FOUND)
0262 
0263 else()
0264 
0265     PRINT_LIBRARY_STATUS("libexiv2"  "https://github.com/Exiv2/exiv2"                    "(version >= ${EXIV2_MIN_VERSION}"   exiv2_FOUND)
0266 
0267 endif()
0268 
0269 PRINT_LIBRARY_STATUS("libexpat"      "https://libexpat.github.io"                        "(version >= 2.0.0)"                 EXPAT_FOUND)
0270 PRINT_LIBRARY_STATUS("libjpeg"       "https://github.com/libjpeg-turbo/libjpeg-turbo"    "(version >= 6b)"                    JPEG_FOUND)
0271 PRINT_LIBRARY_STATUS("libkde"        "https://invent.kde.org/frameworks/"                "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"    KF${QT_VERSION_MAJOR}_FOUND)
0272 PRINT_LIBRARY_STATUS("liblcms"       "https://github.com/mm2/Little-CMS"                 "(version >= 2.0.0)"                 LCMS2_FOUND)
0273 PRINT_LIBRARY_STATUS("libopencv"     "https://github.com/opencv/opencv"                  "(version >= ${OPENCV_MIN_VERSION})" OpenCV_FOUND)
0274 PRINT_LIBRARY_STATUS("libpng"        "https://libpng.sourceforge.io/"                    "(version >= 1.2.7)"                 PNG_FOUND)
0275 PRINT_LIBRARY_STATUS("libpthread"    "https://www.gnu.org/software/hurd/libpthread.html" "(version >= 2.0.0)"                 CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT)
0276 PRINT_LIBRARY_STATUS("libqt"         "https://code.qt.io/cgit/qt/qtbase.git/"            "(version >= ${QT_MIN_VERSION})"     Qt${QT_VERSION_MAJOR}_FOUND)
0277 PRINT_LIBRARY_STATUS("libtiff"       "https://gitlab.com/libtiff/libtiff/"               "(version >= 3.8.2)"                 TIFF_FOUND)
0278 
0279 # ==============================================================================
0280 
0281 PRINT_OPTIONAL_LIBRARY_STATUS("bison"             "https://www.gnu.org/software/bison/bison.html"                   "(version >= 2.5.0)"                    "digiKam will be compiled without Panorama support."                          BISON_FOUND)
0282 PRINT_OPTIONAL_LIBRARY_STATUS("doxygen"           "https://github.com/doxygen/doxygen"                              "(version >= 1.8.0)"                    "digiKam will be compiled without API documentation building support."        Doxygen_FOUND)
0283 PRINT_OPTIONAL_LIBRARY_STATUS("ccache"            "https://ccache.dev"                                              "(version >= 3.0.0)"                    "digiKam will be compiled without CCACHE build support."                      HAVE_CCACHE)
0284 PRINT_OPTIONAL_LIBRARY_STATUS("flex"              "https://github.com/westes/flex"                                  "(version >= 2.5.0)"                    "digiKam will be compiled without Panorama support."                          FLEX_FOUND)
0285 PRINT_OPTIONAL_LIBRARY_STATUS("libakonadicontact" "https://invent.kde.org/pim/akonadi-contacts"                     "(version >= ${AKONADI_MIN_VERSION})"   "digiKam will be compiled without KDE desktop address book support."          KPim${QT_VERSION_MAJOR}AkonadiContact_FOUND)
0286 PRINT_OPTIONAL_LIBRARY_STATUS("libimagemagick"    "https://github.com/ImageMagick/ImageMagick.git"                  "(version >= 6.7.0)"                    "digiKam will be compiled without ImageMagick codecs."                        HAVE_IMAGE_MAGICK)
0287 PRINT_OPTIONAL_LIBRARY_STATUS("libeigen3"         "https://github.com/eigenteam/eigen-git-mirror"                   "(version >= 3.0.0)"                    "digiKam will be compiled without Refocus tool support."                      Eigen3_FOUND)
0288 PRINT_OPTIONAL_LIBRARY_STATUS("libgphoto2"        "https://github.com/gphoto/libgphoto2"                            "(version >= 2.4.0)"                    "digiKam will be compiled without GPhoto2 camera drivers support."            Gphoto2_FOUND)
0289 PRINT_OPTIONAL_LIBRARY_STATUS("libjasper"         "https://github.com/mdadams/jasper"                               "(version >= 1.7.0)"                    "digiKam will be compiled without JPEG2000 support."                          Jasper_FOUND)
0290 PRINT_OPTIONAL_LIBRARY_STATUS("libkcalendarcore"  "https://invent.kde.org/frameworks/kcalendarcore"                 "(version >= ${CALENDAR_MIN_VERSION})"  "digiKam will be compiled without advanced calendar support."                 KF${QT_VERSION_MAJOR}CalendarCore_FOUND)
0291 PRINT_OPTIONAL_LIBRARY_STATUS("libkfilemetadata"  "https://invent.kde.org/frameworks/kfilemetadata"                 "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without KDE desktop file metadata support."         KF${QT_VERSION_MAJOR}FileMetaData_FOUND)
0292 PRINT_OPTIONAL_LIBRARY_STATUS("libkiconthemes"    "https://invent.kde.org/frameworks/kiconthemes"                   "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without KDE desktop icon themes support."           KF${QT_VERSION_MAJOR}IconThemes_FOUND)
0293 PRINT_OPTIONAL_LIBRARY_STATUS("libkio"            "https://invent.kde.org/frameworks/kio"                           "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without KDE desktop integration support."           KF${QT_VERSION_MAJOR}KIO_FOUND)
0294 PRINT_OPTIONAL_LIBRARY_STATUS("libknotifications" "https://invent.kde.org/frameworks/knotifyconfig"                 "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without KDE desktop notifications support."         KF${QT_VERSION_MAJOR}Notifications_FOUND)
0295 PRINT_OPTIONAL_LIBRARY_STATUS("libknotifyconfig"  "https://invent.kde.org/frameworks/knotifications"                "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without KDE desktop notify configuration support."  KF${QT_VERSION_MAJOR}NotifyConfig_FOUND)
0296 PRINT_OPTIONAL_LIBRARY_STATUS("libsonnet"         "https://invent.kde.org/frameworks/sonnet"                        "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without spell-checking support."                    KF${QT_VERSION_MAJOR}Sonnet_FOUND)
0297 PRINT_OPTIONAL_LIBRARY_STATUS("libksane"          "https://invent.kde.org/graphics/libksane"                        "(version >= ${KSANE_MIN_VERSION})"     "digiKam will be compiled without flat scanners support."                     KF${QT_VERSION_MAJOR}Sane_FOUND)
0298 PRINT_OPTIONAL_LIBRARY_STATUS("liblensfun"        "https://github.com/lensfun/lensfun"                              "(version >= 0.2.6)"                    "digiKam will be compiled without Lens Auto Correction tool support."         LensFun_FOUND)
0299 PRINT_OPTIONAL_LIBRARY_STATUS("libglib2"          "https://developer.gnome.org/glib/"                               "(version >= 2.0.0)"                    "digiKam will be compiled without Contents Aware Resizer tool support."       GLIB2_FOUND)
0300 
0301 PRINT_OPTIONAL_LIBRARY_STATUS("libthreadweaver"   "https://invent.kde.org/frameworks/threadweaver"                  "(version >= ${KF${QT_VERSION_MAJOR}_MIN_VERSION})"       "digiKam will be compiled without Panorama support."                          KF${QT_VERSION_MAJOR}ThreadWeaver_FOUND)
0302 PRINT_OPTIONAL_LIBRARY_STATUS("libxml2"           "https://gitlab.gnome.org/GNOME/libxml2/"                         "(version >= 2.7.0)"                    "digiKam will be compiled without HTMLGallery support."                       LibXml2_FOUND)
0303 PRINT_OPTIONAL_LIBRARY_STATUS("libxslt"           "https://gitlab.gnome.org/GNOME/libxslt"                          "(version >= 1.1.0)"                    "digiKam will be compiled without HTMLGallery support."                       LibXslt_FOUND)
0304 PRINT_OPTIONAL_LIBRARY_STATUS("libheif"           "https://github.com/strukturag/libheif"                           "(version >= 1.6.0)"                    "digiKam will be compiled without HEIF support."                              HEIF_FOUND)
0305 PRINT_OPTIONAL_LIBRARY_STATUS("libx265"           "https://github.com/videolan/x265.git"                            "(version >= 2.2)"                      "digiKam will be compiled without HEIF encoding support."                     X265_FOUND)
0306 PRINT_OPTIONAL_LIBRARY_STATUS("OpenGL"            "https://gitlab.freedesktop.org/mesa/mesa/"                       "(version >= 11.0.0)"                   "digiKam will be compiled without OpenGL support."                            HAVE_OPENGL)
0307 
0308 if(NOT Qt6_FOUND)
0309 
0310     # NOTE: This module have been removed with Qt6.
0311 
0312     PRINT_OPTIONAL_LIBRARY_STATUS("libqtxmlpatterns"  "https://code.qt.io/cgit/qt/qtxmlpatterns.git/"                   "(version >= ${QT_MIN_VERSION})"        "digiKam will be compiled without Rajce tool support."                        HAVE_QTXMLPATTERNS)
0313 
0314 endif()
0315 
0316 # ==============================================================================
0317 
0318 if(Boost_FOUND                          AND
0319    (LibExiv2_FOUND OR exiv2_FOUND)      AND
0320    EXPAT_FOUND                          AND
0321    JPEG_FOUND                           AND
0322    KF${QT_VERSION_MAJOR}_FOUND          AND
0323    LCMS2_FOUND                          AND
0324    OpenCV_FOUND                         AND
0325    PNG_FOUND                            AND
0326    Qt${QT_VERSION_MAJOR}_FOUND          AND
0327    TIFF_FOUND                           AND
0328    Threads_FOUND                        AND
0329    (Qt${QT_VERSION_MAJOR}Test_FOUND OR NOT BUILD_TESTING) AND
0330    (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT)
0331   )
0332 
0333     message(STATUS " digiKam can be compiled.................. YES")
0334     set(DIGIKAM_CAN_BE_COMPILED true)
0335 
0336 else()
0337 
0338     message(FATAL_ERROR " digiKam will be compiled.................. NO  (Check dependencies at https://www.digikam.org/api/index.html#depscomplink)")
0339     set(DIGIKAM_CAN_BE_COMPILED false)
0340 
0341 endif()
0342 
0343 message(STATUS "----------------------------------------------------------------------------------")
0344 message(STATUS "")
0345 
0346 if(DIGIKAM_CAN_BE_COMPILED)
0347 
0348     include(MacroGitHeader)
0349     GIT_HEADER()
0350 
0351     include(MacroBuildDateHeader)
0352     BUILD_DATE_HEADER()
0353 
0354     # ==========================================================================
0355     # To prevent warnings from M$ compiler
0356 
0357     if(WIN32 AND MSVC)
0358 
0359         add_definitions(-D_CRT_SECURE_NO_WARNINGS)
0360         add_definitions(-D_ATL_SECURE_NO_WARNINGS)
0361         add_definitions(-D_AFX_SECURE_NO_WARNINGS)
0362 
0363     endif()
0364 
0365     # ==========================================================================
0366     # To use ccache with compiler
0367 
0368     if(HAVE_CCACHE)
0369 
0370         message(STATUS "Using ccache to speed-up compilations..... YES")
0371         set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
0372         set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK    ccache)
0373 
0374     else()
0375 
0376         message(STATUS "Using ccache to speed-up compilations..... NO")
0377 
0378     endif()
0379 
0380     # ==========================================================================
0381     # Definitions rules
0382 
0383     # TODO: revise dropped compiler flags accordingly with patched source code which fix compilation
0384 
0385     # Remove GCC flags which generate a lots of compilation warnings
0386     REMOVE_GCC_COMPILER_WARNINGS("-Wsuggest-override")
0387     REMOVE_GCC_COMPILER_WARNINGS("-Wcast-align")
0388     REMOVE_GCC_COMPILER_WARNINGS("-Wzero-as-null-pointer-constant")
0389     REMOVE_GCC_COMPILER_WARNINGS("-pedantic")
0390 
0391     # Remove deprecated-copy GCC warnings which generate a lots of compilation warnings
0392     DISABLE_GCC_COMPILER_WARNINGS("8.99.99" "-Wno-deprecated-copy")
0393 
0394     # Remove inconsistent-missing-override Clang warnings which generate a lots of compilation warnings
0395     DISABLE_CLANG_COMPILER_WARNINGS("7.99.99" "-Wno-inconsistent-missing-override")
0396 
0397     if(MINGW)
0398         # Remove ATTRIBUTES GCC flag which generate a lots of compilation warnings with KF${QT_VERSION_MAJOR} frameworks
0399         REMOVE_GCC_COMPILER_WARNINGS("-Wattributes")
0400     endif()
0401 
0402     include(MacroSanitizers)
0403     ENABLE_COMPILER_SANITIZERS()
0404 
0405     # translations catalog
0406     add_definitions(-DTRANSLATION_DOMAIN=\"digikam\")
0407 
0408     # NOTE: with libpgf 6.11.24 OpenMP is not very well supported. We disable
0409     # it to be safe. See B.K.O #273765 for details.
0410     add_definitions(-DLIBPGF_DISABLE_OPENMP)
0411 
0412     # For C++17 and later compatibility LCMS2 must not use register keyword.
0413     add_definitions(-DCMS_NO_REGISTER_KEYWORD=1)
0414 
0415     # Enable C++ Exceptions support, require by Greycstoration algorithm
0416     # (CImg.h) and PGF codec
0417     kde_enable_exceptions()
0418 
0419     # Enforce modern Qt code
0420     add_definitions(-DQT_DEPRECATED_WARNINGS
0421                     -DQT_USE_QSTRINGBUILDER
0422                     -DQT_NO_CAST_TO_ASCII
0423                     -DQT_NO_CAST_FROM_ASCII
0424                     -DQT_NO_CAST_FROM_BYTEARRAY
0425                     -DQT_NO_URL_CAST_FROM_STRING
0426                     -DQT_STRICT_ITERATORS
0427                     -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
0428                     -DQT_DEPRECATED_WARNINGS_SINCE=0x060000
0429                     -DQT_DISABLE_DEPRECATED_BEFORE=0x050E00
0430                     -DQT_NO_KEYWORDS
0431 #                    -DQT_NO_FOREACH
0432     )
0433 
0434     # ==========================================================================
0435     # Includes rules
0436 
0437     # Recursively get all directories which contain header files
0438     # NOTE: Do not parse more than expected root directories to prevent broken
0439     # compilation under Windows as include path length is limited in opposite of POSIX systems.
0440 
0441     set(DK_INCLUDES_ALL "")
0442 
0443     HEADER_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libs DK_LOCAL_INCLUDES_RAW)
0444 
0445     # This macro will set all paths which do not contain libjpeg-, QtAVPlayer, and qtmm.
0446     # We will add later the directory we need
0447 
0448     foreach(var ${DK_LOCAL_INCLUDES_RAW})
0449 
0450         # Filter internal 3rd party library paths to not share with the rest of codes
0451 
0452         string(REGEX MATCH "libjpeg/"          _item_libjpeg    ${var})
0453         string(REGEX MATCH "webservices/o2/"   _item_libo2      ${var})
0454         string(REGEX MATCH "extra/dng_sdk"     _item_libdng     ${var})
0455         string(REGEX MATCH "extra/md5"         _item_libmd5     ${var})
0456         string(REGEX MATCH "extra/xmp_sdk"     _item_libxmp     ${var})
0457         string(REGEX MATCH "pgfutils/libpgf"   _item_libpgf     ${var})
0458         string(REGEX MATCH "rawengine/libraw/" _item_libraw     ${var})
0459         string(REGEX MATCH "/QtAVPlayer"       _item_qtavplayer ${var})
0460         string(REGEX MATCH "/qtmm"             _item_qtmm       ${var})
0461 
0462         if(
0463            _item_libjpeg    STREQUAL "" AND
0464            _item_libo2      STREQUAL "" AND
0465            _item_libdng     STREQUAL "" AND
0466            _item_libmd5     STREQUAL "" AND
0467            _item_libxmp     STREQUAL "" AND
0468            _item_libpgf     STREQUAL "" AND
0469            _item_libraw     STREQUAL "" AND
0470            _item_qtavplayer STREQUAL "" AND
0471            _item_qtmm       STREQUAL ""
0472           )
0473 
0474             list(APPEND DK_LOCAL_INCLUDES ${var})
0475 
0476         endif()
0477 
0478     endforeach()
0479 
0480     set(DK_LOCAL_INCLUDES ${DK_LOCAL_INCLUDES}
0481                           ${CMAKE_CURRENT_SOURCE_DIR}/libs/jpegutils/${DIGIKAM_LIBJPEG_DIR}
0482     )
0483 
0484     # for config headers digikam_version.h digikam_gitversion.h digikam_config.h
0485     # digikam_dbconfig.h digikam_opencv.h digikam_export.h
0486 
0487     set(DK_LOCAL_INCLUDES ${DK_LOCAL_INCLUDES}
0488                           ${CMAKE_CURRENT_SOURCE_DIR}/app/utils
0489                           ${CMAKE_CURRENT_BINARY_DIR}/app/utils
0490     )
0491 
0492     # ==========================================================================
0493     # Common targets parts
0494 
0495     add_subdirectory(data)
0496     add_subdirectory(libs)
0497     add_subdirectory(utilities)
0498     add_subdirectory(app)
0499     add_subdirectory(dplugins)
0500 
0501     if(ENABLE_SHOWFOTO)
0502         add_subdirectory(showfoto)
0503     endif()
0504 
0505     if(BUILD_TESTING)
0506         add_subdirectory(tests)
0507     endif()
0508 
0509 endif()
0510 
0511 # ==============================================================================
0512 # API documentation generation
0513 
0514 include(RulesDoxygen)