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

0001 #
0002 # SPDX-FileCopyrightText: 2010-2024, Gilles Caulier, <caulier dot gilles at gmail dot com>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005 #
0006 
0007 set(CMAKE_MIN_VERSION   "3.16")
0008 
0009 cmake_minimum_required(VERSION ${CMAKE_MIN_VERSION})
0010 
0011 message(STATUS "CMake version: ${CMAKE_VERSION}")
0012 
0013 # ==============================================================================
0014 # Information to update before to release this package.
0015 
0016 # digiKam version
0017 set(DIGIKAM_MAJOR_VERSION "8")
0018 set(DIGIKAM_MINOR_VERSION "3")
0019 set(DIGIKAM_PATCH_VERSION "0")
0020 
0021 # Suffix to add at end of version string. Usual values are:
0022 # "-git"   : alpha code unstable from git. Do not use in production
0023 # "-beta1" : beta1 release.
0024 # "-beta2" : beta2 release.
0025 # "-beta3" : beta3 release.
0026 # "-rc"    : release candidate.
0027 # ""       : final release. Can be used in production.
0028 set(DIGIKAM_SUFFIX_VERSION "")
0029 
0030 # ==============================================================================
0031 # Set env. variables accordingly.
0032 
0033 # NOTE: This string is used to set libdigikamcore and libdigikamdatabase SO version ID
0034 set(DIGIKAM_VERSION_SHORT
0035     "${DIGIKAM_MAJOR_VERSION}.${DIGIKAM_MINOR_VERSION}.${DIGIKAM_PATCH_VERSION}"
0036 )
0037 
0038 set(DIGIKAM_VERSION_STRING
0039     "${DIGIKAM_VERSION_SHORT}${DIGIKAM_SUFFIX_VERSION}"
0040 )
0041 
0042 # Core Database XML version
0043 # We must set this variable here at top level because it is used in both
0044 # libs/database/core and data/database
0045 # Version history:
0046 # 1 : Original database XML file, published in production.
0047 # 2 : 08-08-2014 : Fix Images.names field size (see bug #327646).
0048 # 3 : 05/11/2015 : Add Face DB schema.
0049 set(DBCORECONFIG_XML_VERSION "3")
0050 
0051 # ==============================================================================
0052 
0053 project(digikam
0054         VERSION ${DIGIKAM_VERSION_SHORT}
0055         LANGUAGES CXX C)
0056 
0057 # Settings from ECM
0058 set(CMAKE_CXX_STANDARD          17)
0059 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0060 set(CMAKE_CXX_EXTENSIONS        OFF)
0061 
0062 message(STATUS "----------------------------------------------------------------------------------")
0063 message(STATUS "Starting CMake configuration for ${PROJECT_NAME}")
0064 message(STATUS "")
0065 message(STATUS "Target Build Type: ${CMAKE_BUILD_TYPE}")
0066 
0067 # Extra check to detect Qt core with minimal version before to continue.
0068 
0069 set(QT5_MIN_VERSION       "5.14.0")
0070 set(QT6_MIN_VERSION       "6.5.0")
0071 set(CMAKE_MODULE_PATH 
0072                       ${CMAKE_SOURCE_DIR}/core/cmake/modules
0073                       ${CMAKE_SOURCE_DIR}/core/cmake/macros
0074                       ${CMAKE_SOURCE_DIR}/core/cmake/rules
0075 )
0076 
0077 # Must be done before ECM checks.
0078 
0079 include(RulesFindQtCore)
0080 
0081 if(Qt6_FOUND)
0082     set(ECM_MIN_VERSION "5.240.0")
0083 else()
0084     set(ECM_MIN_VERSION "5.55.0")
0085 endif()
0086 
0087 ### ECM setup #########################################################################################################
0088 
0089 find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
0090 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
0091                       ${ECM_MODULE_PATH}
0092 )
0093 
0094 # KDE Framework macros
0095 include(KDEInstallDirs)
0096 include(KDECMakeSettings)
0097 include(KDECompilerSettings NO_POLICY_SCOPE)
0098 remove_definitions(-DQT_NO_FOREACH)
0099 
0100 # ECM macros
0101 include(ECMSetupVersion)
0102 include(ECMOptionalAddSubdirectory)
0103 include(ECMMarkNonGuiExecutable)
0104 include(ECMGenerateHeaders)
0105 include(ECMGeneratePriFile)
0106 include(ECMInstallIcons)
0107 include(ECMAddAppIcon)
0108 include(ECMPoQmTools)
0109 include(ECMAddTests)
0110 include(ECMMarkAsTest)
0111 
0112 # Cmake macros
0113 include(CMakePackageConfigHelpers)
0114 include(GenerateExportHeader)
0115 include(CheckFunctionExists)
0116 include(FeatureSummary)
0117 
0118 # Local macros
0119 include(MacroUtils)
0120 include(MacroCompiler)
0121 include(MacroOpenCV)
0122 include(MacroJPEG)
0123 include(MacroBoolTo01)
0124 
0125 #######################################################################################################################
0126 
0127 APPLY_COMMON_POLICIES()
0128 
0129 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
0130 set(CMAKE_AUTOMOC ON)
0131 #set(CMAKE_AUTOUIC ON)
0132 #set(CMAKE_AUTORCC ON)
0133 
0134 if(MSVC)
0135     set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
0136     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
0137 endif()
0138 
0139 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
0140 set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Generated")
0141 
0142 ### COMPILATION OPTIONS MANAGEMENT ####################################################################################
0143 
0144 option(DIGIKAMSC_COMPILE_PO              "Build translations files (default=ON)"                                                  ON)
0145 option(DIGIKAMSC_COMPILE_DIGIKAM         "Build digiKam core (default=ON)"                                                        ON)
0146 
0147 #######################################################################################################################
0148 
0149 if(DIGIKAMSC_COMPILE_PO AND NOT MSVC)
0150     set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)
0151 endif()
0152 
0153 if(BUILD_TESTING)
0154     include(CTest)
0155 endif()
0156 
0157 ######################################################################################################################
0158 
0159 message(STATUS "----------------------------------------------------------------------------------")
0160 message(STATUS "Top level compilation configuration for ${PROJECT_NAME}")
0161 message(STATUS "")
0162 
0163 if(DIGIKAMSC_COMPILE_DIGIKAM)
0164     if(NOT EXISTS ${CMAKE_SOURCE_DIR}/core)
0165         message(STATUS "${PROJECT_NAME} will be compiled....................... NO (source code not available)")
0166         set (DIGIKAMSC_COMPILE_DIGIKAM OFF)
0167     else()
0168         message(STATUS "${PROJECT_NAME} will be compiled....................... YES")
0169     endif()
0170 else()
0171     message(STATUS     "${PROJECT_NAME} will be compiled....................... NO")
0172 endif()
0173 
0174 if(DIGIKAMSC_COMPILE_PO)
0175     message(STATUS "Translations will be compiled.................. YES")
0176 else()
0177     message(STATUS "Translations will be compiled.................. NO")
0178 endif()
0179 
0180 if(BUILD_TESTING)
0181     message(STATUS "Tests code will be compiled.................... YES")
0182 else()
0183     message(STATUS "Tests code will be compiled.................... NO")
0184 endif()
0185 
0186 ######################################################################################################################
0187 
0188 if(DIGIKAMSC_COMPILE_DIGIKAM)
0189     add_subdirectory(core)
0190 endif()
0191 
0192 if(DIGIKAMSC_COMPILE_PO)
0193     find_package(Gettext REQUIRED)
0194     find_package(KF${QT_VERSION_MAJOR}I18n NO_MODULE)
0195     ki18n_install(po)
0196 endif()
0197 
0198 if(BUILD_TESTING)
0199 
0200     # Some unit tests require data from the external "Digikam Test Data" git repository.
0201     # https://invent.kde.org/graphics/digikam-test-data
0202     #
0203     # Developers may choose to obtain the data using the "download-repos" script prior to running cmake.
0204     # For CI runners to run tests, the following custom target serves to perform the download automatically.
0205     # If the directory "test-data" has already been created, the target becomes a "no-op".
0206     #
0207     add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/test-data 
0208                        COMMENT "Checkout unit-test data repository. Please wait..."
0209                        COMMAND git
0210                        ARGS clone https://invent.kde.org/graphics/digikam-test-data.git ${CMAKE_SOURCE_DIR}/test-data)
0211     add_custom_target(test-data ALL DEPENDS ${CMAKE_SOURCE_DIR}/test-data)
0212 
0213 endif()