CMakeLists.txt 27.5 KB
Newer Older
1
project(calligra)
Laurent Montel's avatar
Laurent Montel committed
2

3
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
4

5
cmake_policy(SET CMP0002 OLD)
6 7 8 9 10

#cmake_policy CMP0017 was introduced in version 2.8.4
if(${CMAKE_VERSION} VERSION_GREATER 2.8.3)
    cmake_policy(SET CMP0017 NEW)
endif()
Laurent Montel's avatar
Laurent Montel committed
11

12 13 14 15 16 17
 ############
#############
## Options ##
#############
############

18 19 20 21 22
 ######################
#######################
## Constants defines ##
#######################
######################
Thomas Zander's avatar
Thomas Zander committed
23

Boudewijn Rempt's avatar
Boudewijn Rempt committed
24 25
# define the generic version of the Calligra libraries here
# this makes it easy to advance it when the next Calligra release comes
26 27
set(GENERIC_CALLIGRA_LIB_VERSION "12.0.0")
set(GENERIC_CALLIGRA_LIB_SOVERSION "12")
28

29
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
30

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

 ####################
#####################
## Product defines ##
#####################
####################

# There are currently 4 product sets predefined:
# "ACTIVE", "CREATIVE", "DESKTOP", "ALL" (default).
# One can define her/his own set, see cmake/productsts/README

# Finding out the products to build is done in x steps:
# 1. have the user define the products wanted
# 2. estimate all additional required products
# 3. estimate which of the products can be build by external deps
# 4. estimate which of the products can be build by internal deps

include(CalligraProductSetMacros)

option(GHNS "support Get Hot New Stuff" ON)
option(NEPOMUK "support NEPOMUK Tagging" ON)
# TODO: orthogonal setting, results in minimal features, yet needs to be defined
# option(TINY "compile a tiny Calligra" OFF)
option(QT3SUPPORT "Build the parts of Calligra that still depend on Qt3" ON)
55
option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only." ON)
56 57 58 59

# TODO: remove option and migration code below before 3.0 release
option(CREATIVEONLY "compile only Karbon and Krita" OFF)

60 61 62 63 64
#
# WARNING: don't change the SHOULD_BUILD_app if an application
# doesn't build, but rather add the following line:
# option(BUILD_app "Build directory app" OFF)
#
65 66
#eg:
#option(BUILD_kexi "Build directory kexi" OFF) # kexi isn't buildable at the moment
67

68 69 70 71 72 73 74 75
# temporary migration support
set(PRODUCTSET_DEFAULT "ALL")
if (CREATIVEONLY)
    set(WARN_ABOUT_CREATIVEONLY TRUE)
    set(PRODUCTSET_DEFAULT "CREATIVE")
endif (CREATIVEONLY)

if(NOT PRODUCTSET)
76
    set(PRODUCTSET ${PRODUCTSET_DEFAULT} CACHE STRING "Set of products to build" FORCE)
77 78 79 80 81 82 83 84
endif(NOT PRODUCTSET)

# TODO: also add headers/sdk for all the libs ("_DEVEL"?)
# TODO: filters
# TODO: note external deps for products, so they are only checked if needed
# There can be required or optional external deps, required will also result
# in automatic disabling of product building
# TODO: some products have multiple optional requirements, but need at least one.
85
# See CONVERTER, EXTRA_*
86 87
calligra_define_product(LIB_KDGANTT "libkdgantt")
calligra_define_product(LIB_KDCHART "libkdchart")
88
calligra_define_product(LIB_VECTORIMAGE "libvectorimage")
89 90 91 92 93
calligra_define_product(LIB_KOPROPERTY "libkoproperty")
calligra_define_product(LIB_KOREPORT "libkoreport" NEEDS LIB_KOPROPERTY)
calligra_define_product(LIB_CALLIGRADB "libcalligradb")
calligra_define_product(LIB_KOPAGEAPP "Lib for paged documents")
calligra_define_product(SCRIPTING "") # TODO
94
calligra_define_product(WORDS_PART "Words engine" NEEDS LIB_VECTORIMAGE) # LIB_VECTORIMAGE for epub filter, TODO
95 96 97 98 99 100 101 102
calligra_define_product(WORDS_APP "Words executable (for Desktop)"  NEEDS WORDS_PART)
calligra_define_product(WORDS "Full Words (for Desktop)"  NEEDS WORDS_APP)
calligra_define_product(STAGE_PART "Stage engine" NEEDS LIB_KOPAGEAPP)
calligra_define_product(STAGE_APP "Stage executable (for Desktop)"  NEEDS STAGE_PART)
calligra_define_product(STAGE "Full Stage (for Desktop)"  NEEDS STAGE_APP)
calligra_define_product(SHEETS_PART "Sheets engine")
calligra_define_product(SHEETS_APP "Sheets executable (for Desktop)" NEEDS SHEETS_PART)
calligra_define_product(SHEETS "Full Sheets (for Desktop)" NEEDS SHEETS_APP)
103
calligra_define_product(AUTHOR "Full Author (for Desktop)" NEEDS WORDS_PART)
104
calligra_define_product(KARBON "Full Karbon (for Desktop)" NEEDS LIB_VECTORIMAGE) # LIB_VECTORIMAGE for wmf filter, TODO
105 106 107 108 109 110 111
calligra_define_product(KRITA "Full Krita (for Desktop)")
calligra_define_product(KEXI "Full Kexi (for Desktop)"  NEEDS LIB_KOREPORT LIB_CALLIGRADB)
calligra_define_product(FLOW "Full Flow (for Desktop)"  NEEDS LIB_KOPAGEAPP)
calligra_define_product(PLAN "Full Plan (for Desktop)"  NEEDS LIB_KOREPORT LIB_KDCHART LIB_KDGANTT)
calligra_define_product(BRAINDUMP "Full Braindump (for Desktop)")
calligra_define_product(ACTIVE "Calligra Active" NEEDS  SHEETS_PART STAGE_PART WORDS_PART)
calligra_define_product(CALLIGRA "")
112
calligra_define_product(DOC "Calligra Documentations")
113
# extras
114 115 116 117 118
calligra_define_product(CONVERTER "Format converter for commandline")
calligra_define_product(EXTRA_PROPERTIES "Plugin for the KDE file properties dialog")
calligra_define_product(EXTRA_THUMBNAIL "Plugins for KDE filesystem thumbnailing")
calligra_define_product(EXTRA_QUICKPRINT "Plugin for the KDE filemanager adding a \"Print\" action")
calligra_define_product(OKULARODPGENERATOR "Plugin for Okular adding support for ODP and MS PPT/PPTX" NEEDS STAGE_PART)
119
# plugins
120 121 122 123 124 125
calligra_define_product(PLUGIN_COLORENGINES "")
calligra_define_product(PLUGIN_MUSICSHAPE "")
calligra_define_product(PLUGIN_SPACENAVIGATOR "")
calligra_define_product(PLUGIN_ARTISTICTEXTSHAPE "")
calligra_define_product(PLUGIN_DOCKERS "")
calligra_define_product(PLUGIN_TEXTEDITING "")
126
calligra_define_product(PLUGIN_KEXI_SPREADSHEETMIGRATION ""  NEEDS KEXI SHEETS_PART)
127 128 129
calligra_define_product(PLUGIN_DEFAULTTOOLS "")
calligra_define_product(PLUGIN_PATHSHAPES "")
calligra_define_product(PLUGIN_VARIABLES "")
130
calligra_define_product(PLUGIN_CHARTSHAPE "" NEEDS LIB_KDCHART)
131 132 133 134
calligra_define_product(PLUGIN_PICTURESHAPE "")
calligra_define_product(PLUGIN_TEXTSHAPE "")
calligra_define_product(PLUGIN_PLUGINSHAPE "")
calligra_define_product(PLUGIN_FORMULASHAPE "")
Gopalakrishna Bhat A's avatar
Gopalakrishna Bhat A committed
135
calligra_define_product(PLUGIN_VIDEOSHAPE "Plugin for handling videos in Calligra")
136
calligra_define_product(PLUGIN_VECTORSHAPE "" NEEDS LIB_VECTORIMAGE)
137
calligra_define_product(PLUGIN_REPORTING ""  NEEDS LIB_KOREPORT LIB_KDCHART)
138 139 140 141 142 143
# staging plugins
calligra_define_product(PLUGIN_GOOGLEDOCS "")
calligra_define_product(PLUGIN_THREEDSHAPE "")
calligra_define_product(PLUGIN_SHEETS_PIVOTTABLES ""  NEEDS SHEETS_PART)
calligra_define_product(PLUGIN_STAGING "All plugins in staging status"  NEEDS PLUGIN_GOOGLEDOCS PLUGIN_THREEDSHAPE PLUGIN_SHEETS_PIVOTTABLES)
# developer utils
144
calligra_define_product(DEVTOOLS "Tools for developers")
145
calligra_define_product(CSTESTER "" NEEDS SHEETS_PART STAGE_PART WORDS_PART)
146 147

calligra_set_productset(${PRODUCTSET})
148

149 150 151 152 153
 ########################
#########################
## Look for KDE and Qt ##
#########################
########################
154 155
set(KDE_MIN_VERSION "4.3.0")
find_package(KDE4 4.3.0 REQUIRED)
Cyrille Berger's avatar
Cyrille Berger committed
156

157
if (QT3SUPPORT)
158
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus QtOpenGL Qt3Support)
159
else (QT3SUPPORT)
160
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus QtOpenGL)
161
endif (QT3SUPPORT)
162

163 164
include (KDE4Defaults)
include (MacroLibrary)
165 166 167
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

168 169
if ((${QTVERSION} VERSION_EQUAL 4.8.0) OR (${QTVERSION} VERSION_EQUAL 4.8.1))
    if (NOT IHAVEPATCHEDQT)
170 171
        set(SHOULD_BUILD_WORDS_PART FALSE)
        set(SHOULD_BUILD_STAGE_PART FALSE)
172 173
        set(SHOULD_BUILD_PLUGIN_TEXTSHAPE FALSE)
        set(SHOULD_BUILD_PLUGIN_TEXTEDITING FALSE)
174 175 176 177
        MESSAGE(STATUS "WARNING: You are using a version of Qt that causes crashes. As a result Words and Stage will not be built. Please upgrade to 4.8.2. You can also patch Qt and when building Calligra set IHAVEPATCHEDQT. Patch against Qt can be found in qt48setx.patch")
    endif (NOT IHAVEPATCHEDQT)
endif ((${QTVERSION} VERSION_EQUAL 4.8.0) OR (${QTVERSION} VERSION_EQUAL 4.8.1))

178
if(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
179
    set(GHNS FALSE)
180
endif(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
181

182 183 184 185
macro_optional_find_package(LibAttica)
macro_log_feature(LIBATTICA_FOUND "LibAttica" "Attica is used for Get Hot New Stuff." "https://projects.kde.org/projects/kdesupport/attica" FALSE "" "You need at least version 3.0 for uploading of resources to work.")

if (NOT LIBATTICA_FOUND)
186
    set(GHNS FALSE)
187
endif (NOT LIBATTICA_FOUND)
188

189 190 191
if(NOT ${KDE_VERSION} VERSION_GREATER 4.6.4)
  set(NEPOMUK FALSE)
endif(NOT ${KDE_VERSION} VERSION_GREATER 4.6.4)
192

193 194
macro_ensure_out_of_source_build("Compiling Calligra inside the source directory is not possible. Please refer to the build instruction http://community.kde.org/Calligra/Building/Building_Calligra")

195 196 197 198 199
if(KDE4_BUILD_TESTS)
    # only with this definition will the FOO_TEST_EXPORT macro do something
    add_definitions(-DCOMPILING_TESTS)
endif(KDE4_BUILD_TESTS)

200 201 202 203 204
 ###########################
############################
## Required dependencies  ##
############################
###########################
205

Laurent Montel's avatar
Laurent Montel committed
206 207
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
208
find_package(PNG REQUIRED)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
209 210 211 212
if (APPLE)
    # this is not added correctly on OSX -- see http://forum.kde.org/viewtopic.php?f=139&t=101867&p=221242#p221242
    include_directories(${PNG_INCLUDE_DIR})
endif(APPLE)
213 214
find_package(Boost REQUIRED) # for pigment and stage
if (NOT Boost_FOUND)
215
    MESSAGE(FATAL_ERROR "Did not find Boost. Boost is required for the core libraries, stage, sheets and krita.")
216
endif (NOT Boost_FOUND)
217

218 219 220
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
221

222 223 224 225 226 227
 ###########################
############################
## Optional dependencies  ##
############################
###########################

228 229 230 231
##
## Test for sqlite
##
set(SQLITE_MIN_VERSION 3.6.16)
232
set(SQLITE_RECOMMENDED_VERSION 3.7.15)
233
set(SQLITE_LOAD_EXTENSION_REQUIRED ON)
234 235
macro_optional_find_package(CalligraSqlite 3.6.16)
macro_bool_to_01(SQLITE_FOUND HAVE_SQLITE)
236 237
macro_log_feature(SQLITE_FOUND "SQLite" "Embedded SQL database engine with enabled extensions loading"
                    "http://www.sqlite.org" FALSE "${SQLITE_MIN_VERSION}"
238
		    "Required by Calligra's default database handler for Kexi and bibliography in Words.")
239

240 241 242
##
## Test for ICU
##
243 244
macro_optional_find_package(ICU)
macro_bool_to_01(ICU_FOUND HAVE_ICU)
245 246
macro_log_feature(ICU_FOUND "ICU" "International Components for Unicode (ICU) Library"
                    "http://icu-project.org" FALSE ""
247
		    "Required by Calligra's default database handler for Kexi and Words.")
248

249
##
250
## Check for OpenEXR 
251
##
252

253 254
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
255

256 257 258
##
## Look for OpenGL
##
259
set(HAVE_OPENGL 0)
260
macro_optional_find_package(OpenGL)
261 262 263 264 265 266 267 268 269 270 271 272 273 274

if(OPENGL_FOUND)
    message(STATUS "Found OpenGL: ${OPENGL_LIBRARIES}")
    if(QT_QTOPENGL_FOUND)
        message(STATUS "Found Qt OpenGL support")
        set(HAVE_OPENGL 1)
    else(QT_QTOPENGL_FOUND)
        message(STATUS "Did NOT find Qt OpenGL support. Check your Qt configuration")
    endif(QT_QTOPENGL_FOUND)
else(OPENGL_FOUND)
    message(STATUS "Did NOT find OpenGL libraries")
endif(OPENGL_FOUND)

macro_log_feature(HAVE_OPENGL "OpenGL" "OpenGL support" "" FALSE "" "Required by parts of Krita and optionally by flake")
275

276 277 278
##
## Test for kdepimlibs
##
279
macro_optional_find_package(KdepimLibs)
280
macro_log_feature(KDEPIMLIBS_FOUND "KDE PIMLibs" "KDE Personal Information Management Libraries" "http://www.kde.org/" FALSE "" "Required by Plan and the KDE address book integration (available as a module in KDE)")
281

282

283 284 285 286
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
287
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0" "Required by Calligra Sheets and Krita")
288

289 290 291
##
## Test for QCA2
##
292
macro_optional_find_package(QCA2)
293
macro_log_feature(QCA2_FOUND "QCA" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0" "Required for encrypted OpenDocument files and encrypted xls files support (available as a module in kdesupport)")
294

295 296 297
##
## Test for exiv2
##
298 299 300
set(EXIV2_MIN_VERSION "0.16")
macro_optional_find_package(Exiv2)
macro_log_feature(EXIV2_FOUND "Exiv2" "Image metadata library and tools" "http://www.exiv2.org" FALSE "0.16" "Required by Krita")
301

302 303 304 305 306 307 308 309 310 311 312
##
## Test for soprano
##
macro_optional_find_package(Soprano)
macro_log_feature(Soprano_FOUND "Soprano" "KDE4 RDF handling library" "http://soprano.sourceforge.net/" FALSE "" "Required to handle RDF metadata in ODF")
if(NOT Soprano_FOUND)
    set(SHOULD_BUILD_RDF FALSE)
    set(SOPRANO_INCLUDE_DIR "")
else(NOT Soprano_FOUND)
    set(SHOULD_BUILD_RDF TRUE)
   add_definitions( -DSHOULD_BUILD_RDF )
313
endif(NOT Soprano_FOUND)
314 315


316 317 318 319
##
## Test for marble
##
macro_optional_find_package(Marble)
320
macro_log_feature(MARBLE_FOUND "Marble" "KDE4 World Globe Widget library" "http://techbase.kde.org/Projects/Marble/" FALSE "" "Required by RDF, Kexi Forms and Reports to show locations on a map")
321 322 323 324 325
if(NOT MARBLE_FOUND)
    set(CAN_USE_MARBLE FALSE)
    set(MARBLE_INCLUDE_DIR "")
else(NOT MARBLE_FOUND)
    set(CAN_USE_MARBLE TRUE)
Christoph Feck's avatar
Christoph Feck committed
326
endif(NOT MARBLE_FOUND)
327
if( MARBLE_FOUND )
328 329 330 331 332
    add_definitions( -DCAN_USE_MARBLE )
    ##
    ## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
    ## with commit ea177ca. This is for compatibility with older versions.
    ##
333
    find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble)
334
    if( MARBLECONTROLBOX_H )
335 336
    file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
    string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
337 338 339
        if( SETMARBLEWIDGET )
            add_definitions(-DHAVE_SETMARBLEWIDGET)
        endif( SETMARBLEWIDGET)
340 341
    else( MARBLECONTROLBOX_H )
        message( WARNING "MarbleControlBox.h not found, could not properly set the SETMARBLEWIDGET define." )
342
    endif( MARBLECONTROLBOX_H )
343 344
endif( MARBLE_FOUND )

345 346
##
## Test for lcms
347
##
348
macro_optional_find_package(LCMS2)
349
macro_log_feature(LCMS2_FOUND "LittleCMS" "Color management engine" "http://www.littlecms.com" FALSE "2.4" "Will be used for color management and is necesary for Krita")
350
if(LCMS2_FOUND)
351
    if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
352
        set(HAVE_LCMS24 TRUE)
353
    endif(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
354
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
355
    set(HAVE_LCMS2 TRUE)
356 357
endif(LCMS2_FOUND)

358 359 360 361 362 363
##
## Test for Vc
##

set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} )
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
364
macro_optional_find_package(Vc 0.6.70)
365 366
macro_log_feature(Vc_FOUND "Vc" "Portable, zero-overhead SIMD library for C++" "http://code.compeng.uni-frankfurt.de/projects/vc" FALSE "" "Required by the Krita for vectorization")
macro_bool_to_01(Vc_FOUND HAVE_VC)
367 368
macro_bool_to_01(PACKAGERS_BUILD DO_PACKAGERS_BUILD)

369 370 371 372 373 374
configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h )

if(HAVE_VC)
    message(STATUS "Vc found!")

    SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Vc_CMAKE_MODULES_DIR}")
375 376
    include (VcMacros)

377
    macro(ko_compile_for_all_implementations_no_scalar _objs _src)
378
      if(PACKAGERS_BUILD)
379
        vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY SSE2 SSSE3 SSE4_1 AVX)
380 381 382 383
      else(PACKAGERS_BUILD)
        set(${_objs} ${_src})
      endif(PACKAGERS_BUILD)
    endmacro()
384

385
    macro(ko_compile_for_all_implementations _objs _src)
386
      if(PACKAGERS_BUILD)
387
        vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY Scalar SSE2 SSSE3 SSE4_1 AVX)
388 389 390 391 392
      else(PACKAGERS_BUILD)
        set(${_objs} ${_src})
      endif(PACKAGERS_BUILD)
    endmacro()

393 394 395 396
    if (NOT PACKAGERS_BUILD)
      # Optimize the whole Calligra for current architecture
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}")
    endif (NOT PACKAGERS_BUILD)
397 398 399
endif(HAVE_VC)
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH} )

400 401 402 403 404
##
## Test for Nepomuk
##
if(NEPOMUK)
    macro_optional_find_package(Nepomuk)
405 406 407
    if(NOT NEPOMUK_FOUND)
        set(NEPOMUK FALSE)
    endif(NOT NEPOMUK_FOUND)
408
    add_definitions(-DDISABLE_NEPOMUK_LEGACY)
Srikanth Tiyyagura's avatar
Srikanth Tiyyagura committed
409
    macro_log_feature(NEPOMUK_FOUND "Nepomuk" "Handles metadata of resources" FALSE  "Required to handle metadata of resources")
410 411
endif(NEPOMUK)

412 413 414
##
## Test for KActivities
##
415
macro_optional_find_package(KActivities 6.1.0)
416 417 418 419 420
macro_log_feature(KActivities_FOUND "KActivities" "Activities interface library" "https://projects.kde.org/projects/kde/kdelibs/kactivities" FALSE "" "Required for Activities integration.")
if(KActivities_FOUND)
    set(HAVE_KACTIVITIES TRUE)
endif(KActivities_FOUND)

Thomas Zander's avatar
Thomas Zander committed
421 422
#Set the build of TextShape changetraker

David Faure's avatar
David Faure committed
423
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
Laurent Montel's avatar
Laurent Montel committed
424

425
if(WIN32)
426 427 428 429 430 431 432 433 434 435 436 437 438 439
    # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
    execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
    file(TO_CMAKE_PATH "${_dir}" __dir)
    find_path(KDE4_ICON_DIR oxygen PATHS
        ${__dir}
    )
    message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")

    set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR}
                        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
                        LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS}
                        ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} )


440 441 442 443
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Hanzes Matus's avatar
Hanzes Matus committed
444 445 446
##
## Test for Fontconfig
##
447 448 449 450 451
## Only test if on non-Windows system
if(!WIN32)
    macro_optional_find_package(Fontconfig)
    macro_log_feature(FONTCONFIG_FOUND "Fontconfig" "Library for configuring and customizing font access" "http://fontconfig.org" FALSE "" "Required to handle exact font size")
endif(!WIN32)
Hanzes Matus's avatar
Hanzes Matus committed
452 453 454 455

##
## Test for Freetype
##
456 457 458 459 460
## Only test if on non-Windows system
if(!WIN32)
    macro_optional_find_package(Freetype)
    macro_log_feature(FREETYPE_FOUND "Freetype" "A Free, High-Quality, and Portable Font Engine" "http://www.freetype.org/" FALSE "" "Required to handle exact font size")
endif(!WIN32)
Hanzes Matus's avatar
Hanzes Matus committed
461

462
if(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
Hanzes Matus's avatar
Hanzes Matus committed
463 464 465
    set(FONTCONFIG_INCLUDE_DIR "")
    set(FREETYPE_INCLUDE_DIRS "")
else(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
466
    add_definitions( -DSHOULD_BUILD_FONT_CONVERSION )
Hanzes Matus's avatar
Hanzes Matus committed
467
endif(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
468

Cyrille Berger's avatar
Cyrille Berger committed
469 470 471
##
## Test for Qt Webkit
##
472 473 474 475
macro_log_feature(QT_QTWEBKIT_FOUND "Qt Webkit" "Qt binding for Webkit, the HTML engine." "http://qt.nokia.com" FALSE "" "Required for the web shape, web Kexi widget and web report element")
if(QT_QTWEBKIT_FOUND)
    add_definitions( -DCAN_USE_QTWEBKIT )
endif(QT_QTWEBKIT_FOUND)
Cyrille Berger's avatar
Cyrille Berger committed
476

477 478 479
##
## QImageBlitz (for Kexi)
##
480 481
#macro_optional_find_package(QImageBlitz)
#macro_log_feature(QIMAGEBLITZ_FOUND "QImageBlitz" "Fast, smooth scaling of QImages" "sourceforge.net/projects/qimageblitz/" FALSE "" "Required for Kexi")
482

483 484 485 486 487
##
## Test for KDeclarative
##
macro_optional_find_package(KDeclarative)

488 489 490
##
## Test endianess
##
David Faure's avatar
David Faure committed
491
include (TestBigEndian)
492 493
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)

494 495 496 497 498 499
##
## Test SharedMimeInfo
##
macro_optional_find_package(SharedMimeInfo)
macro_log_feature(SHARED_MIME_INFO_FOUND "SharedMimeInfo" "Shared Mime Info" "http://freedesktop.org/wiki/Software/shared-mime-info" FALSE "" "Required to determine file types OpenRaster (Krita default format), SVM or all of MSOOXML.")

500 501 502 503 504
##
## Test for Okular
##
macro_optional_find_package(Okular)
macro_log_feature(OKULAR_FOUND "Okular" "Okular ODP Plugin" "http://okular.kde.org/" FALSE "" "Required to build the Okular OpenDocument Presenter plugin")
505

506 507 508 509
##
## Generate a file for prefix information
##

510 511 512 513 514
 ###############################
################################
## Add Calligra helper macros ##
################################
###############################
Cyrille Berger's avatar
Cyrille Berger committed
515

Boudewijn Rempt's avatar
Boudewijn Rempt committed
516
include(MacroCalligraAddBenchmark)
517
include(MacroCalligraBuildTest)
Cyrille Berger's avatar
Cyrille Berger committed
518

519 520 521 522 523 524
 ####################
#####################
## Define includes ##
#####################
####################

525 526 527
# WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before
#          any other include directory

528
# for config.h and <toplevel/foo.h> includes (if any?)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
529
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces )
530

531 532 533
# koplugin is at the bottom of the stack
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)

534
# koodf is at the bottom of the stack
535 536
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
                   ${CMAKE_BINARY_DIR}/libs/odf
537
                   ${KDE4_INCLUDES})
Boudewijn Rempt's avatar
Boudewijn Rempt committed
538

539 540
set(KUNDO2_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kundo2)

541
# pigment depends on koplugin and lcms
542
set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
543 544
                   ${CMAKE_SOURCE_DIR}/libs/pigment
                   ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
545
                   ${CMAKE_SOURCE_DIR}/libs/pigment/resources
546
                   ${QT_INCLUDES}
547
                   ${KDE4_INCLUDES})
548

549 550 551 552 553
# flake depends on koodf and pigment
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake
                   ${KOODF_INCLUDES}
                   ${KOPLUGIN_INCLUDES}
                   ${PIGMENT_INCLUDES}
554
                   ${KUNDO2_INCLUDES}
555
                   ${CMAKE_SOURCE_DIR}/libs/widgetutils
556 557
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools
558
                   ${CMAKE_SOURCE_DIR}/libs/flake/svg
559
                   ${CMAKE_BINARY_DIR}/libs/flake)
560

561 562 563 564 565 566 567
# vectorimage
set(VECTORIMAGE_INCLUDES 
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libemf
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libsvm
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libwmf)
                   
568 569 570 571 572 573
# KoText depends on koplugin, odf
set(KOTEXT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kotext
                   ${CMAKE_BINARY_DIR}/libs/kotext
                   ${CMAKE_SOURCE_DIR}/libs/kotext/changetracker
                   ${CMAKE_SOURCE_DIR}/libs/kotext/styles
                   ${CMAKE_SOURCE_DIR}/libs/kotext/opendocument
574
                   ${SOPRANO_INCLUDE_DIR}
575
                   ${FLAKE_INCLUDES}
576 577
                   ${KOODF_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/main)
578

579 580 581 582
# TextLayout depends on kotext
set(TEXTLAYOUT_INCLUDES ${KOTEXT_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/textlayout)

C. Boemann's avatar
C. Boemann committed
583 584 585 586 587
# BasicFlakes depends on flake, widgets
set(BASICFLAKES_INCLUDES ${KOWIDGETS_INCLUDES} ${FLAKE_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/basicflakes
                   ${CMAKE_SOURCE_DIR}/libs/basicflakes/tools)

588
# komain depends on kotext & flake
589
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
590
                    ${TEXTLAYOUT_INCLUDES}
591
                    ${CMAKE_SOURCE_DIR}/libs/widgets
592
                    ${CMAKE_SOURCE_DIR}/libs/widgetutils
593
                    ${CMAKE_SOURCE_DIR}/libs/main
594
                    ${CMAKE_SOURCE_DIR}/libs/main/config)
595

596 597 598 599
set(KORDF_INCLUDES ${KOMAIN_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/rdf
)

600 601 602
if(SHOULD_BUILD_SCRIPTING)
  set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
endif(SHOULD_BUILD_SCRIPTING)
603

David Faure's avatar
David Faure committed
604
# kopageapp
605 606 607 608 609
set(KOPAGEAPP_INCLUDES ${TEXTLAYOUT_INCLUDES}
                    ${PIGMENT_INCLUDES}
                    ${KOMAIN_INCLUDES}
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
610

611 612 613 614
# koproperty
set(KOPROPERTY_INCLUDES ${KOODF_INCLUDES}
                        ${CMAKE_SOURCE_DIR}/libs
                        ${CMAKE_SOURCE_DIR}/libs/widgets)
615
set(KOPROPERTY_LIBS koproperty)
616

617 618 619 620 621 622 623 624 625
# koreport
set(KOREPORT_INCLUDES
    ${CMAKE_SOURCE_DIR}/libs/
    ${CMAKE_SOURCE_DIR}/libs/koreport
    ${CMAKE_SOURCE_DIR}/libs/koreport/common
    ${CMAKE_SOURCE_DIR}/libs/koreport/renderer
    ${CMAKE_SOURCE_DIR}/libs/koreport/wrtembed)
set(KOREPORT_LIBS koreport)

626
# calligradb
627
# TODO: remove when Predicate lib arrives
628
if (HAVE_ICU AND HAVE_SQLITE) # These are hard deps for calligradb
629 630 631
   set(CALLIGRADB_LIBS calligradb)                    # TODO remove when Predicate lib arrives
   set(CALLIGRADB_INCLUDES ${CMAKE_SOURCE_DIR}/libs   # TODO remove when Predicate lib arrives
                           ${CMAKE_BINARY_DIR}/libs/db)
632
else (HAVE_ICU AND HAVE_SQLITE)
633
   set(SHOULD_BUILD_LIB_CALLIGRADB FALSE)
634
endif (HAVE_ICU AND HAVE_SQLITE)
635

636 637 638
#############################################
####          3rd party libraries        ####
#############################################
639

640 641 642
set(KDGANTT_INCLUDES
    ${CMAKE_SOURCE_DIR}/3rdparty/kdgantt
)
643

644 645 646
set(KDCHART_INCLUDES
    ${CMAKE_SOURCE_DIR}/3rdparty/kdchart/include
)
647

648 649 650 651 652
 #########################################
##########################################
## Detect which products can be compile ##
##########################################
#########################################
653

654
#
Yuri Chornoivan's avatar
Yuri Chornoivan committed
655
# WARNING: when adding a dependency if there is already a line
656 657 658 659
# containing SHOULD_BUILD_app, don't add a new one, just add
# the test to the if construct
#

660

661
### Calligra Sheets: eigen2, boost
662
if(NOT EIGEN2_FOUND)
663
    set(SHOULD_BUILD_SHEETS_PART FALSE)
664
endif(NOT EIGEN2_FOUND)
665

666 667
### Krita: pigment, eigen2, exiv2, sharedmimeinfo
if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION OR NOT SHARED_MIME_INFO_FOUND)
668
   set(SHOULD_BUILD_KRITA FALSE)
669
endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION OR NOT SHARED_MIME_INFO_FOUND)
670

671

672
### Active: only build with Qt 4.7.0 or better
673
if (NOT ${QTVERSION} VERSION_GREATER 4.7.0)
674
    set(SHOULD_BUILD_ACTIVE FALSE)
675 676
endif (NOT ${QTVERSION} VERSION_GREATER 4.7.0)

677
if (NOT QT_QTDECLARATIVE_FOUND OR NOT KDECLARATIVE_FOUND)
678
    set(SHOULD_BUILD_ACTIVE FALSE)
679
endif(NOT QT_QTDECLARATIVE_FOUND OR NOT KDECLARATIVE_FOUND)
680

681 682 683
#if(NOT QIMAGEBLITZ_FOUND)
#    set (SHOULD_BUILD_KEXI FALSE)
#endif(NOT QIMAGEBLITZ_FOUND)
684

685 686 687 688
if (NOT QT3SUPPORT)
    set (SHOULD_BUILD_KEXI FALSE)
endif (NOT QT3SUPPORT)

689 690 691
if(NOT OKULAR_FOUND)
    set(SHOULD_BUILD_OKULARODPGENERATOR FALSE)
endif(NOT OKULAR_FOUND)
692

693 694
# finally disable all those which are missing internal dependencies
calligra_drop_unbuildable_products()
Jarosław Staniek's avatar
Jarosław Staniek committed
695

696 697 698 699 700 701
 ###################
####################
## Subdirectories ##
####################
###################

702
add_subdirectory(words)
703

704
if (SHOULD_BUILD_FLOW)
705
    add_subdirectory(flow)
706
endif (SHOULD_BUILD_FLOW)
707

708
add_subdirectory(stage)
709 710

if(SHOULD_BUILD_KEXI)
711
    add_subdirectory(kexi)
712 713
endif(SHOULD_BUILD_KEXI)

714
if(SHOULD_BUILD_PLAN)
715
    add_subdirectory(plan)
716
endif(SHOULD_BUILD_PLAN)
717

718
add_subdirectory(sheets)
719 720

if(SHOULD_BUILD_KRITA)
721
  add_subdirectory(krita)
722 723 724
endif(SHOULD_BUILD_KRITA)

if(SHOULD_BUILD_KARBON)
725
  add_subdirectory(karbon)
726 727
endif(SHOULD_BUILD_KARBON)

728
if(SHOULD_BUILD_BRAINDUMP)
729
  add_subdirectory(braindump)
730 731
endif(SHOULD_BUILD_BRAINDUMP)

732
if(SHOULD_BUILD_ACTIVE)
733
  add_subdirectory(active)
734 735
endif(SHOULD_BUILD_ACTIVE)

736 737 738
if(SHOULD_BUILD_DOC)
	add_subdirectory(doc)
endif(SHOULD_BUILD_DOC)
739

740 741
# non-app directories are moved here because they can depend on SHOULD_BUILD_{appname} variables set above
add_subdirectory(libs)
742
add_subdirectory(3rdparty)
743 744
add_subdirectory(interfaces)
add_subdirectory(cmake)
Laurent Montel's avatar
Laurent Montel committed
745
add_subdirectory(pics)
746
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
747 748
add_subdirectory(servicetypes)
add_subdirectory(templates)
749 750
add_subdirectory(devtools)
add_subdirectory(extras)
751
add_subdirectory(filters)
752
add_subdirectory(data)
Laurent Montel's avatar
Laurent Montel committed
753

754
macro_display_feature_log()
755

756
calligra_log_should_build()
757

758
add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
759 760 761

configure_file(KoConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h )
install( FILES  ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
762 763 764 765 766 767

## temporary warning
if (WARN_ABOUT_CREATIVEONLY)
    message(STATUS "WARNING:\n   You are using a deprecated build flag,\n   switch from \"-DCREATIVEONLY=ON\" to \"-DPRODUCTSET=CREATIVE\"\n   and remove the line \"CREATIVEONLY:BOOL=ON\" from CMakeCache.txt")
    message(STATUS "--------------------------------------------------------------------------" )
endif (WARN_ABOUT_CREATIVEONLY)