Warning, /office/calligraplan/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 if (POLICY CMP0048)
0002     cmake_policy(SET CMP0048 NEW)
0003 endif ()
0004 
0005 # define the version of Plan
0006 # update these version for every release:
0007 # Alpha x.x.89
0008 # Beta: x.x.90 upwards. (Beta 1 = 90, Beta 2 = 91 ...)
0009 # Stable x.x.0 upwards
0010 project(calligraplan VERSION 3.3.89)
0011 set(PLAN_YEAR 2023) # update every year
0012 
0013 cmake_minimum_required(VERSION 3.16)
0014 if (POLICY CMP0002)
0015     cmake_policy(SET CMP0002 NEW)
0016 endif ()
0017 if (POLICY CMP0017)
0018     cmake_policy(SET CMP0017 NEW)
0019 endif ()
0020 if (POLICY CMP0022)
0021     cmake_policy(SET CMP0022 NEW)
0022 endif ()
0023 if (POLICY CMP0026)
0024     cmake_policy(SET CMP0026 NEW)
0025 endif()
0026 if (POLICY CMP0046)
0027     cmake_policy(SET CMP0046 NEW)
0028 endif ()
0029 if (POLICY CMP0059)
0030     cmake_policy(SET CMP0059 NEW)
0031 endif()
0032 if (POLICY CMP0063)
0033     cmake_policy(SET CMP0063 NEW)
0034 endif()
0035 if (POLICY CMP0071)
0036     cmake_policy(SET CMP0071 NEW)
0037 endif()
0038 if (POLICY CMP0115)
0039     cmake_policy(SET CMP0115 NEW)
0040 endif()
0041 
0042 set(PLAN_VERSION_STRING ${PROJECT_VERSION})
0043 set(PLAN_STABLE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
0044 set(PLAN_STABLE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
0045 set(PLAN_VERSION_RELEASE ${PROJECT_VERSION_PATCH})
0046 set(PLAN_RELEASE_TYPE "Stable")
0047 if (PROJECT_VERSION_PATCH EQUAL 89)
0048     set(PLAN_ALPHA 1)
0049     set(PLAN_RELEASE_TYPE "Alpha")
0050 elseif (PROJECT_VERSION_PATCH GREATER 89)
0051     set(PLAN_BETA 1)
0052     math(EXPR PLAN_BETA_VERSION "${PLAN_VERSION_RELEASE} - 89")
0053     set(PLAN_RELEASE_TYPE "Beta ${PLAN_BETA_VERSION}")
0054 endif()
0055 
0056 # Define the generic version of the Calligra Plan libraries here
0057 # This makes it easy to advance it when the next release comes.
0058 # 14 was the last GENERIC_CALLIGRA_LIB_VERSION_MAJOR of the previous Calligra series
0059 # (2.x) so we're starting with 15 in 3.x series.
0060 #if(PLAN_STABLE_VERSION_MAJOR EQUAL 3)
0061     math(EXPR GENERIC_PLAN_LIB_VERSION_MAJOR "${PLAN_STABLE_VERSION_MAJOR} + 15")
0062 #else()
0063     ## let's make sure we won't forget to update the "15"
0064     #message(FATAL_ERROR "Reminder: please update offset == 15 used to compute GENERIC_PLAN_LIB_VERSION_MAJOR to something bigger")
0065 #endif()
0066 set(GENERIC_PLAN_LIB_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
0067 set(GENERIC_PLAN_LIB_SOVERSION "${PROJECT_VERSION_MAJOR}")
0068 
0069 message(STATUS "")
0070 message(STATUS "Build Calligra Plan ${PLAN_VERSION_STRING} (${PLAN_RELEASE_TYPE}) with cmake version: ${CMAKE_VERSION}, required version: ${CMAKE_MINIMUM_REQUIRED_VERSION}")
0071 message(STATUS "")
0072 
0073 
0074 # ensure out-of-source build
0075 string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" isBuildInSource)
0076 if(isBuildInSource)
0077     message(FATAL_ERROR "Compiling Plan inside the source folder is not possible.\nPlease refer to the build instruction: https://community.kde.org/Calligra/Building/3\nYou need to clean up the source folder from all build artifacts just created, otherwise further building attempts will fail again: With a git repo, you can use \"git clean -df\" in the toplevel source folder (attention! will remove also uncommitted changes to the source code). With sources from a file bundle (like a zip file), delete the source folder and unbundle the sources again.")
0078 endif()
0079 
0080 
0081 ############
0082 #############
0083 ## Options ##
0084 #############
0085 ############
0086 
0087 option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only." ON)
0088 
0089 ##########################
0090 ###########################
0091 ## Look for ECM, Qt, KF5 ##
0092 ###########################
0093 ##########################
0094 
0095 set(REQUIRED_QT_VERSION "5.15.2")
0096 set(REQUIRED_KF5_VERSION "5.100.0")
0097 
0098 find_package(ECM ${REQUIRED_KF5_VERSION} REQUIRED NO_MODULE)
0099 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
0100 
0101 # ECM KDE macros (include first, to have their policies and settings effect all other macros)
0102 include(KDEInstallDirs)
0103 include(KDECMakeSettings NO_POLICY_SCOPE)
0104 include(KDECompilerSettings NO_POLICY_SCOPE)
0105 # CMake macros
0106 include(CMakePackageConfigHelpers)
0107 include(WriteBasicConfigVersionFile)
0108 include(CheckFunctionExists)
0109 include(CheckTypeSize)
0110 include(CheckIncludeFile)
0111 include(GenerateExportHeader)
0112 include(FeatureSummary)
0113 # ECM macros
0114 include(ECMOptionalAddSubdirectory)
0115 include(ECMInstallIcons)
0116 include(ECMAddAppIcon)
0117 include(ECMSetupVersion)
0118 include(ECMAddTests)
0119 include(ECMMarkAsTest)
0120 include(ECMMarkNonGuiExecutable)
0121 include(ECMGenerateHeaders)
0122 # Own macros
0123 # This macro is a copy from calligra so only needs to be included when plan is build stand alone
0124 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
0125 include(MacroOptionalFindPackage)
0126 
0127 find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED
0128     COMPONENTS
0129         Archive
0130 #             Codecs
0131 #             Completion
0132         Config
0133         ConfigWidgets
0134         CoreAddons
0135         DBusAddons
0136         GuiAddons
0137         I18n
0138         IconThemes
0139         ItemViews
0140         ItemModels
0141         JobWidgets
0142         KIO
0143         Notifications
0144 #             NotifyConfig
0145         Parts
0146         Sonnet
0147         TextWidgets
0148         WidgetsAddons
0149         WindowSystem
0150         XmlGui
0151 #         Kross
0152 )
0153 
0154 find_package(KF5Activities)
0155 
0156 set_package_properties(KF5Activities PROPERTIES
0157     DESCRIPTION "Library for Activities"
0158     PURPOSE "Required for activities support (optional)"
0159     TYPE OPTIONAL
0160 )
0161 if(KF5Activities_FOUND)
0162     set(HAVE_KACTIVITIES TRUE)
0163 endif()
0164 
0165 #find_package(KF5KHtml)
0166 #set_package_properties(KF5KHtml PROPERTIES
0167     #PURPOSE "Required for rich text support"
0168     #TYPE REQUIRED
0169 #)
0170 
0171 find_package(KF5Holidays)
0172 set_package_properties(KF5Holidays PROPERTIES
0173     DESCRIPTION "Library for generation of public holidays"
0174     PURPOSE "Required for holidays support (optional)"
0175     TYPE RECOMMENDED
0176 )
0177 
0178 find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED
0179     COMPONENTS
0180         Core
0181         Gui
0182         PrintSupport
0183         Test
0184         Widgets
0185         Xml
0186 )
0187 find_package(Qt5DBus ${REQUIRED_QT_VERSION} QUIET)
0188 set_package_properties(Qt5DBus PROPERTIES
0189     DESCRIPTION "Library for dbus access"
0190     PURPOSE "Required for dbus support (optional)"
0191     TYPE OPTIONAL
0192 )
0193 
0194 find_package(X11)
0195 if(X11_FOUND)
0196     find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED
0197         COMPONENTS
0198             X11Extras
0199     )
0200     set(HAVE_X11 TRUE)
0201     add_definitions(-DHAVE_X11)
0202 else()
0203     set(HAVE_X11 FALSE)
0204 endif()
0205 
0206 ##
0207 ## Test SharedMimeInfo
0208 ##
0209 macro_optional_find_package(SharedMimeInfo 1.3)
0210 set_package_properties(SharedMimeInfo PROPERTIES
0211     PURPOSE "Required by Calligra Plan Portfolio Manager and Import/Export filters."
0212     TYPE REQUIRED
0213 )
0214 
0215 # use sane compile flags
0216 add_definitions(
0217 -DQT_USE_QSTRINGBUILDER
0218 -DQT_STRICT_ITERATORS
0219 -DQT_NO_SIGNALS_SLOTS_KEYWORDS
0220 -DQT_NO_URL_CAST_FROM_STRING
0221 -DQT_NO_CAST_TO_ASCII
0222 )
0223 
0224 # only with this definition will all the FOO_TEST_EXPORT macro do something
0225 # TODO: check if this can be moved to only those places which make use of it,
0226 # to reduce global compiler definitions that would trigger a recompile of
0227 # everything on a change (like adding/removing tests to/from the build)
0228 if(BUILD_TESTING)
0229     add_definitions(-DCOMPILING_TESTS)
0230 endif()
0231 
0232 # overcome some platform incompatibilities
0233 if(WIN32)
0234     include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks)
0235     add_definitions(-D_USE_MATH_DEFINES)
0236     add_definitions(-DNOMINMAX)
0237     set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib)
0238 endif()
0239 
0240 ###########################
0241 ############################
0242 ## Required dependencies  ##
0243 ############################
0244 ###########################
0245 
0246 set(REQUIRED_KDIAGRAM_VERSION 2.8)
0247 
0248 ##
0249 ## Test for KGantt
0250 ##
0251 macro_optional_find_package(KGantt ${REQUIRED_KDIAGRAM_VERSION} QUIET)
0252 set_package_properties(KGantt PROPERTIES
0253     DESCRIPTION "Library for creating Gantt diagrams (part of KDiagram)"
0254     URL "https://www.kde.org/"
0255     TYPE REQUIRED
0256 )
0257 if(KGantt_FOUND)
0258     set(KGANTT_VERSION_MAJOR "${KGantt_VERSION_MAJOR}")
0259     set(KGANTT_VERSION_MINOR "${KGantt_VERSION_MINOR}")
0260     set(KGANTT_VERSION_PATCH "${KGantt_VERSION_PATCH}")
0261 endif()
0262 
0263 ##
0264 ## Test for KChart
0265 ##
0266 macro_optional_find_package(KChart ${REQUIRED_KDIAGRAM_VERSION} QUIET)
0267 set_package_properties(KChart PROPERTIES
0268     DESCRIPTION "Library for creating business charts (part of KDiagram)"
0269     URL "https://www.kde.org/"
0270     TYPE REQUIRED
0271 )
0272 
0273 ##
0274 ## Test for QCA2
0275 ##
0276 macro_optional_find_package(Qca-qt5 2.1.0 QUIET)
0277 set_package_properties(Qca-qt5 PROPERTIES
0278     DESCRIPTION "Qt Cryptographic Architecture"
0279     URL "https:/download.kde.org/stable/qca-qt5"
0280     PURPOSE "Required for encrypted OpenDocument files and encrypted xls files support"
0281     TYPE OPTIONAL
0282 )
0283 
0284 find_package(KF5Wallet ${REQUIRED_KF5_VERSION})
0285 
0286 if(Qca-qt5_FOUND AND KF5Wallet_FOUND)
0287     add_definitions( -DQCA2 )
0288 endif()
0289 
0290 find_package(Perl REQUIRED)
0291 
0292 ###########################
0293 ############################
0294 ## Optional dependencies  ##
0295 ############################
0296 ###########################
0297 
0298 ### Remove dependency on KF5AkonadiContact
0299 ### Review how to get at contacts in more portable way
0300 ##
0301 ## Test for KF5AkonadiContact
0302 ##
0303 # find_package(KF5AkonadiContact CONFIG QUIET)
0304 # set_package_properties(KF5AkonadiContact PROPERTIES
0305 #     DESCRIPTION "Library for Accessing Contacts stored in Akonadi"
0306 #     URL "https://www.kde.org/"
0307 #     PURPOSE "Required for address book support"
0308 #     TYPE OPTIONAL
0309 # )
0310 
0311 ##
0312 ## Test for KF5CalendarCore
0313 ##
0314 find_package(KF5CalendarCore CONFIG QUIET)
0315 set_package_properties(KF5CalendarCore PROPERTIES
0316     DESCRIPTION "KDE Calendar Library"
0317     URL "https://www.kde.org/"
0318     PURPOSE "Used by calendar export"
0319     TYPE OPTIONAL
0320     )
0321 
0322 if(WIN32)
0323     set(LIB_INSTALL_DIR ${KDE_INSTALL_LIBDIR}
0324                         RUNTIME DESTINATION ${KDE_INSTALL_BINDIR}
0325                         LIBRARY ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
0326                         ARCHIVE ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
0327 endif()
0328 
0329 find_package(Java 8 COMPONENTS Runtime)
0330 set_package_properties(Java PROPERTIES
0331     DESCRIPTION "Java Runtime Environment"
0332     URL "https://www.java.com/"
0333     PURPOSE "Used by MPXJ based import filters and unit tests"
0334     TYPE OPTIONAL
0335 )
0336 
0337 #### Disable kreport for now, reconsider when it is stable ####
0338 if (TEST_FOR_KREPORT)
0339     #
0340     # Test for KReport
0341     #
0342     macro_optional_find_package(KReport 3.1 QUIET)
0343     set_package_properties(KReport PROPERTIES
0344         PURPOSE "Required for KReport support in Plan"
0345         TYPE OPTIONAL
0346     )
0347 
0348     ##
0349     ## Test for KPropertyWidgets
0350     ##
0351     macro_optional_find_package(KPropertyWidgets 3.1 QUIET)
0352     set_package_properties(KPropertyWidgets PROPERTIES
0353         PURPOSE "Required for KReports support in Plan"
0354         TYPE OPTIONAL
0355     )
0356     if (KReport_FOUND AND KPropertyWidgets_FOUND)
0357         set(PLAN_USE_KREPORT TRUE)
0358     endif()
0359 endif (TEST_FOR_KREPORT)
0360 
0361 
0362 add_subdirectory(src)
0363 add_subdirectory(devtools)
0364 add_subdirectory(doc)
0365 add_subdirectory(data)
0366 
0367 ki18n_install(po)
0368 if(KF5DocTools_FOUND)
0369     kdoctools_install(po)
0370 endif()
0371 
0372 if (BUILD_TESTING)
0373     add_subdirectory(tests)
0374 endif()
0375 
0376 ### Summarize findings ####
0377 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0378 
0379