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

3
cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
Laurent Montel's avatar
Laurent Montel committed
4

5 6 7 8 9 10
 ############
#############
## Options ##
#############
############

11 12 13 14 15
 ######################
#######################
## Constants defines ##
#######################
######################
Thomas Zander's avatar
Thomas Zander committed
16

Boudewijn Rempt's avatar
Boudewijn Rempt committed
17 18 19 20
# define the generic version of the Calligra libraries here
# this makes it easy to advance it when the next Calligra release comes
set(GENERIC_CALLIGRA_LIB_VERSION "8.0.0")
set(GENERIC_CALLIGRA_LIB_SOVERSION "8")
21

22
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
23

24 25 26 27 28
#
# 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)
#
29 30
#eg:
#option(BUILD_kexi "Build directory kexi" OFF) # kexi isn't buildable at the moment
Casper Boemann's avatar
Casper Boemann committed
31 32
option(BUILD_koabstraction "Build directory koabstraction" ON) # koabstraction isn't buildable at the moment
option(BUILD_mobile "Build directory mobile" ON) # mobile depends on koabstraction it builds but does not run
33

34 35
option(GHNS "support Get Hot New Stuff" ON)

36 37
option(TINY "compile a tiny Calligra" OFF)
option(CREATIVEONLY "compile only Karbon and Krita" OFF)
38 39

IF (TINY)
C. Boemann's avatar
C. Boemann committed
40
    set(SHOULD_BUILD_WORDS TRUE)
41
    set(SHOULD_BUILD_STAGE TRUE)
42
    set(SHOULD_BUILD_TABLES TRUE)
43 44 45
    set(SHOULD_BUILD_KARBON FALSE)
    set(SHOULD_BUILD_KRITA FALSE)
    set(SHOULD_BUILD_KEXI FALSE)
46
    set(SHOULD_BUILD_FLOW FALSE)
47 48
    set(SHOULD_BUILD_KPLATO FALSE)
    set(SHOULD_BUILD_KFORMULA FALSE)
49
    set(SHOULD_BUILD_KCHART FALSE)
50 51
    set(SHOULD_BUILD_KDGANTT FALSE)
    set(SHOULD_BUILD_KOUNAVAIL FALSE)
52
    set(SHOULD_BUILD_SCRIPTING FALSE)
53
    set(SHOULD_BUILD_MOBILE TRUE)
54
    set(SHOULD_BUILD_KOREPORT FALSE)
55
    set(SHOULD_BUILD_BRAINDUMP FALSE)
56
    set(SHOULD_BUILD_CALLIGRA FALSE)
57
    set(SHOULD_BUILD_CSTESTER FALSE)
58
    set(SHOULD_BUILD_KOABSTRACTION TRUE)
59
    set(SHOULD_BUILD_ACTIVE TRUE)
60 61
ELSEIF (CREATIVEONLY)
    set(SHOULD_BUILD_WORDS FALSE)
62
    set(SHOULD_BUILD_STAGE FALSE)
63 64 65 66 67 68 69 70 71 72 73
    set(SHOULD_BUILD_TABLES FALSE)
    set(SHOULD_BUILD_KARBON TRUE)
    set(SHOULD_BUILD_KRITA TRUE)
    set(SHOULD_BUILD_KEXI FALSE)
    set(SHOULD_BUILD_FLOW FALSE)
    set(SHOULD_BUILD_KPLATO FALSE)
    set(SHOULD_BUILD_KFORMULA FALSE)
    set(SHOULD_BUILD_KCHART FALSE)
    set(SHOULD_BUILD_KDGANTT FALSE)
    set(SHOULD_BUILD_KOUNAVAIL FALSE)
    set(SHOULD_BUILD_SCRIPTING TRUE)
74
    set(SHOULD_BUILD_MOBILE FALSE)
75 76 77 78 79
    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)
80
    set(SHOULD_BUILD_ACTIVE FALSE)
81
ELSE()
C. Boemann's avatar
C. Boemann committed
82
    set(SHOULD_BUILD_WORDS TRUE)
83
    set(SHOULD_BUILD_STAGE TRUE)
84
    set(SHOULD_BUILD_TABLES TRUE)
85
    set(SHOULD_BUILD_KARBON TRUE)
86 87
    set(SHOULD_BUILD_KRITA TRUE)
    set(SHOULD_BUILD_KEXI TRUE)
88
    set(SHOULD_BUILD_FLOW TRUE)
89
    set(SHOULD_BUILD_KPLATO TRUE)
90
    set(SHOULD_BUILD_KFORMULA TRUE)
91
    set(SHOULD_BUILD_KCHART FALSE)
92 93
    set(SHOULD_BUILD_KDGANTT TRUE)
    set(SHOULD_BUILD_KOUNAVAIL TRUE)
94
    set(SHOULD_BUILD_SCRIPTING TRUE)
95
    set(SHOULD_BUILD_MOBILE TRUE)
96
    set(SHOULD_BUILD_KOREPORT TRUE)
97
    set(SHOULD_BUILD_BRAINDUMP TRUE)
98
    set(SHOULD_BUILD_CALLIGRA TRUE)
99
    set(SHOULD_BUILD_CSTESTER TRUE)
100
    set(SHOULD_BUILD_KOABSTRACTION TRUE)
101
    set(SHOULD_BUILD_ACTIVE FALSE)
102
ENDIF()
103

104 105 106 107 108 109 110 111 112 113
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
114
set(KDE_MIN_VERSION "4.3.0")
115
find_package(KDE4 4.3.0 REQUIRED)
Cyrille Berger's avatar
Cyrille Berger committed
116

117
find_package(Qt4 4.6.0 REQUIRED)
118

119
include(KDE4Defaults)
120
include(MacroLibrary)
121 122 123
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

124 125 126 127 128
option(GHNS "support Get Hot New Stuff" ON)
if(KDE_VERSION LESS "4.4.0")
    set(GHNS FALSE)
endif(KDE_VERSION LESS "4.4.0")

129 130 131 132 133
 ###########################
############################
## Required dependencies  ##
############################
###########################
134

Laurent Montel's avatar
Laurent Montel committed
135 136
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
137
find_package(PNG REQUIRED)
138 139 140 141
find_package(Boost REQUIRED) # for pigment and stage
if (NOT Boost_FOUND)
    MESSAGE(FATAL_ERROR "Did not find Boost. Boost is required for the core libraries, stage, tables and krita.")
endif (NOT Boost_FOUND)
142

143 144 145
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
146

147 148
 ################################
#################################
149
## Check for OpenEXR           ##
150 151
#################################
################################
152

153

154 155
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
156

157

158 159 160 161 162 163 164 165 166 167
 ###########################
############################
## Optional dependencies  ##
############################
###########################

##
## Look for OpenGL
##

168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
macro_optional_find_package(OpenGL)
set(HAVE_OPENGL 0)

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")
184

185 186 187
##
## Test for create ressources
##
188
macro_optional_find_package(CreateResources)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
189
macro_log_feature(CREATERESOURCES_FOUND "Create Resources" "Create Resources (brushes, palettes etc.)" "http://create.freedesktop.org" FALSE "" "Recommended at runtime for Calligra for optional extra resources.")
Laurent Montel's avatar
Laurent Montel committed
190

191 192 193
##
## Test for kdepimlibs
##
194 195 196
macro_optional_find_package(KdepimLibs)
macro_log_feature(KDEPIMLIBS_FOUND "KDE PIMLibs" "KDE Personal Information Management Libraries" "http://www.kde.org/" FALSE "" "Required by KPlato and the KDE address book integration (available as a module in KDE)")

197

198 199 200 201
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
202
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0" "Required by Tables and Krita")
203

204 205 206
##
## Test for QCA2
##
207
macro_optional_find_package(QCA2)
208
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)")
209

210 211 212
##
## Test for exiv2
##
213 214 215
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")
216

217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
##
## 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 )


233 234
##
## Test for lcms
235
##
236 237 238 239 240 241
macro_optional_find_package(LCMS)
set(REQUIRED_LCMS_VERSION 118)
if(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
    set(HAVE_LCMS TRUE)
else(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
242
    set(HAVE_REQUIRED_LCMS_VERSION FALSE)
243 244 245
    set(HAVE_LCMS FALSE)
endif(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})

246
macro_optional_find_package(LCMS2)
247
macro_log_feature(LCMS2_FOUND "LittleCMS" "Color management engine" "http://www.littlecms.com" FALSE "2.0" "Optional replacement for LittleCMS 1.18. Can be used for color management and Krita")
248 249 250 251 252 253 254
if(LCMS2_FOUND)
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
    set(HAVE_LCMS TRUE)
endif(LCMS2_FOUND)

    

255
macro_log_feature(HAVE_REQUIRED_LCMS_VERSION "LittleCMS" "Color management engine" "http://www.littlecms.com" FALSE "1.18" "Required for color management and Krita")
256

Thomas Zander's avatar
Thomas Zander committed
257 258
#Set the build of TextShape changetraker

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

261
if(WIN32)
262 263 264 265 266 267 268 269 270 271 272 273 274 275
    # 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} )


276 277 278 279
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Hanzes Matus's avatar
Hanzes Matus committed
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
##
## Test for Fontconfig
##
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")

##
## Test for Freetype
##
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")

if(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND) 
    set(FONTCONFIG_INCLUDE_DIR "")
    set(FREETYPE_INCLUDE_DIRS "")
else(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
	add_definitions( -DSHOULD_BUILD_FONT_CONVERSION )
endif(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
  

300 301 302
##
## Test endianess
##
David Faure's avatar
David Faure committed
303
include (TestBigEndian)
304 305
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)

306 307 308 309
##
## Generate a file for prefix information
##

Cyrille Berger's avatar
Cyrille Berger committed
310 311 312 313 314 315
 #############################
##############################
## Add the benchmark target ##
##############################
#############################

Boudewijn Rempt's avatar
Boudewijn Rempt committed
316
include(MacroCalligraAddBenchmark)
Cyrille Berger's avatar
Cyrille Berger committed
317

318 319 320 321 322 323
 ####################
#####################
## Define includes ##
#####################
####################

324 325 326
# WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before
#          any other include directory

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

330 331 332
# koplugin is at the bottom of the stack
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)

333
# koodf is at the bottom of the stack
334 335
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
                   ${CMAKE_BINARY_DIR}/libs/odf
336
                   ${KDE4_INCLUDES})
Boudewijn Rempt's avatar
Boudewijn Rempt committed
337

338
# pigment depends on koplugin and lcms
339
set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
340 341
                   ${CMAKE_SOURCE_DIR}/libs/pigment
                   ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
342
                   ${CMAKE_SOURCE_DIR}/libs/pigment/resources
343
                   ${QT_INCLUDES}
344
                   ${KDE4_INCLUDES})
345

346 347 348 349 350 351 352 353
# flake depends on koodf and pigment
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake
                   ${KOODF_INCLUDES}
                   ${KOPLUGIN_INCLUDES}
                   ${PIGMENT_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools
                   ${CMAKE_BINARY_DIR}/libs/flake)
354 355 356 357 358 359 360

# 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
361
                   ${SOPRANO_INCLUDE_DIR}
362
                   ${FLAKE_INCLUDES}
363 364
                   ${KOODF_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/main)
365

366 367 368 369
# TextLayout depends on kotext
set(TEXTLAYOUT_INCLUDES ${KOTEXT_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/textlayout)

370
# komain depends on kotext & flake
371
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
372
                    ${TEXTLAYOUT_INCLUDES}
373 374
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/main
375
                    ${CMAKE_SOURCE_DIR}/libs/main/rdf
376
                    ${CMAKE_SOURCE_DIR}/libs/main/config)
377

378 379 380
if(SHOULD_BUILD_SCRIPTING)
  set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
endif(SHOULD_BUILD_SCRIPTING)
381

David Faure's avatar
David Faure committed
382
# kopageapp
383 384 385 386 387
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 )
388

389 390 391
# 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
392 393
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
394 395 396 397 398
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)

399 400 401 402 403
 #############################################
##############################################
## Detect which applications can be compile ##
##############################################
#############################################
404

405 406 407 408 409 410
#
# 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
#

411

412
### Tables: eigen2, boost
413
if(NOT EIGEN2_FOUND)
414
    set(SHOULD_BUILD_TABLES FALSE)
415
endif(NOT EIGEN2_FOUND)
416

Boudewijn Rempt's avatar
Boudewijn Rempt committed
417
### Krita: pigment, eigen2, exiv2
418
if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
419
   set(SHOULD_BUILD_KRITA FALSE)
420
endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
421

422 423 424 425 426
### KPlato: kdepimlibs
if(NOT KdepimLibs_FOUND)
    set(SHOULD_BUILD_KPLATO FALSE)
endif(NOT KdepimLibs_FOUND)

427 428 429 430 431 432
  
if (NOT ${QTVERSION} VERSION_GREATER 4.7.0)
  set(SHOULD_BUILD_ACTIVE FALSE)
endif (NOT ${QTVERSION} VERSION_GREATER 4.7.0)


433 434 435
### 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)
436
option(BUILD_koreport "Build directory libs/koreport" ON)
437 438
### HACK ###

Jarosław Staniek's avatar
Jarosław Staniek committed
439 440 441 442
if(BUILD_kexi AND SHOULD_BUILD_KEXI)
    ##
    ## Test for sqlite
    ##
443
    set(SQLITE_RECOMMENDED_VERSION "3.7.3")
Boudewijn Rempt's avatar
Boudewijn Rempt committed
444
    find_package(CalligraSqlite 3.6.16)
Jarosław Staniek's avatar
Jarosław Staniek committed
445 446 447
    macro_log_feature(SQLITE_FOUND "SQLite" "Embedded SQL database engine" "http://www.sqlite.org"
                      FALSE ${SQLITE_MIN_VERSION} "Required by Kexi (for its default database driver).")

448
    if(NOT SQLITE_FOUND)
Jarosław Staniek's avatar
Jarosław Staniek committed
449 450
        set(SHOULD_BUILD_KEXI FALSE)
        message(STATUS "WARNING: Kexi will not be built.")
451
    endif(NOT SQLITE_FOUND)
Jarosław Staniek's avatar
Jarosław Staniek committed
452 453
endif(BUILD_kexi AND SHOULD_BUILD_KEXI)

454 455 456 457 458 459
 ###################
####################
## Subdirectories ##
####################
###################

C. Boemann's avatar
C. Boemann committed
460
if(SHOULD_BUILD_WORDS)
461
   macro_optional_add_subdirectory(words)
C. Boemann's avatar
C. Boemann committed
462
endif(SHOULD_BUILD_WORDS)
463 464 465 466 467

if (SHOULD_BUILD_KFORMULA)
    macro_optional_add_subdirectory(kformula)
endif (SHOULD_BUILD_KFORMULA)

468 469 470
if (SHOULD_BUILD_FLOW)
    macro_optional_add_subdirectory(flow)
endif (SHOULD_BUILD_FLOW)
471 472 473

if (SHOULD_BUILD_KOUNAVAIL)
    macro_optional_add_subdirectory(kounavail)
474
endif (SHOULD_BUILD_KOUNAVAIL)
475 476 477 478 479 480

if (SHOULD_BUILD_KPLATO)
    macro_optional_add_subdirectory(kdgantt)
endif (SHOULD_BUILD_KPLATO)

if (SHOULD_BUILD_KCHART)
481
    add_definitions(-DHAVE_KCHART)
482 483
    macro_optional_add_subdirectory(kchart)
endif (SHOULD_BUILD_KCHART)
484

485
if(SHOULD_BUILD_STAGE)
486
  macro_optional_add_subdirectory(kpresenter)
487
endif(SHOULD_BUILD_STAGE)
488 489 490 491 492 493 494 495 496

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

if(SHOULD_BUILD_KPLATO)
    macro_optional_add_subdirectory(kplato)
endif(SHOULD_BUILD_KPLATO)

497 498 499
if(SHOULD_BUILD_TABLES)
    macro_optional_add_subdirectory(tables)
endif(SHOULD_BUILD_TABLES)
500 501 502 503 504 505 506 507 508

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)

509 510 511 512
if(SHOULD_BUILD_BRAINDUMP)
  macro_optional_add_subdirectory(braindump)
endif(SHOULD_BUILD_BRAINDUMP)

513
if(SHOULD_BUILD_ACTIVE)
514
  macro_optional_add_subdirectory(active)
515 516
endif(SHOULD_BUILD_ACTIVE)

517

518
if(NOT SHOULD_BUILD_TABLES OR NOT SHOULD_BUILD_WORDS OR NOT SHOULD_BUILD_STAGE)
519
    set(SHOULD_BUILD_KOABSTRACTION FALSE)
520
endif(NOT SHOULD_BUILD_TABLES OR NOT SHOULD_BUILD_WORDS OR NOT SHOULD_BUILD_STAGE)
521

522
if(SHOULD_BUILD_KOABSTRACTION)
523 524 525 526 527 528 529
    # koabstraction depends on kotext & flake
    set(KOABSTRACTION_INCLUDES ${KDE4_INCLUDES}
                        ${KOTEXT_INCLUDES}
                        ${FLAKE_INCLUDES}
                        ${KOPAGEAPP_INCLUDES}
                        ${KOMAIN_INCLUDES}
                        ${CMAKE_SOURCE_DIR}/tools/koabstraction)
530
else(SHOULD_BUILD_KOABSTRACTION)
531
    set(SHOULD_BUILD_MOBILE FALSE)
532
endif(SHOULD_BUILD_KOABSTRACTION)
533

534
if(SHOULD_BUILD_TABLES AND SHOULD_BUILD_WORDS)
535
    # build cstester
536
else(SHOULD_BUILD_TABLES AND SHOULD_BUILD_WORDS)
537
    set(SHOULD_BUILD_CSTESTER FALSE)
538
endif(SHOULD_BUILD_TABLES AND SHOULD_BUILD_WORDS)
539

540 541
macro_optional_add_subdirectory(doc)

542 543 544 545
# 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
546
add_subdirectory(pics)
547
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
548 549
add_subdirectory(servicetypes)
add_subdirectory(templates)
550 551
add_subdirectory(tools)
add_subdirectory(filters)
Laurent Montel's avatar
Laurent Montel committed
552

553
macro_display_feature_log()
554

555 556 557 558 559 560
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
561
message(STATUS "---------------- The following applications will be built ----------------" )
562

C. Boemann's avatar
C. Boemann committed
563
macro_display_application_enabled(words ${SHOULD_BUILD_WORDS})
564
macro_display_application_enabled(tables ${SHOULD_BUILD_TABLES})
565
macro_display_application_enabled(kpresenter ${SHOULD_BUILD_STAGE})
566
macro_display_application_enabled(flow ${SHOULD_BUILD_FLOW})
567 568 569 570
macro_display_application_enabled(kexi ${SHOULD_BUILD_KEXI})
macro_display_application_enabled(kplato ${SHOULD_BUILD_KPLATO})
macro_display_application_enabled(krita ${SHOULD_BUILD_KRITA})
macro_display_application_enabled(karbon ${SHOULD_BUILD_KARBON})
571
macro_display_application_enabled(braindump ${SHOULD_BUILD_BRAINDUMP})
572 573
macro_display_application_enabled(kformula ${SHOULD_BUILD_KFORMULA})
macro_display_application_enabled(kchart ${SHOULD_BUILD_KCHART})
574
macro_display_application_enabled(mobile ${SHOULD_BUILD_MOBILE})
575
macro_display_application_enabled(calligra ${SHOULD_BUILD_CALLIGRA})
576
macro_display_application_enabled(cstester ${SHOULD_BUILD_CSTESTER})
577
macro_display_application_enabled(active ${SHOULD_BUILD_ACTIVE})
578 579 580

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

581
add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
582 583 584

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)