Warning, /office/calligra/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16) 0002 0003 project(calligra) 0004 0005 message(STATUS "Using CMake version: ${CMAKE_VERSION}") 0006 0007 if (POLICY CMP0002) 0008 cmake_policy(SET CMP0002 OLD) 0009 endif() 0010 if (POLICY CMP0017) 0011 cmake_policy(SET CMP0017 NEW) 0012 endif () 0013 if (POLICY CMP0022) 0014 cmake_policy(SET CMP0022 OLD) 0015 endif () 0016 if (POLICY CMP0026) 0017 cmake_policy(SET CMP0026 OLD) 0018 endif() 0019 if (POLICY CMP0046) 0020 cmake_policy(SET CMP0046 OLD) 0021 endif () 0022 if (POLICY CMP0059) 0023 cmake_policy(SET CMP0059 OLD) 0024 endif() 0025 if (POLICY CMP0063) 0026 cmake_policy(SET CMP0063 NEW) 0027 endif() 0028 if (POLICY CMP0071) 0029 cmake_policy(SET CMP0071 NEW) 0030 endif() 0031 0032 # ensure out-of-source build 0033 string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" isBuildInSource) 0034 if(isBuildInSource) 0035 message(FATAL_ERROR "Compiling Calligra 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.") 0036 endif() 0037 0038 ###################### 0039 ####################### 0040 ## Constants defines ## 0041 ####################### 0042 ###################### 0043 0044 # define common versions of Calligra applications, used to generate calligraversion.h 0045 # update these version for every release: 0046 set(CALLIGRA_VERSION_STRING "3.2.1") 0047 set(CALLIGRA_STABLE_VERSION_MAJOR 3) # 3 for 3.x, 4 for 4.x, etc. 0048 set(CALLIGRA_STABLE_VERSION_MINOR 2) # 0 for 3.0, 1 for 3.1, etc. 0049 set(CALLIGRA_VERSION_RELEASE 1) # 89 for Alpha, increase for next test releases, set 0 for first Stable, etc. 0050 #set(CALLIGRA_ALPHA 1) # uncomment only for Alpha 0051 # set(CALLIGRA_BETA 1) # uncomment only for Beta 0052 #set(CALLIGRA_RC 1) # uncomment only for RC 0053 set(CALLIGRA_YEAR 2020) # update every year 0054 0055 if(NOT DEFINED CALLIGRA_ALPHA AND NOT DEFINED CALLIGRA_BETA AND NOT DEFINED CALLIGRA_RC) 0056 set(CALLIGRA_STABLE 1) # do not edit 0057 endif() 0058 0059 message(STATUS "Calligra version: ${CALLIGRA_VERSION_STRING}") 0060 0061 # Define the generic version of the Calligra libraries here 0062 # This makes it easy to advance it when the next Calligra release comes. 0063 # 14 was the last GENERIC_CALLIGRA_LIB_VERSION_MAJOR of the previous Calligra series 0064 # (2.x) so we're starting with 15 in 3.x series. 0065 if(CALLIGRA_STABLE_VERSION_MAJOR EQUAL 3) 0066 math(EXPR GENERIC_CALLIGRA_LIB_VERSION_MAJOR "${CALLIGRA_STABLE_VERSION_MINOR} + 15") 0067 else() 0068 # let's make sure we won't forget to update the "15" 0069 message(FATAL_ERROR "Reminder: please update offset == 15 used to compute GENERIC_CALLIGRA_LIB_VERSION_MAJOR to something bigger") 0070 endif() 0071 set(GENERIC_CALLIGRA_LIB_VERSION "${GENERIC_CALLIGRA_LIB_VERSION_MAJOR}.0.0") 0072 set(GENERIC_CALLIGRA_LIB_SOVERSION "${GENERIC_CALLIGRA_LIB_VERSION_MAJOR}") 0073 0074 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 0075 "${CMAKE_SOURCE_DIR}/cmake/modules") 0076 0077 message("Module path:" ${CMAKE_MODULE_PATH}) 0078 0079 # fetch git revision for the current build 0080 0081 set(CALLIGRA_GIT_SHA1_STRING "") 0082 set(CALLIGRA_GIT_BRANCH_STRING "") 0083 0084 include(GetGitRevisionDescription) 0085 get_git_head_revision(GIT_REFSPEC GIT_SHA1) 0086 get_git_branch(GIT_BRANCH) 0087 0088 if(GIT_SHA1 AND GIT_BRANCH) 0089 string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1) 0090 set(CALLIGRA_GIT_SHA1_STRING ${GIT_SHA1}) 0091 set(CALLIGRA_GIT_BRANCH_STRING ${GIT_BRANCH}) 0092 endif() 0093 0094 if(NOT DEFINED RELEASE_BUILD) 0095 # estimate mode by CMAKE_BUILD_TYPE content if not set on cmdline 0096 string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) 0097 set(RELEASE_BUILD_TYPES "release" "relwithdebinfo" "minsizerel") 0098 list(FIND RELEASE_BUILD_TYPES "${CMAKE_BUILD_TYPE_TOLOWER}" INDEX) 0099 if (INDEX EQUAL -1) 0100 set(RELEASE_BUILD FALSE) 0101 else() 0102 set(RELEASE_BUILD TRUE) 0103 endif() 0104 endif() 0105 message(STATUS "Release build: ${RELEASE_BUILD}") 0106 0107 # use CPP-11 0108 if (CMAKE_VERSION VERSION_LESS "3.1") 0109 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 0110 else () 0111 set (CMAKE_CXX_STANDARD 11) 0112 endif () 0113 0114 ############ 0115 ############# 0116 ## Options ## 0117 ############# 0118 ############ 0119 0120 option(GHNS "support Get Hot New Stuff" OFF) 0121 option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only." ON) 0122 0123 ####################### 0124 ######################## 0125 ## Productset setting ## 0126 ######################## 0127 ####################### 0128 0129 # For predefined productsets see the definitions in CalligraProducts.cmake and 0130 # in the files in the folder cmake/productsets. 0131 0132 # Finding out the products & features to build is done in 5 steps: 0133 # 1. have the user define the products/features wanted, by giving a productset 0134 # 2. estimate all additional required products/features 0135 # 3. estimate which of the products/features can be build by external deps 0136 # 4. find which products/features have been temporarily disabled due to problems 0137 # 5. estimate which of the products/features can be build by internal deps 0138 0139 # get the special macros 0140 include(CalligraProductSetMacros) 0141 0142 # get the definitions of products, features and product sets 0143 include(CalligraProducts.cmake) 0144 0145 set(PRODUCTSET_DEFAULT "ALL") 0146 0147 if(NOT PRODUCTSET) 0148 set(PRODUCTSET ${PRODUCTSET_DEFAULT} CACHE STRING "Set of products/features to build" FORCE) 0149 endif() 0150 0151 if (RELEASE_BUILD) 0152 set(CALLIGRA_SHOULD_BUILD_STAGING FALSE) 0153 if(BUILD_UNMAINTAINED) 0154 set(CALLIGRA_SHOULD_BUILD_UNMAINTAINED TRUE) 0155 else() 0156 set(CALLIGRA_SHOULD_BUILD_UNMAINTAINED FALSE) 0157 endif() 0158 else () 0159 set(CALLIGRA_SHOULD_BUILD_STAGING TRUE) 0160 set(CALLIGRA_SHOULD_BUILD_UNMAINTAINED TRUE) 0161 endif () 0162 0163 # finally choose products/features to build 0164 calligra_set_productset(${PRODUCTSET}) 0165 0166 ########################## 0167 ########################### 0168 ## Look for ECM, Qt, KF5 ## 0169 ########################### 0170 ########################## 0171 set(REQUIRED_KF5_VERSION "5.7.0") 0172 set(REQUIRED_QT_VERSION "5.3.0") 0173 0174 find_package(ECM 5.19 REQUIRED NO_MODULE) 0175 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) 0176 0177 # ECM KDE macros (include first, to have their policies and settings effect all other macros) 0178 include(KDEInstallDirs) 0179 include(KDECMakeSettings NO_POLICY_SCOPE) 0180 include(KDECompilerSettings NO_POLICY_SCOPE) 0181 # CMake macros 0182 include(CMakePackageConfigHelpers) 0183 include(WriteBasicConfigVersionFile) 0184 include(CheckFunctionExists) 0185 include(CheckTypeSize) 0186 include(CheckIncludeFile) 0187 include(GenerateExportHeader) 0188 include(FeatureSummary) 0189 # ECM macros 0190 include(ECMOptionalAddSubdirectory) 0191 include(ECMInstallIcons) 0192 include(ECMAddAppIcon) 0193 include(ECMSetupVersion) 0194 include(ECMAddTests) 0195 include(ECMMarkAsTest) 0196 include(ECMMarkNonGuiExecutable) 0197 include(ECMGenerateHeaders) 0198 # own macros 0199 include(MacroBoolTo01) 0200 include(MacroOptionalFindPackage) 0201 include(MacroEnsureVersion) 0202 include(MacroDesktopToJson) 0203 0204 find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED 0205 COMPONENTS 0206 Archive 0207 Codecs 0208 Completion 0209 Config 0210 ConfigWidgets 0211 CoreAddons 0212 DBusAddons 0213 DocTools 0214 GuiAddons 0215 I18n 0216 IconThemes 0217 ItemViews 0218 JobWidgets 0219 KCMUtils 0220 KDELibs4Support 0221 KIO 0222 Kross 0223 Notifications 0224 NotifyConfig 0225 Parts 0226 Sonnet 0227 TextWidgets 0228 Wallet 0229 WidgetsAddons 0230 WindowSystem 0231 XmlGui 0232 ) 0233 0234 find_package(KF5Activities) 0235 find_package(KF5KHtml) 0236 0237 set_package_properties(KF5Activities PROPERTIES 0238 TYPE OPTIONAL 0239 ) 0240 set_package_properties(KF5KHtml PROPERTIES 0241 PURPOSE "Required for HTML2ODS import filter" 0242 TYPE OPTIONAL 0243 ) 0244 0245 if(KF5Activities_FOUND) 0246 set(HAVE_KACTIVITIES TRUE) 0247 endif() 0248 0249 if(${KF5_VERSION} VERSION_LESS "5.16.0") 0250 set(CALLIGRA_OLD_PLUGIN_METADATA TRUE) 0251 endif() 0252 0253 find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED 0254 COMPONENTS 0255 Core 0256 Gui 0257 Network 0258 PrintSupport 0259 Svg 0260 Test 0261 Widgets 0262 Xml 0263 ) 0264 find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET 0265 COMPONENTS 0266 DBus 0267 OpenGL 0268 Quick 0269 QuickWidgets 0270 Sql 0271 ) 0272 0273 # Qt5Declarative was removed in Qt 5.6.0 so search for it in a separate call 0274 # Including it in a collected find_package(Qt5 ...) call can lead to a fatal not-found error: 0275 # * Qt5 (required version >= 5.3.0) 0276 find_package(Qt5Declarative ${REQUIRED_QT_VERSION} QUIET) 0277 0278 set_package_properties(Qt5DBus PROPERTIES 0279 TYPE RECOMMENDED 0280 ) 0281 set_package_properties(Qt5Declarative PROPERTIES 0282 PURPOSE "Required for QtQuick1 components" 0283 TYPE RECOMMENDED 0284 ) 0285 set_package_properties(Qt5OpenGL PROPERTIES 0286 PURPOSE "Required for QtQuick1 components" 0287 TYPE RECOMMENDED 0288 ) 0289 set_package_properties(Qt5Quick PROPERTIES 0290 PURPOSE "Required for QtQuick2 components" 0291 TYPE RECOMMENDED 0292 ) 0293 set_package_properties(Qt5QuickWidgets PROPERTIES 0294 PURPOSE "Required for Calligra Gemini" 0295 TYPE RECOMMENDED 0296 ) 0297 set_package_properties(Qt5Sql PROPERTIES 0298 PURPOSE "Optional for Sheets' database connection" 0299 TYPE OPTIONAL 0300 ) 0301 set_package_properties(Qt5WebKit PROPERTIES 0302 PURPOSE "Required for Braindump's Web shape" 0303 TYPE OPTIONAL 0304 ) 0305 0306 set(HAVE_OPENGL ${Qt5OpenGL_FOUND}) 0307 0308 0309 if (GHNS) 0310 find_package(Attica 3.0) 0311 find_package(NewStuff) 0312 set_package_properties(Attica PROPERTIES 0313 DESCRIPTION "Attica is used for Get Hot New Stuff." 0314 URL "https://commits.kde.org/attica" 0315 TYPE OPTIONAL 0316 ) 0317 0318 if (NOT LIBATTICA_FOUND) 0319 set(GHNS FALSE) 0320 else () 0321 message(STATUS "WARNING: You are compiling with Get Hot New Stuff enabled. Do not do that when building distribution packages. GHNS is unusable these days until someone starts maintaining it again.") 0322 endif () 0323 endif () 0324 0325 find_package(X11) 0326 if(X11_FOUND) 0327 find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED 0328 COMPONENTS 0329 X11Extras 0330 ) 0331 set(HAVE_X11 TRUE) 0332 add_definitions(-DHAVE_X11) 0333 else() 0334 set(HAVE_X11 FALSE) 0335 endif() 0336 0337 # use sane compile flags 0338 add_definitions( 0339 -DQT_USE_QSTRINGBUILDER 0340 -DQT_STRICT_ITERATORS 0341 -DQT_NO_SIGNALS_SLOTS_KEYWORDS 0342 -DQT_NO_URL_CAST_FROM_STRING 0343 -DQT_NO_CAST_TO_ASCII 0344 ) 0345 0346 # only with this definition will all the FOO_TEST_EXPORT macro do something 0347 # TODO: check if this can be moved to only those places which make use of it, 0348 # to reduce global compiler definitions that would trigger a recompile of 0349 # everything on a change (like adding/removing tests to/from the build) 0350 if(BUILD_TESTING) 0351 add_definitions(-DCOMPILING_TESTS) 0352 endif() 0353 0354 # overcome some platform incompatibilities 0355 if(WIN32) 0356 if(NOT MINGW) 0357 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks) 0358 add_definitions(-D_USE_MATH_DEFINES) 0359 add_definitions(-DNOMINMAX) 0360 endif() 0361 set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib) 0362 endif() 0363 0364 ########################### 0365 ############################ 0366 ## Required dependencies ## 0367 ############################ 0368 ########################### 0369 0370 find_package(Perl REQUIRED) 0371 find_package(ZLIB REQUIRED) 0372 0373 add_definitions(-DBOOST_ALL_NO_LIB) 0374 find_package(Boost REQUIRED COMPONENTS system) # for pigment and stage 0375 if (NOT Boost_FOUND) 0376 message(FATAL_ERROR "Did not find Boost. Boost is required for the core libraries, stage, sheets.") 0377 endif () 0378 0379 ########################### 0380 ############################ 0381 ## Optional dependencies ## 0382 ############################ 0383 ########################### 0384 0385 0386 ## 0387 ## Check for OpenEXR 0388 ## 0389 0390 macro_optional_find_package(OpenEXR) 0391 macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR) 0392 0393 ## 0394 ## Test for GNU Scientific Library 0395 ## 0396 macro_optional_find_package(GSL 1.7) 0397 set_package_properties(GSL_FOUND PROPERTIES 0398 DESCRIPTION "GNU Scientific Library" 0399 URL "https://www.gnu.org/software/gsl" 0400 PURPOSE "Required by Sheets' solver plugin" 0401 TYPE OPTIONAL 0402 ) 0403 macro_bool_to_01(GSL_FOUND HAVE_GSL) 0404 configure_file(config-gsl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gsl.h ) 0405 0406 ## 0407 ## Test for Phonon4Qt5 0408 ## 0409 find_package(Phonon4Qt5 QUIET) 0410 set_package_properties(Phonon4Qt5 PROPERTIES 0411 DESCRIPTION "Abstraction lib for multimedia applications" 0412 URL "https://www.kde.org/" 0413 PURPOSE "Required by Stage event actions and Videoshape plugin" 0414 TYPE OPTIONAL 0415 ) 0416 0417 ## 0418 ## Test for KF5CalendarCore 0419 ## 0420 find_package(KF5CalendarCore CONFIG QUIET) 0421 set_package_properties(KF5CalendarCore PROPERTIES 0422 DESCRIPTION "KDE Calendar Library" 0423 URL "https://www.kde.org/" 0424 PURPOSE "Optionally used by semantic item Event" 0425 TYPE OPTIONAL 0426 ) 0427 0428 ## 0429 ## Test for KF5Contacts 0430 ## 0431 find_package(KF5Contacts CONFIG QUIET) 0432 set_package_properties(KF5Contacts PROPERTIES 0433 DESCRIPTION "KDE Address book Library" 0434 URL "https://www.kde.org/" 0435 PURPOSE "Optionally used by semantic item Contact" 0436 TYPE OPTIONAL 0437 ) 0438 0439 ## 0440 ## Test for KF5AkonadiCore 0441 ## 0442 find_package(KF5Akonadi CONFIG QUIET) 0443 set_package_properties(KF5Akonadi PROPERTIES 0444 DESCRIPTION "Library for general Access to Akonadi" 0445 URL "https://www.kde.org/" 0446 PURPOSE "Optionally used by semantic items Event and Contact" 0447 TYPE OPTIONAL 0448 ) 0449 0450 ## 0451 ## Test for KChart 0452 ## 0453 macro_optional_find_package(KChart 2.7.0 QUIET) 0454 set_package_properties(KChart PROPERTIES 0455 DESCRIPTION "Library for creating business charts (part of KDiagram)" 0456 URL "https://www.kde.org/" 0457 PURPOSE "Required by Chart shape" 0458 TYPE RECOMMENDED 0459 ) 0460 0461 ## 0462 ## Test for eigen3 0463 ## 0464 macro_optional_find_package(Eigen3) 0465 set_package_properties(Eigen3 PROPERTIES 0466 DESCRIPTION "C++ template library for linear algebra" 0467 URL "http://eigen.tuxfamily.org" 0468 PURPOSE "Required by Calligra Sheets" 0469 TYPE RECOMMENDED 0470 ) 0471 0472 ## 0473 ## Test for QCA2 0474 ## 0475 macro_optional_find_package(Qca-qt5 2.1.0 QUIET) 0476 set_package_properties(Qca-qt5 PROPERTIES 0477 DESCRIPTION "Qt Cryptographic Architecture" 0478 URL "http:/download.kde.org/stable/qca-qt5" 0479 PURPOSE "Required for encrypted OpenDocument files and encrypted xls files support (available as a module in kdesupport)" 0480 TYPE OPTIONAL 0481 ) 0482 0483 ## 0484 ## Test for soprano 0485 ## 0486 # QT5TODO: push for released (and maintained) Qt5 version of Soprano, T462, T461 0487 # macro_optional_find_package(Soprano) 0488 set(Soprano_FOUND FALSE) 0489 set_package_properties(Soprano PROPERTIES 0490 DESCRIPTION "RDF handling library" 0491 URL "http://soprano.sourceforge.net/" 0492 PURPOSE "Required to handle RDF metadata in ODF" 0493 TYPE OPTIONAL 0494 ) 0495 if(NOT Soprano_FOUND) 0496 set(SOPRANO_INCLUDE_DIR "") 0497 endif() 0498 0499 ## 0500 ## Test for marble 0501 ## 0502 # Temporary fix to avoid looking for Marble unneccessary 0503 # Its only used in RDF so until soprano is ported there is no use for Marble 0504 if (Soprano_FOUND) 0505 macro_optional_find_package(Marble CONFIG) 0506 set(Marble_FOUND FALSE) 0507 set_package_properties(Marble PROPERTIES 0508 DESCRIPTION "World Globe Widget library" 0509 URL "https://marble.kde.org/" 0510 PURPOSE "Required by RDF to show locations on a map" 0511 TYPE OPTIONAL 0512 ) 0513 else() 0514 message(STATUS "Soprano not found. Skipped looking for Marble.") 0515 endif() 0516 0517 ## 0518 ## Test for lcms 0519 ## 0520 macro_optional_find_package(LCMS2) 0521 set_package_properties(LCMS2 PROPERTIES 0522 DESCRIPTION "LittleCMS, a color management engine" 0523 URL "http://www.littlecms.com" 0524 PURPOSE "Will be used for color management" 0525 TYPE OPTIONAL 0526 ) 0527 if(LCMS2_FOUND) 0528 if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 ) 0529 set(HAVE_LCMS24 TRUE) 0530 endif() 0531 set(HAVE_REQUIRED_LCMS_VERSION TRUE) 0532 set(HAVE_LCMS2 TRUE) 0533 endif() 0534 0535 ## 0536 ## Test for Vc 0537 ## 0538 0539 set(HAVE_VC FALSE) 0540 if (BUILD_VC) 0541 # NOTE: This tampers with cmake variables (at least cmake_minimum_required), so may give build problems 0542 set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) 0543 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) 0544 if( NOT MSVC) 0545 macro_optional_find_package(Vc 1.1.0) 0546 set_package_properties(Vc PROPERTIES 0547 DESCRIPTION "Portable, zero-overhead SIMD library for C++" 0548 URL "https://github.com/VcDevel/Vc" 0549 PURPOSE "Required by the pigment for vectorization" 0550 TYPE OPTIONAL 0551 ) 0552 macro_bool_to_01(Vc_FOUND HAVE_VC) 0553 macro_bool_to_01(PACKAGERS_BUILD DO_PACKAGERS_BUILD) 0554 endif() 0555 configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h ) 0556 0557 if(HAVE_VC) 0558 message(STATUS "Vc found!") 0559 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 0560 "${CMAKE_SOURCE_DIR}/cmake/vc") 0561 0562 include (VcMacros) 0563 0564 if(Vc_COMPILER_IS_CLANG) 0565 set(ADDITIONAL_VC_FLAGS "-Wabi -ffp-contract=fast -fPIC") 0566 elseif (NOT MSVC) 0567 set(ADDITIONAL_VC_FLAGS "-Wabi -fabi-version=0 -ffp-contract=fast -fPIC") 0568 endif() 0569 0570 #Handle Vc master 0571 if(Vc_COMPILER_IS_GCC OR Vc_COMPILER_IS_CLANG) 0572 AddCompilerFlag("-std=c++11" _ok) 0573 if(NOT _ok) 0574 AddCompilerFlag("-std=c++0x" _ok) 0575 endif() 0576 endif() 0577 0578 macro(ko_compile_for_all_implementations_no_scalar _objs _src) 0579 if(PACKAGERS_BUILD) 0580 vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2) 0581 else() 0582 set(${_objs} ${_src}) 0583 endif() 0584 endmacro() 0585 0586 macro(ko_compile_for_all_implementations _objs _src) 0587 if(PACKAGERS_BUILD) 0588 vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY Scalar SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2) 0589 else() 0590 set(${_objs} ${_src}) 0591 endif() 0592 endmacro() 0593 0594 if (NOT PACKAGERS_BUILD) 0595 # Optimize the whole Calligra for current architecture 0596 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}") 0597 endif () 0598 endif() 0599 set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH} ) 0600 0601 else(BUILD_VC) 0602 configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h ) 0603 endif(BUILD_VC) 0604 0605 if(WIN32) 0606 set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} 0607 RUNTIME DESTINATION ${BIN_INSTALL_DIR} 0608 LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS} 0609 ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} ) 0610 endif() 0611 0612 ## 0613 ## Test for Fontconfig 0614 ## 0615 ## Only test if on non-Windows system 0616 if(NOT WIN32 AND NOT APPLE) 0617 macro_optional_find_package(Fontconfig) 0618 set_package_properties(Fontconfig PROPERTIES 0619 DESCRIPTION "Library for configuring and customizing font access" 0620 URL "http://fontconfig.org" 0621 PURPOSE "Required to handle exact font size" 0622 TYPE RECOMMENDED 0623 ) 0624 endif() 0625 0626 ## 0627 ## Test for Freetype 0628 ## 0629 ## Only test if on non-Windows system 0630 if(NOT WIN32 AND NOT APPLE) 0631 macro_optional_find_package(Freetype) 0632 set_package_properties(Freetype PROPERTIES 0633 DESCRIPTION "A Free, High-Quality, and Portable Font Engine" 0634 URL "http://www.freetype.org/" 0635 PURPOSE "Required to handle exact font size" 0636 TYPE RECOMMENDED 0637 ) 0638 endif() 0639 0640 if(NOT Fontconfig_FOUND OR NOT FREETYPE_FOUND) 0641 set(Fontconfig_INCLUDE_DIRS "") 0642 set(FREETYPE_INCLUDE_DIRS "") 0643 else() 0644 add_definitions( -DSHOULD_BUILD_FONT_CONVERSION ) 0645 endif() 0646 0647 0648 ## 0649 ## Test endianess 0650 ## 0651 include (TestBigEndian) 0652 test_big_endian(CMAKE_WORDS_BIGENDIAN) 0653 0654 ## 0655 ## Test SharedMimeInfo 0656 ## 0657 macro_optional_find_package(SharedMimeInfo 1.3) 0658 set_package_properties(SharedMimeInfo PROPERTIES 0659 PURPOSE "Required to determine file types SVM or all of MSOOXML." 0660 TYPE RECOMMENDED 0661 ) 0662 0663 ## 0664 ## Test for Okular 0665 ## 0666 macro_optional_find_package(Okular5 0.99.60 QUIET) 0667 set_package_properties(Okular5 PROPERTIES 0668 DESCRIPTION "A unified document viewer" 0669 URL "https://okular.kde.org/" 0670 PURPOSE "Required to build the plugins for Okular" 0671 TYPE OPTIONAL 0672 ) 0673 0674 ## 0675 ## Test for librevenge 0676 ## 0677 macro_optional_find_package(LibRevenge) 0678 set_package_properties(LibRevenge PROPERTIES 0679 DESCRIPTION "A base library for writing document import filters" 0680 URL "http://sf.net/p/libwpd/librevenge/" 0681 PURPOSE "Required by various import filters" 0682 TYPE OPTIONAL 0683 ) 0684 0685 ## 0686 ## Test for libodfgen 0687 ## 0688 macro_optional_find_package(LibOdfGen) 0689 set_package_properties(LibOdfGen PROPERTIES 0690 DESCRIPTION "Open Document Format Generation Library" 0691 URL "http://sf.net/p/libwpd/libodfgen/" 0692 PURPOSE "Required by various import filters" 0693 TYPE OPTIONAL 0694 ) 0695 0696 ## 0697 ## Test for WordPerfect Document Library 0698 ## 0699 macro_optional_find_package(LibWpd) 0700 set_package_properties(LibWpd PROPERTIES 0701 DESCRIPTION "WordPerfect Document Library" 0702 URL "http://libwpd.sourceforge.net/" 0703 PURPOSE "Required by the Words WPD import filter" 0704 TYPE OPTIONAL 0705 ) 0706 0707 ## 0708 ## Test for WordPerfect Graphics Library 0709 ## 0710 macro_optional_find_package(LibWpg) 0711 set_package_properties(LibWpg PROPERTIES 0712 DESCRIPTION "WordPerfect Graphics Library" 0713 URL "http://libwpg.sourceforge.net/" 0714 PURPOSE "Required by the Karbon WPG import filter" 0715 TYPE OPTIONAL 0716 ) 0717 0718 ## 0719 ## Test for Microsoft Works Document Library 0720 ## 0721 macro_optional_find_package(LibWps) 0722 set_package_properties(LibWps PROPERTIES 0723 DESCRIPTION "Microsoft Works Document Library" 0724 URL "http://libwps.sourceforge.net/" 0725 PURPOSE "Required by the Words WPS import filter" 0726 TYPE OPTIONAL 0727 ) 0728 0729 ## 0730 ## Test for Microsoft Visio Document Library 0731 ## 0732 macro_optional_find_package(LibVisio) 0733 set_package_properties(LibVisio PROPERTIES 0734 DESCRIPTION "Visio Import Filter Library" 0735 URL "https://wiki.documentfoundation.org/DLP/Libraries/libvisio" 0736 PURPOSE "Required by the visio import filter" 0737 TYPE OPTIONAL 0738 ) 0739 0740 ## 0741 ## Test for Apple Keynote Document Library 0742 ## 0743 macro_optional_find_package(LibEtonyek) 0744 set_package_properties(LibEtonyek PROPERTIES 0745 DESCRIPTION "Apple Keynote Document Library" 0746 URL "https://wiki.documentfoundation.org/DLP/Libraries/libetonyek" 0747 PURPOSE "Required by the Stage keynote import filter" 0748 TYPE OPTIONAL 0749 ) 0750 0751 ## 0752 ## Test for qt-poppler 0753 ## 0754 macro_optional_find_package(Poppler COMPONENTS Qt5) 0755 set_package_properties(Poppler PROPERTIES 0756 DESCRIPTION "A PDF rendering library" 0757 URL "http://poppler.freedesktop.org" 0758 PURPOSE "Required by the Karbon PDF import filter and CSTester PDF feature" 0759 TYPE OPTIONAL 0760 ) 0761 0762 ## 0763 ## Test for qt-poppler not-officially-supported XPDF Headers 0764 ## Installing these is off by default in poppler sources, so lets make 0765 ## sure they're really there before trying to build the pdf import 0766 ## 0767 macro_optional_find_package(PopplerXPDFHeaders) 0768 set_package_properties(PopplerXPDFHeaders PROPERTIES 0769 DESCRIPTION "XPDF headers in the Poppler Qt5 interface library" 0770 URL "http://poppler.freedesktop.org" 0771 PURPOSE "Required by the Karbon PDF import filter" 0772 TYPE OPTIONAL 0773 ) 0774 0775 0776 ## 0777 ## Test for libgit2 0778 ## 0779 macro_optional_find_package(Libgit2) 0780 0781 ## 0782 ## Generate a file for prefix information 0783 ## 0784 0785 ############################### 0786 ################################ 0787 ## Add Calligra helper macros ## 0788 ################################ 0789 ############################### 0790 0791 include(MacroCalligraAddBenchmark) 0792 0793 #################### 0794 ##################### 0795 ## Define includes ## 0796 ##################### 0797 #################### 0798 0799 # WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before 0800 # any other include directory 0801 0802 # for config.h and <toplevel/foo.h> includes (if any?) 0803 include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces ) 0804 0805 0806 set(KOVERSION_INCLUDES ${CMAKE_SOURCE_DIR}/libs/version 0807 ${CMAKE_BINARY_DIR}/libs/version 0808 ) 0809 0810 include_directories(${KOVERSION_INCLUDES}) 0811 0812 # koplugin is at the bottom of the stack 0813 set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/plugin) 0814 0815 set(KUNDO2_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kundo2 0816 ${CMAKE_BINARY_DIR}/libs/kundo2) 0817 0818 # koodf is at the bottom of the stack 0819 set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf 0820 ${CMAKE_SOURCE_DIR}/libs/store 0821 ${CMAKE_BINARY_DIR}/libs/odf 0822 ${CMAKE_BINARY_DIR}/libs/store 0823 ${KOVERSION_INCLUDES} 0824 ) 0825 0826 # pigment depends on koplugin and lcms 0827 set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES} 0828 ${KOVERSION_INCLUDES} 0829 ${CMAKE_SOURCE_DIR}/libs/pigment 0830 ${CMAKE_BINARY_DIR}/libs/pigment 0831 ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops 0832 ${CMAKE_SOURCE_DIR}/libs/pigment/resources 0833 ${Boost_INCLUDE_DIRS} 0834 0835 ) 0836 0837 # flake depends on koodf and pigment 0838 set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake 0839 ${KOODF_INCLUDES} 0840 ${PIGMENT_INCLUDES} 0841 ${KUNDO2_INCLUDES} 0842 ${CMAKE_SOURCE_DIR}/libs/widgetutils 0843 ${CMAKE_SOURCE_DIR}/libs/flake/commands 0844 ${CMAKE_SOURCE_DIR}/libs/flake/tools 0845 ${CMAKE_SOURCE_DIR}/libs/flake/svg 0846 ${CMAKE_BINARY_DIR}/libs/flake) 0847 0848 # vectorimage 0849 set(VECTORIMAGE_INCLUDES 0850 ${CMAKE_SOURCE_DIR}/libs/vectorimage 0851 ${CMAKE_SOURCE_DIR}/libs/vectorimage/libemf 0852 ${CMAKE_SOURCE_DIR}/libs/vectorimage/libsvm 0853 ${CMAKE_SOURCE_DIR}/libs/vectorimage/libwmf) 0854 0855 # KoText depends on koplugin, odf 0856 set(KOTEXT_INCLUDES 0857 ${CMAKE_SOURCE_DIR}/libs/text 0858 ${CMAKE_BINARY_DIR}/libs/text 0859 ${CMAKE_SOURCE_DIR}/libs/text/changetracker 0860 ${CMAKE_SOURCE_DIR}/libs/text/styles 0861 ${CMAKE_SOURCE_DIR}/libs/text/opendocument 0862 ${SOPRANO_INCLUDE_DIR} 0863 ${FLAKE_INCLUDES} 0864 ${KOODF_INCLUDES}) 0865 0866 # TextLayout depends on kotext 0867 set(TEXTLAYOUT_INCLUDES ${KOTEXT_INCLUDES} 0868 ${CMAKE_SOURCE_DIR}/libs/textlayout 0869 ${CMAKE_BINARY_DIR}/libs/textlayout) 0870 0871 # Widgets depends on kotext and flake 0872 set(KOWIDGETS_INCLUDES ${KOTEXT_INCLUDES} 0873 ${CMAKE_SOURCE_DIR}/libs/widgetutils 0874 ${CMAKE_BINARY_DIR}/libs/widgetutils 0875 ${CMAKE_SOURCE_DIR}/libs/widgets 0876 ${CMAKE_BINARY_DIR}/libs/widgets) 0877 0878 # BasicFlakes depends on flake, widgets 0879 set(BASICFLAKES_INCLUDES ${KOWIDGETS_INCLUDES} 0880 ${CMAKE_SOURCE_DIR}/libs/basicflakes 0881 ${CMAKE_SOURCE_DIR}/libs/basicflakes/tools) 0882 0883 0884 # komain depends on kotext & flake 0885 set(KOMAIN_INCLUDES 0886 ${KOWIDGETS_INCLUDES} 0887 ${TEXTLAYOUT_INCLUDES} 0888 ${CMAKE_SOURCE_DIR}/libs/main 0889 ${CMAKE_BINARY_DIR}/libs/main 0890 ${CMAKE_SOURCE_DIR}/libs/main/config) 0891 0892 set(KORDF_INCLUDES ${KOMAIN_INCLUDES} 0893 ${CMAKE_SOURCE_DIR}/libs/rdf 0894 ) 0895 set(KORDF_LIBS kordf) 0896 0897 if(SHOULD_BUILD_FEATURE_SCRIPTING) 0898 set(KOKROSS_INCLUDES 0899 ${CMAKE_SOURCE_DIR}/libs/kross 0900 ${CMAKE_BINARY_DIR}/libs/kross) 0901 endif() 0902 0903 # kopageapp 0904 set(KOPAGEAPP_INCLUDES ${TEXTLAYOUT_INCLUDES} 0905 ${PIGMENT_INCLUDES} 0906 ${KOMAIN_INCLUDES} 0907 ${CMAKE_SOURCE_DIR}/libs/widgets 0908 ${CMAKE_SOURCE_DIR}/libs/pageapp 0909 ${CMAKE_SOURCE_DIR}/libs/pageapp/commands 0910 ${CMAKE_BINARY_DIR}/libs/pageapp ) 0911 0912 ############################################# 0913 #### filter libraries #### 0914 ############################################# 0915 0916 # libodf2 0917 set(KOODF2_INCLUDES 0918 ${CMAKE_SOURCE_DIR}/filters/libodf2 0919 ${CMAKE_SOURCE_DIR}/filters/libodf2/chart 0920 ) 0921 0922 # libodfreader 0923 set(KOODFREADER_INCLUDES 0924 ${CMAKE_SOURCE_DIR}/filters/libodfreader 0925 ) 0926 0927 ################################################### 0928 #################################################### 0929 ## Detect which products/features can be compiled ## 0930 #################################################### 0931 ################################################### 0932 0933 if (NOT WIN32) 0934 set(NOT_WIN TRUE) 0935 endif() 0936 if (NOT QT_MAC_USE_COCOA) 0937 set(NOT_COCOA TRUE) 0938 endif() 0939 if (KReport_FOUND AND KREPORT_SCRIPTING) 0940 set(KReport_WithScripting_FOUND TRUE) 0941 endif() 0942 0943 calligra_drop_product_on_bad_condition( FEATURE_RDF 0944 Soprano_FOUND "Soprano not found" 0945 ) 0946 0947 calligra_drop_product_on_bad_condition( PART_SHEETS 0948 EIGEN3_FOUND "Eigen devel not found" 0949 ) 0950 0951 calligra_drop_product_on_bad_condition( OKULAR_GENERATOR_ODP 0952 Okular5_FOUND "Okular devel not found" 0953 ) 0954 0955 calligra_drop_product_on_bad_condition( OKULAR_GENERATOR_ODT 0956 Okular5_FOUND "Okular devel not found" 0957 ) 0958 0959 calligra_drop_product_on_bad_condition( PLUGIN_CHARTSHAPE 0960 KChart_FOUND "KChart devel not found" 0961 ) 0962 0963 calligra_drop_product_on_bad_condition( PLUGIN_VIDEOSHAPE 0964 Phonon4Qt5_FOUND "Phonon4Qt5 devel not found" 0965 ) 0966 0967 calligra_drop_product_on_bad_condition( FILTER_KEY_TO_ODP 0968 LIBODFGEN_FOUND "libodfgen devel not found" 0969 LIBETONYEK_FOUND "libetonyek devel not found" 0970 LIBREVENGE_FOUND "librevenge devel not found" 0971 ) 0972 0973 calligra_drop_product_on_bad_condition( FILTER_VISIO_TO_ODG 0974 LIBODFGEN_FOUND "libodfgen devel not found" 0975 LIBVISIO_FOUND "libvisio devel not found" 0976 LIBREVENGE_FOUND "librevenge devel not found" 0977 ) 0978 0979 calligra_drop_product_on_bad_condition( FILTER_WORDPERFECT_TO_ODT 0980 LIBODFGEN_FOUND "libodfgen devel not found" 0981 LIBWPD_FOUND "libwpd devel not found" 0982 LIBWPG_FOUND "libwpg devel not found" 0983 LIBREVENGE_FOUND "librevenge devel not found" 0984 ) 0985 0986 calligra_drop_product_on_bad_condition( FILTER_WORKS_TO_ODT 0987 LIBODFGEN_FOUND "libodfgen devel not found" 0988 LIBWPS_FOUND "libwps devel not found" 0989 LIBREVENGE_FOUND "librevenge devel not found" 0990 ) 0991 0992 calligra_drop_product_on_bad_condition( FILTER_WPG_TO_SVG 0993 LIBWPG_FOUND "libwpg devel not found" 0994 LIBREVENGE_FOUND "librevenge devel not found" 0995 ) 0996 0997 calligra_drop_product_on_bad_condition( FILTER_WPG_TO_ODG 0998 LIBODFGEN_FOUND "libodfgen devel not found" 0999 LIBWPG_FOUND "libwpg devel not found" 1000 LIBREVENGE_FOUND "librevenge devel not found" 1001 ) 1002 1003 calligra_drop_product_on_bad_condition( FILTER_PDF_TO_SVG 1004 NOT_WIN "not supported on Windows" 1005 PopplerXPDFHeaders_FOUND "poppler xpdf headers not found" 1006 ) 1007 1008 calligra_drop_product_on_bad_condition( FILTER_HTML_TO_ODS 1009 NOT_WIN "not supported on Windows" 1010 NOT_COCOA "not supported with Qt Cocoa" 1011 KF5KHtml_FOUND "KF5KHtml devel not found" 1012 ) 1013 1014 calligra_drop_product_on_bad_condition( FILTER_SHEETS_TO_HTML 1015 NOT_WIN "not supported on Windows" 1016 NOT_COCOA "not supported with Qt Cocoa" 1017 ) 1018 1019 calligra_drop_product_on_bad_condition( FILTER_KSPREAD_TO_LATEX 1020 NOT_WIN "not supported on Windows" 1021 NOT_COCOA "not supported with Qt Cocoa" 1022 ) 1023 1024 calligra_drop_product_on_bad_condition( APP_BRAINDUMP 1025 NOT_WIN "unmaintained on Windows" 1026 Qt5WebKitWidgets_FOUND "QWebPage needed for webpage plugin" 1027 ) 1028 1029 calligra_drop_product_on_bad_condition( PLUGIN_CALLIGRAGEMINI_GIT 1030 LIBGIT2_FOUND "libgit2 devel not found" 1031 ) 1032 1033 calligra_drop_product_on_bad_condition( PART_QTQUICK 1034 Qt5OpenGL_FOUND "Qt OpenGL not found" 1035 Qt5Declarative_FOUND "QtDeclarative not found" 1036 ) 1037 1038 calligra_drop_product_on_bad_condition( PART_COMPONENTS 1039 Qt5Quick_FOUND "QtQuick not found" 1040 ) 1041 1042 calligra_drop_product_on_bad_condition( APP_SLIDECOMPARE 1043 Qt5OpenGL_FOUND "Qt OpenGL not found" 1044 ) 1045 1046 ############################################# 1047 #### Backward compatibility BUILD_x=off #### 1048 ############################################# 1049 1050 # workaround: disable directly all products which might be activated by internal 1051 # dependencies, but belong to scope of old flag 1052 calligra_drop_products_on_old_flag(braindump APP_BRAINDUMP) 1053 calligra_drop_products_on_old_flag(karbon APP_KARBON) 1054 calligra_drop_products_on_old_flag(sheets PART_SHEETS APP_SHEETS) 1055 calligra_drop_products_on_old_flag(stage PART_STAGE APP_STAGE) 1056 calligra_drop_products_on_old_flag(words PART_WORDS APP_WORDS) 1057 1058 ############################################# 1059 #### Temporarily broken products #### 1060 ############################################# 1061 1062 # If a product does not build due to some temporary brokeness disable it here, 1063 # by calling calligra_disable_product with the product id and the reason, 1064 # e.g.: 1065 # calligra_disable_product(APP_FOO "isn't buildable at the moment") 1066 1067 calligra_disable_product(APP_BRAINDUMP "Disabled, will (probably) be removed from Calligra") 1068 1069 ############################################# 1070 #### Calculate buildable products #### 1071 ############################################# 1072 1073 calligra_drop_unbuildable_products() 1074 1075 1076 ############################################# 1077 #### Setup product-depending vars #### 1078 ############################################# 1079 1080 if(SHOULD_BUILD_FEATURE_RDF) 1081 add_definitions( -DSHOULD_BUILD_RDF ) 1082 endif() 1083 1084 ################### 1085 #################### 1086 ## Subdirectories ## 1087 #################### 1088 ################### 1089 1090 add_subdirectory(words) 1091 1092 add_subdirectory(stage) 1093 1094 add_subdirectory(sheets) 1095 1096 if(SHOULD_BUILD_APP_KARBON) 1097 add_subdirectory(karbon) 1098 endif() 1099 1100 if(SHOULD_BUILD_APP_BRAINDUMP) 1101 add_subdirectory(braindump) 1102 endif() 1103 1104 if(SHOULD_BUILD_DOC) 1105 add_subdirectory(doc) 1106 endif() 1107 1108 if(SHOULD_BUILD_PART_QTQUICK) 1109 add_subdirectory(qtquick) 1110 endif() 1111 1112 if(SHOULD_BUILD_PART_COMPONENTS) 1113 add_subdirectory(components) 1114 endif() 1115 1116 if(SHOULD_BUILD_GEMINI) 1117 add_subdirectory(gemini) 1118 endif() 1119 1120 # non-app directories are moved here because they can depend on SHOULD_BUILD_{appname} variables set above 1121 add_subdirectory(libs) 1122 add_subdirectory(interfaces) 1123 add_subdirectory(pics) 1124 add_subdirectory(plugins) 1125 add_subdirectory(servicetypes) 1126 add_subdirectory(devtools) 1127 add_subdirectory(extras) 1128 add_subdirectory(filters) 1129 add_subdirectory(data) 1130 1131 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) 1132 1133 calligra_product_deps_report("product_deps") 1134 calligra_log_should_build() 1135 1136 add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 1137 1138 configure_file(KoConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h ) 1139 if (SHOULD_BUILD_DEVEL_HEADERS) 1140 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h DESTINATION ${INCLUDE_INSTALL_DIR}/calligra COMPONENT Devel) 1141 endif() 1142 1143 if (BUILD_TESTING) 1144 add_subdirectory(tests) 1145 endif(BUILD_TESTING)