CMakeLists.txt 22.9 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 "11.0.0")
set(GENERIC_CALLIGRA_LIB_SOVERSION "11")
28

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

31 32 33 34 35
#
# 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)
#
36 37
#eg:
#option(BUILD_kexi "Build directory kexi" OFF) # kexi isn't buildable at the moment
38

39
option(GHNS "support Get Hot New Stuff" ON)
40
option(NEPOMUK "support NEPOMUK Tagging" ON)
41 42
option(TINY "compile a tiny Calligra" OFF)
option(CREATIVEONLY "compile only Karbon and Krita" OFF)
43
option(QT3SUPPORT "Build the parts of Calligra that still depend on Qt3" ON)
44 45

IF (TINY)
C. Boemann's avatar
C. Boemann committed
46
    set(SHOULD_BUILD_WORDS TRUE)
47
    set(SHOULD_BUILD_STAGE TRUE)
48
    set(SHOULD_BUILD_SHEETS TRUE)
49 50 51
    set(SHOULD_BUILD_KARBON FALSE)
    set(SHOULD_BUILD_KRITA FALSE)
    set(SHOULD_BUILD_KEXI FALSE)
52
    set(SHOULD_BUILD_FLOW FALSE)
53
    set(SHOULD_BUILD_PLAN FALSE)
54
    set(SHOULD_BUILD_KDGANTT FALSE)
55
    set(SHOULD_BUILD_SCRIPTING FALSE)
56
    set(SHOULD_BUILD_KOREPORT FALSE)
57
    set(SHOULD_BUILD_BRAINDUMP FALSE)
58
    set(SHOULD_BUILD_CALLIGRA FALSE)
59
    set(SHOULD_BUILD_CSTESTER FALSE)
60
    set(SHOULD_BUILD_KOABSTRACTION TRUE)
61
    set(SHOULD_BUILD_ACTIVE TRUE)
62 63
ELSEIF (CREATIVEONLY)
    set(SHOULD_BUILD_WORDS FALSE)
64
    set(SHOULD_BUILD_STAGE FALSE)
65
    set(SHOULD_BUILD_SHEETS FALSE)
66 67 68 69
    set(SHOULD_BUILD_KARBON TRUE)
    set(SHOULD_BUILD_KRITA TRUE)
    set(SHOULD_BUILD_KEXI FALSE)
    set(SHOULD_BUILD_FLOW FALSE)
70
    set(SHOULD_BUILD_PLAN FALSE)
71
    set(SHOULD_BUILD_KDGANTT FALSE)
72
    set(SHOULD_BUILD_SCRIPTING FALSE)
73 74 75 76 77
    set(SHOULD_BUILD_KOREPORT FALSE)
    set(SHOULD_BUILD_BRAINDUMP FALSE)
    set(SHOULD_BUILD_CALLIGRA FALSE)
    set(SHOULD_BUILD_CSTESTER FALSE)
    set(SHOULD_BUILD_KOABSTRACTION FALSE)
78
    set(SHOULD_BUILD_ACTIVE FALSE)
79
ELSE()
Dimitrios T. Tanis's avatar
Dimitrios T. Tanis committed
80 81
    set(SHOULD_BUILD_WORDS TRUE)
    set(SHOULD_BUILD_STAGE TRUE)
82
    set(SHOULD_BUILD_SHEETS TRUE)
Dimitrios T. Tanis's avatar
Dimitrios T. Tanis committed
83 84
    set(SHOULD_BUILD_KARBON TRUE)
    set(SHOULD_BUILD_KRITA TRUE)
85
    set(SHOULD_BUILD_KEXI TRUE)
Dimitrios T. Tanis's avatar
Dimitrios T. Tanis committed
86 87 88 89
    set(SHOULD_BUILD_FLOW TRUE)
    set(SHOULD_BUILD_PLAN TRUE)
    set(SHOULD_BUILD_KDGANTT TRUE)
    set(SHOULD_BUILD_SCRIPTING TRUE)
90
    set(SHOULD_BUILD_KOREPORT TRUE)
Dimitrios T. Tanis's avatar
Dimitrios T. Tanis committed
91
    set(SHOULD_BUILD_BRAINDUMP TRUE)
92
    set(SHOULD_BUILD_CALLIGRA TRUE)
Dimitrios T. Tanis's avatar
Dimitrios T. Tanis committed
93 94
    set(SHOULD_BUILD_CSTESTER TRUE)
    set(SHOULD_BUILD_KOABSTRACTION TRUE)
95
    set(SHOULD_BUILD_ACTIVE FALSE)
96
ENDIF()
97

98 99 100 101 102 103 104 105 106 107
if(KDE4_BUILD_TESTS)
    # only with this definition will the FOO_TEST_EXPORT macro do something
    add_definitions(-DCOMPILING_TESTS)
endif(KDE4_BUILD_TESTS)

 ########################
#########################
## Look for KDE and Qt ##
#########################
########################
Cyrille Berger's avatar
Cyrille Berger committed
108
set(KDE_MIN_VERSION "4.3.0")
109
find_package(KDE4 4.3.0 REQUIRED)
Cyrille Berger's avatar
Cyrille Berger committed
110

111 112 113 114 115
if (QT3SUPPORT)
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus QtOpenGL Qt3Support)
else (QT3SUPPORT)
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus QtOpenGL)
endif (QT3SUPPORT)
116

117 118
include (KDE4Defaults)
include (MacroLibrary)
119 120 121
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

122 123 124 125 126 127 128 129 130 131
set(SHOULD_BUILD_TEXTSHAPE TRUE)
if ((${QTVERSION} VERSION_EQUAL 4.8.0) OR (${QTVERSION} VERSION_EQUAL 4.8.1))
    if (NOT IHAVEPATCHEDQT)
        set(SHOULD_BUILD_WORDS FALSE)
        set(SHOULD_BUILD_STAGE FALSE)
        set(SHOULD_BUILD_TEXTSHAPE FALSE)
        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))

132
if(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
133
    set(GHNS FALSE)
134
endif(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
135

136 137 138 139
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)
140
    set(GHNS FALSE)
141
endif (NOT LIBATTICA_FOUND)
142

143 144 145
if(NOT ${KDE_VERSION} VERSION_GREATER 4.6.4)
  set(NEPOMUK FALSE)
endif(NOT ${KDE_VERSION} VERSION_GREATER 4.6.4)
146

147 148
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")

149 150 151 152 153
 ###########################
############################
## Required dependencies  ##
############################
###########################
154

Laurent Montel's avatar
Laurent Montel committed
155 156
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
157
find_package(PNG REQUIRED)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
158 159 160 161
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)
162 163
find_package(Boost REQUIRED) # for pigment and stage
if (NOT Boost_FOUND)
164
    MESSAGE(FATAL_ERROR "Did not find Boost. Boost is required for the core libraries, stage, sheets and krita.")
165
endif (NOT Boost_FOUND)
166

167 168 169
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
170

171 172 173 174 175 176
 ###########################
############################
## Optional dependencies  ##
############################
###########################

177 178 179 180
##
## Test for sqlite
##
set(SQLITE_MIN_VERSION 3.6.16)
181
set(SQLITE_RECOMMENDED_VERSION 3.7.14)
182
set(SQLITE_LOAD_EXTENSION_REQUIRED ON)
183 184
macro_optional_find_package(CalligraSqlite 3.6.16)
macro_bool_to_01(SQLITE_FOUND HAVE_SQLITE)
185 186
macro_log_feature(SQLITE_FOUND "SQLite" "Embedded SQL database engine with enabled extensions loading"
                    "http://www.sqlite.org" FALSE "${SQLITE_MIN_VERSION}"
187 188
		    "Required by Calligra's default database handler for Kexi and Words.")

189 190 191
##
## Test for ICU
##
192 193
macro_optional_find_package(ICU)
macro_bool_to_01(ICU_FOUND HAVE_ICU)
194 195
macro_log_feature(ICU_FOUND "ICU" "International Components for Unicode (ICU) Library"
                    "http://icu-project.org" FALSE ""
196
		    "Required by Calligra's default database handler for Kexi and Words.")
197

198
##
199
## Check for OpenEXR
200
##
201

202 203
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
204

205 206 207
##
## Look for OpenGL
##
208
set(HAVE_OPENGL 0)
209 210
if (NOT WIN32)
macro_optional_find_package(OpenGL)
211 212 213 214 215 216 217 218 219 220 221 222 223 224

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")
225
endif (NOT WIN32)
226

227 228 229
##
## Test for kdepimlibs
##
230
macro_optional_find_package(KdepimLibs)
231
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)")
232

233

234 235 236 237
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
238
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")
239

240 241 242
##
## Test for QCA2
##
243
macro_optional_find_package(QCA2)
244
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)")
245

246 247 248
##
## Test for exiv2
##
249 250 251
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")
252

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
##
## 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)
endif(NOT Soprano_FOUND)
if( Soprano_FOUND )
   add_definitions( -DSHOULD_BUILD_RDF )
endif( Soprano_FOUND )


269 270 271 272
##
## Test for marble
##
macro_optional_find_package(Marble)
273
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")
274 275 276 277 278
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
279
endif(NOT MARBLE_FOUND)
280
if( MARBLE_FOUND )
281 282 283 284 285 286 287
    add_definitions( -DCAN_USE_MARBLE )
    ##
    ## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
    ## with commit ea177ca. This is for compatibility with older versions.
    ##
    find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR})
    if( MARBLECONTROLBOX_H )
288 289
    file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
    string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
290 291 292 293
        if( SETMARBLEWIDGET )
            add_definitions(-DHAVE_SETMARBLEWIDGET)
        endif( SETMARBLEWIDGET)
    endif( MARBLECONTROLBOX_H )
294 295
endif( MARBLE_FOUND )

296 297
##
## Test for lcms
298
##
299
macro_optional_find_package(LCMS2)
300
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")
301
if(LCMS2_FOUND)
302
    if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
303
        set(HAVE_LCMS24 TRUE)
304
    endif(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
305
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
306
    set(HAVE_LCMS2 TRUE)
307 308
endif(LCMS2_FOUND)

309 310 311 312 313
##
## Test for Nepomuk
##
if(NEPOMUK)
    macro_optional_find_package(Nepomuk)
314 315 316
    if(NOT NEPOMUK_FOUND)
        set(NEPOMUK FALSE)
    endif(NOT NEPOMUK_FOUND)
317
    add_definitions(-DDISABLE_NEPOMUK_LEGACY)
Srikanth Tiyyagura's avatar
Srikanth Tiyyagura committed
318
    macro_log_feature(NEPOMUK_FOUND "Nepomuk" "Handles metadata of resources" FALSE  "Required to handle metadata of resources")
319 320
endif(NEPOMUK)

321 322 323
##
## Test for KActivities
##
324
macro_optional_find_package(KActivities 6.1.0)
325 326 327 328 329
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
330 331
#Set the build of TextShape changetraker

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

334
if(WIN32)
335 336 337 338 339 340 341 342 343 344 345 346 347 348
    # 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} )


349 350 351 352
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Hanzes Matus's avatar
Hanzes Matus committed
353 354 355
##
## Test for Fontconfig
##
356 357 358 359 360
## 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
361 362 363 364

##
## Test for Freetype
##
365 366 367 368 369
## 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
370

371
if(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
Hanzes Matus's avatar
Hanzes Matus committed
372 373 374
    set(FONTCONFIG_INCLUDE_DIR "")
    set(FREETYPE_INCLUDE_DIRS "")
else(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
375
    add_definitions( -DSHOULD_BUILD_FONT_CONVERSION )
Hanzes Matus's avatar
Hanzes Matus committed
376
endif(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
377

Cyrille Berger Skott's avatar
Cyrille Berger Skott committed
378 379 380
##
## Test for Qt Webkit
##
381 382 383 384
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 Skott's avatar
Cyrille Berger Skott committed
385

386 387 388
##
## QImageBlitz (for Kexi)
##
389 390
#macro_optional_find_package(QImageBlitz)
#macro_log_feature(QIMAGEBLITZ_FOUND "QImageBlitz" "Fast, smooth scaling of QImages" "sourceforge.net/projects/qimageblitz/" FALSE "" "Required for Kexi")
391

392 393 394 395 396 397 398 399
##
## Test for KDeclarative
##
macro_optional_find_package(KDeclarative)
if(NOT KDECLARATIVE_FOUND)
    set(SHOULD_BUILD_ACTIVE FALSE)
endif(NOT KDECLARATIVE_FOUND)

400 401 402
##
## Test endianess
##
David Faure's avatar
David Faure committed
403
include (TestBigEndian)
404 405
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)

406 407 408 409
##
## Generate a file for prefix information
##

Cyrille Berger's avatar
Cyrille Berger committed
410 411 412 413 414 415
 #############################
##############################
## Add the benchmark target ##
##############################
#############################

Boudewijn Rempt's avatar
Boudewijn Rempt committed
416
include(MacroCalligraAddBenchmark)
Cyrille Berger's avatar
Cyrille Berger committed
417

418 419 420 421 422 423
 ####################
#####################
## Define includes ##
#####################
####################

424 425 426
# WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before
#          any other include directory

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

430 431 432
# koplugin is at the bottom of the stack
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)

433
# koodf is at the bottom of the stack
434 435
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
                   ${CMAKE_BINARY_DIR}/libs/odf
436
                   ${KDE4_INCLUDES})
Boudewijn Rempt's avatar
Boudewijn Rempt committed
437

438 439
set(KUNDO2_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kundo2)

440
# pigment depends on koplugin and lcms
441
set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
442 443
                   ${CMAKE_SOURCE_DIR}/libs/pigment
                   ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
444
                   ${CMAKE_SOURCE_DIR}/libs/pigment/resources
445
                   ${QT_INCLUDES}
446
                   ${KDE4_INCLUDES})
447

448 449 450 451 452
# flake depends on koodf and pigment
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake
                   ${KOODF_INCLUDES}
                   ${KOPLUGIN_INCLUDES}
                   ${PIGMENT_INCLUDES}
453
                   ${KUNDO2_INCLUDES}
454 455
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools
456
                   ${CMAKE_SOURCE_DIR}/libs/flake/svg
457
                   ${CMAKE_BINARY_DIR}/libs/flake)
458 459 460 461 462 463 464

# 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
465
                   ${SOPRANO_INCLUDE_DIR}
466
                   ${FLAKE_INCLUDES}
467 468
                   ${KOODF_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/main)
469

470 471 472 473
# TextLayout depends on kotext
set(TEXTLAYOUT_INCLUDES ${KOTEXT_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/textlayout)

474
# komain depends on kotext & flake
475
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
476
                    ${TEXTLAYOUT_INCLUDES}
477
                    ${MARBLE_INCLUDE_DIR}
478 479
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/main
480
                    ${CMAKE_SOURCE_DIR}/libs/main/rdf
481
                    ${CMAKE_SOURCE_DIR}/libs/main/config)
482

483 484 485
if(SHOULD_BUILD_SCRIPTING)
  set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
endif(SHOULD_BUILD_SCRIPTING)
486

David Faure's avatar
David Faure committed
487
# kopageapp
488 489 490 491 492
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 )
493

494 495 496
# koproperty
SET(KOPROPERTY_TARGETNAME koproperty)                           # TODO remove when we move to independent place
SET(KOPROPERTY_LIBS ${KOPROPERTY_TARGETNAME})                   # TODO remove when we move to independent place
Boudewijn Rempt's avatar
Boudewijn Rempt committed
497 498
SET(KOPROPERTY_LIB_VERSION ${GENERIC_CALLIGRA_LIB_VERSION})      # TODO remove when we move to independent place
SET(KOPROPERTY_LIB_SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION})  # TODO remove when we move to independent place
499 500 501 502 503
SET(KOPROPERTY_USE_KOLIBS TRUE)                                 # TODO remove when we move to independent place
set(KOPROPERTY_INCLUDES ${KOODF_INCLUDES}
                        ${CMAKE_SOURCE_DIR}/libs
                        ${CMAKE_SOURCE_DIR}/libs/widgets)

504 505
# calligradb
SET(CALLIGRADB_LIBS calligradb)                    # TODO remove when Predicate lib arrives
506 507
set(CALLIGRADB_INCLUDES ${CMAKE_SOURCE_DIR}/libs   # TODO remove when Predicate lib arrives
                        ${CMAKE_BINARY_DIR}/libs/db)
508

509 510 511 512 513
 #############################################
##############################################
## Detect which applications can be compile ##
##############################################
#############################################
514

515 516 517 518 519 520
#
# WARNING: when adding a dependency if there is allready a line
# containing SHOULD_BUILD_app, don't add a new one, just add
# the test to the if construct
#

521

522
### Calligra Sheets: eigen2, boost
523
if(NOT EIGEN2_FOUND)
524
    set(SHOULD_BUILD_SHEETS FALSE)
525
endif(NOT EIGEN2_FOUND)
526

Boudewijn Rempt's avatar
Boudewijn Rempt committed
527
### Krita: pigment, eigen2, exiv2
528
if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
529
   set(SHOULD_BUILD_KRITA FALSE)
530
endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
531

532 533
### Active needs sheets, stage and words
if (NOT SHOULD_BUILD_SHEETS OR NOT SHOULD_BUILD_STAGE OR NOT SHOULD_BUILD_WORDS)
David Faure's avatar
David Faure committed
534
    set(SHOULD_BUILD_ACTIVE FALSE)
535
endif (NOT SHOULD_BUILD_SHEETS OR NOT SHOULD_BUILD_STAGE OR NOT SHOULD_BUILD_WORDS)
536 537


538
### Active: only build with Qt 4.7.0 or better
539
if (NOT ${QTVERSION} VERSION_GREATER 4.7.0)
540
    set(SHOULD_BUILD_ACTIVE FALSE)
541 542
endif (NOT ${QTVERSION} VERSION_GREATER 4.7.0)

543 544 545 546
if (NOT QT_QTDECLARATIVE_FOUND)
    set(SHOULD_BUILD_ACTIVE FALSE)
endif (NOT QT_QTDECLARATIVE_FOUND)

547 548 549 550
if(${KDE_VERSION} VERSION_LESS 4.8.0)
    set(SHOULD_BUILD_ACTIVE FALSE)
endif(${KDE_VERSION} VERSION_LESS 4.8.0)

551 552 553
#if(NOT QIMAGEBLITZ_FOUND)
#    set (SHOULD_BUILD_KEXI FALSE)
#endif(NOT QIMAGEBLITZ_FOUND)
554

555 556 557 558
if (NOT QT3SUPPORT)
    set (SHOULD_BUILD_KEXI FALSE)
endif (NOT QT3SUPPORT)

559 560 561
### HACK ###
# Those BUILD_ are illegally used below before they are defined, which cause problem on a first build
option(BUILD_kexi   "Build directory kexi" ON)
562
option(BUILD_koreport "Build directory libs/koreport" ON)
563 564
### HACK ###

Jarosław Staniek's avatar
Jarosław Staniek committed
565
if(BUILD_kexi AND SHOULD_BUILD_KEXI)
566
###
Jarosław Staniek's avatar
Jarosław Staniek committed
567 568
endif(BUILD_kexi AND SHOULD_BUILD_KEXI)

569 570 571 572 573 574
 ###################
####################
## Subdirectories ##
####################
###################

C. Boemann's avatar
C. Boemann committed
575
if(SHOULD_BUILD_WORDS)
576
   macro_optional_add_subdirectory(words)
C. Boemann's avatar
C. Boemann committed
577
endif(SHOULD_BUILD_WORDS)
578

579 580 581
if (SHOULD_BUILD_FLOW)
    macro_optional_add_subdirectory(flow)
endif (SHOULD_BUILD_FLOW)
582

583
if (SHOULD_BUILD_PLAN)
584
    macro_optional_add_subdirectory(kdgantt)
585
endif (SHOULD_BUILD_PLAN)
586

587
if(SHOULD_BUILD_STAGE)
588
  macro_optional_add_subdirectory(stage)
589
endif(SHOULD_BUILD_STAGE)
590 591 592 593 594

if(SHOULD_BUILD_KEXI)
    macro_optional_add_subdirectory(kexi)
endif(SHOULD_BUILD_KEXI)

595 596 597
if(SHOULD_BUILD_PLAN)
    macro_optional_add_subdirectory(plan)
endif(SHOULD_BUILD_PLAN)
598

599 600 601
if(SHOULD_BUILD_SHEETS)
    macro_optional_add_subdirectory(sheets)
endif(SHOULD_BUILD_SHEETS)
602 603 604 605 606 607 608 609 610

if(SHOULD_BUILD_KRITA)
  macro_optional_add_subdirectory(krita)
endif(SHOULD_BUILD_KRITA)

if(SHOULD_BUILD_KARBON)
  macro_optional_add_subdirectory(karbon)
endif(SHOULD_BUILD_KARBON)

611 612 613 614
if(SHOULD_BUILD_BRAINDUMP)
  macro_optional_add_subdirectory(braindump)
endif(SHOULD_BUILD_BRAINDUMP)

615
if(SHOULD_BUILD_ACTIVE)
616
  macro_optional_add_subdirectory(active)
617 618
endif(SHOULD_BUILD_ACTIVE)

619

620
if(   NOT SHOULD_BUILD_SHEETS OR NOT BUILD_sheets
621 622 623
   OR NOT SHOULD_BUILD_WORDS OR NOT BUILD_words
   OR NOT SHOULD_BUILD_STAGE OR NOT BUILD_stage
  )
624
    set(SHOULD_BUILD_KOABSTRACTION FALSE)
625
endif(   NOT SHOULD_BUILD_SHEETS OR NOT BUILD_sheets
626 627 628
      OR NOT SHOULD_BUILD_WORDS OR NOT BUILD_words
      OR NOT SHOULD_BUILD_STAGE OR NOT BUILD_stage
     )
629

630
if(SHOULD_BUILD_SHEETS AND SHOULD_BUILD_WORDS)
631
    # build cstester
632
else(SHOULD_BUILD_SHEETS AND SHOULD_BUILD_WORDS)
633
    set(SHOULD_BUILD_CSTESTER FALSE)
634
endif(SHOULD_BUILD_SHEETS AND SHOULD_BUILD_WORDS)
635

636 637
macro_optional_add_subdirectory(doc)

638 639 640 641
# non-app directories are moved here because they can depend on SHOULD_BUILD_{appname} variables set above
add_subdirectory(libs)
add_subdirectory(interfaces)
add_subdirectory(cmake)
Laurent Montel's avatar
Laurent Montel committed
642
add_subdirectory(pics)
643
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
644 645
add_subdirectory(servicetypes)
add_subdirectory(templates)
646 647
add_subdirectory(tools)
add_subdirectory(filters)
Laurent Montel's avatar
Laurent Montel committed
648

649
macro_display_feature_log()
650

651 652 653 654 655 656
macro(macro_display_application_enabled _appName _shouldBuild)
if( BUILD_${_appName} AND ${_shouldBuild} MATCHES "[Tt][Rr][Uu][Ee]" )
  message(STATUS ${_appName} )
endif( BUILD_${_appName} AND ${_shouldBuild} MATCHES "[Tt][Rr][Uu][Ee]" )
endmacro(macro_display_application_enabled)

David Faure's avatar
David Faure committed
657
message(STATUS "---------------- The following applications will be built ----------------" )
658

C. Boemann's avatar
C. Boemann committed
659
macro_display_application_enabled(words ${SHOULD_BUILD_WORDS})
660
macro_display_application_enabled(sheets ${SHOULD_BUILD_SHEETS})
661
macro_display_application_enabled(stage ${SHOULD_BUILD_STAGE})
662
macro_display_application_enabled(flow ${SHOULD_BUILD_FLOW})
663
macro_display_application_enabled(kexi ${SHOULD_BUILD_KEXI})
664
macro_display_application_enabled(plan ${SHOULD_BUILD_PLAN})
665 666
macro_display_application_enabled(krita ${SHOULD_BUILD_KRITA})
macro_display_application_enabled(karbon ${SHOULD_BUILD_KARBON})
667
macro_display_application_enabled(braindump ${SHOULD_BUILD_BRAINDUMP})
668
macro_display_application_enabled(calligra ${SHOULD_BUILD_CALLIGRA})
669
macro_display_application_enabled(cstester ${SHOULD_BUILD_CSTESTER})
670
macro_display_application_enabled(active ${SHOULD_BUILD_ACTIVE})
671 672 673

message(STATUS "--------------------------------------------------------------------------" )

674
add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
675 676 677

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)