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

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