Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

CMakeLists.txt 15.5 KB
Newer Older
1
project(koffice)
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

17 18
# define the generic version of the KOffice libraries here
# this makes it easy to advance it when the next KOffice release comes
19 20
set(GENERIC_KOFFICE_LIB_VERSION "8.0.0")
set(GENERIC_KOFFICE_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
31

32 33
option(GHNS "support Get Hot New Stuff" ON)

Jos van den Oever's avatar
Jos van den Oever committed
34
option(TINY "compile a tiny KOffice" OFF)
35 36 37 38 39 40 41 42 43 44 45

IF (TINY)
    set(SHOULD_BUILD_KWORD TRUE)
    set(SHOULD_BUILD_KPRESENTER TRUE)
    set(SHOULD_BUILD_KSPREAD TRUE)
    set(SHOULD_BUILD_KARBON FALSE)
    set(SHOULD_BUILD_KRITA FALSE)
    set(SHOULD_BUILD_KEXI FALSE)
    set(SHOULD_BUILD_KIVIO FALSE)
    set(SHOULD_BUILD_KPLATO FALSE)
    set(SHOULD_BUILD_KFORMULA FALSE)
46
    set(SHOULD_BUILD_KCHART FALSE)
47 48
    set(SHOULD_BUILD_KDGANTT FALSE)
    set(SHOULD_BUILD_KOUNAVAIL FALSE)
49
    set(SHOULD_BUILD_SCRIPTING FALSE)
50
    set(SHOULD_BUILD_F_OFFICE TRUE)
51
    set(SHOULD_BUILD_KOREPORT FALSE)
52 53 54 55 56
ELSE(TINY)
    set(SHOULD_BUILD_KWORD TRUE)
    set(SHOULD_BUILD_KPRESENTER TRUE)
    set(SHOULD_BUILD_KSPREAD TRUE)
    set(SHOULD_BUILD_KARBON TRUE)
57 58
    set(SHOULD_BUILD_KRITA TRUE)
    set(SHOULD_BUILD_KEXI TRUE)
59
    set(SHOULD_BUILD_KIVIO TRUE)
60
    set(SHOULD_BUILD_KPLATO TRUE)
61
    set(SHOULD_BUILD_KFORMULA TRUE)
62
    set(SHOULD_BUILD_KCHART FALSE)
63 64
    set(SHOULD_BUILD_KDGANTT TRUE)
    set(SHOULD_BUILD_KOUNAVAIL TRUE)
65
    set(SHOULD_BUILD_SCRIPTING TRUE)
66
    set(SHOULD_BUILD_F_OFFICE TRUE)
67
    set(SHOULD_BUILD_KOREPORT TRUE)
68
ENDIF(TINY)
69

70 71 72 73 74 75 76 77 78 79
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
80
set(KDE_MIN_VERSION "4.3.0")
81
find_package(KDE4 4.3.0 REQUIRED)
Cyrille Berger's avatar
Cyrille Berger committed
82

83
find_package(Qt4 4.6.0 REQUIRED)
84

85
include(KDE4Defaults)
86
include(MacroLibrary)
87 88 89
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

90 91 92 93 94
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")

95 96 97 98 99
 ###########################
############################
## Required dependencies  ##
############################
###########################
100

Laurent Montel's avatar
Laurent Montel committed
101 102
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
103
find_package(PNG REQUIRED)
104

105 106 107
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
108

109 110
 ################################
#################################
111
## Check for OpenEXR           ##
112 113
#################################
################################
114

115

116 117
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
118

119

120 121 122 123 124 125 126 127 128 129
 ###########################
############################
## Optional dependencies  ##
############################
###########################

##
## Look for OpenGL
##

130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
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")
146

147 148 149
##
## Test for create ressources
##
150
macro_optional_find_package(CreateResources)
151
macro_log_feature(CREATERESOURCES_FOUND "Create Resources" "Create Resources (brushes, palettes etc.)" "http://create.freedesktop.org" FALSE "" "Recommended at runtime for KOffice for optional extra resources.")
Laurent Montel's avatar
Laurent Montel committed
152

153 154 155
##
## Test for kdepimlibs
##
156 157 158
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)")

159 160 161
##
## Test for boost
##
162
macro_optional_find_package(Boost)
163
macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" FALSE "" "Required by KPresenter")
164

165 166 167 168
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
169
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0" "Required by KSpread and Krita")
170

171 172 173
##
## Test for QCA2
##
174
macro_optional_find_package(QCA2)
175
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)")
176

177 178 179
##
## Test for exiv2
##
180 181 182
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")
183

184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
##
## 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 )


200 201
##
## Test for lcms
202
##
203 204 205 206 207 208
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})
209
    set(HAVE_REQUIRED_LCMS_VERSION FALSE)
210 211 212
    set(HAVE_LCMS FALSE)
endif(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})

213
macro_optional_find_package(LCMS2)
214
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")
215 216 217 218 219 220 221
if(LCMS2_FOUND)
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
    set(HAVE_LCMS TRUE)
endif(LCMS2_FOUND)

    

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

Thomas Zander's avatar
Thomas Zander committed
224 225
#Set the build of TextShape changetraker

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

228
if(WIN32)
229 230 231 232 233 234 235 236 237 238 239 240 241 242
    # 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} )


243 244 245 246
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

247 248 249
##
## Test endianess
##
David Faure's avatar
David Faure committed
250
include (TestBigEndian)
251 252
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)

253 254 255 256 257 258 259 260 261 262
##
## Generate a file for prefix information
##

 ####################
#####################
## Define includes ##
#####################
####################

263 264 265
# WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before
#          any other include directory

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

269 270 271
# koplugin is at the bottom of the stack
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)

272
# koodf is at the bottom of the stack
273 274
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
                   ${CMAKE_BINARY_DIR}/libs/odf
275
                   ${KDE4_INCLUDES})
Boudewijn Rempt's avatar
Boudewijn Rempt committed
276

277
# pigment depends on koplugin and lcms
278
set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
279 280
                   ${CMAKE_SOURCE_DIR}/libs/pigment
                   ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
281
                   ${CMAKE_SOURCE_DIR}/libs/pigment/resources
282
                   ${QT_INCLUDES}
283
                   ${KDE4_INCLUDES})
284

285 286 287 288 289 290 291 292
# 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)
293 294 295 296 297 298 299

# 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
300
                   ${SOPRANO_INCLUDE_DIR}
301
                   ${FLAKE_INCLUDES}
302 303
                   ${KOODF_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/main)
304 305

# komain depends on kotext & flake
306
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
307
                    ${KOTEXT_INCLUDES}
308 309
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/main
310
                    ${CMAKE_SOURCE_DIR}/libs/main/config)
311

312 313 314
if(SHOULD_BUILD_SCRIPTING)
  set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
endif(SHOULD_BUILD_SCRIPTING)
315

David Faure's avatar
David Faure committed
316 317
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
318

319 320 321 322 323 324 325 326 327 328
# 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
SET(KOPROPERTY_LIB_VERSION ${GENERIC_KOFFICE_LIB_VERSION})      # TODO remove when we move to independent place
SET(KOPROPERTY_LIB_SOVERSION ${GENERIC_KOFFICE_LIB_SOVERSION})  # TODO remove when we move to independent place
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)

329 330 331 332 333
 #############################################
##############################################
## Detect which applications can be compile ##
##############################################
#############################################
334

335 336 337 338 339 340
#
# 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
#

341

342 343
### KSpread: eigen2
if(NOT EIGEN2_FOUND)
Michael Jansen's avatar
Michael Jansen committed
344
    set(SHOULD_BUILD_KSPREAD FALSE)
345
endif(NOT EIGEN2_FOUND)
346

347 348
### KPresenter: boost
if(NOT Boost_FOUND)
349
    set(SHOULD_BUILD_KPRESENTER FALSE)
350
endif(NOT Boost_FOUND)
351

Carlo Segato's avatar
Carlo Segato committed
352
### Krita: pigment, blitz, eigen2, exiv2
353
if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
354
   set(SHOULD_BUILD_KRITA FALSE)
355
endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
356

357 358 359 360 361
### KPlato: kdepimlibs
if(NOT KdepimLibs_FOUND)
    set(SHOULD_BUILD_KPLATO FALSE)
endif(NOT KdepimLibs_FOUND)

362 363 364
### 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)
365
option(BUILD_koreport "Build directory libs/koreport" ON)
366 367
### HACK ###

Jarosław Staniek's avatar
Jarosław Staniek committed
368 369 370 371
if(BUILD_kexi AND SHOULD_BUILD_KEXI)
    ##
    ## Test for sqlite
    ##
372
    set(SQLITE_RECOMMENDED_VERSION "3.7.3")
Jarosław Staniek's avatar
Jarosław Staniek committed
373 374 375 376
    find_package(KofficeSqlite 3.6.16)
    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).")

377
    if(NOT SQLITE_FOUND)
Jarosław Staniek's avatar
Jarosław Staniek committed
378 379
        set(SHOULD_BUILD_KEXI FALSE)
        message(STATUS "WARNING: Kexi will not be built.")
380
    endif(NOT SQLITE_FOUND)
Jarosław Staniek's avatar
Jarosław Staniek committed
381 382
endif(BUILD_kexi AND SHOULD_BUILD_KEXI)

383 384 385 386 387 388
 ###################
####################
## Subdirectories ##
####################
###################

389 390 391 392 393 394 395 396 397 398 399 400 401 402
if(SHOULD_BUILD_KWORD)
    macro_optional_add_subdirectory(kword)
endif(SHOULD_BUILD_KWORD)

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

if (SHOULD_BUILD_KIVIO)
    macro_optional_add_subdirectory(kivio)
endif (SHOULD_BUILD_KIVIO)

if (SHOULD_BUILD_KOUNAVAIL)
    macro_optional_add_subdirectory(kounavail)
403
endif (SHOULD_BUILD_KOUNAVAIL)
404 405 406 407 408 409

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

if (SHOULD_BUILD_KCHART)
410
    add_definitions(-DHAVE_KCHART)
411 412
    macro_optional_add_subdirectory(kchart)
endif (SHOULD_BUILD_KCHART)
413

414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
if(SHOULD_BUILD_KPRESENTER)
  macro_optional_add_subdirectory(kpresenter)
endif(SHOULD_BUILD_KPRESENTER)

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)

if(SHOULD_BUILD_KSPREAD)
    macro_optional_add_subdirectory(kspread)
endif(SHOULD_BUILD_KSPREAD)

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)

438
macro_optional_add_subdirectory(doc)
439

440 441 442 443
# 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
444
add_subdirectory(pics)
445
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
446 447
add_subdirectory(servicetypes)
add_subdirectory(templates)
448 449
add_subdirectory(tools)
add_subdirectory(filters)
Laurent Montel's avatar
Laurent Montel committed
450

451
macro_display_feature_log()
452

453 454 455 456 457 458
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
459
message(STATUS "---------------- The following applications will be built ----------------" )
460

461
macro_display_application_enabled(kword ${SHOULD_BUILD_KWORD})
462 463
macro_display_application_enabled(kspread ${SHOULD_BUILD_KSPREAD})
macro_display_application_enabled(kpresenter ${SHOULD_BUILD_KPRESENTER})
464
macro_display_application_enabled(kivio ${SHOULD_BUILD_KIVIO})
465 466 467 468
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})
469 470
macro_display_application_enabled(kformula ${SHOULD_BUILD_KFORMULA})
macro_display_application_enabled(kchart ${SHOULD_BUILD_KCHART})
471
macro_display_application_enabled(f-office ${SHOULD_BUILD_F_OFFICE})
472 473 474

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

475
add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
476 477 478

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)