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

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

5 6 7 8 9
 ######################
#######################
## Constants defines ##
#######################
######################
Thomas Zander's avatar
Thomas Zander committed
10

11 12 13 14 15
# define the generic version of the KOffice libraries here
# this makes it easy to advance it when the next KOffice release comes
set(GENERIC_KOFFICE_LIB_VERSION "5.0.0")
set(GENERIC_KOFFICE_LIB_SOVERSION "5")

16
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
17

18 19 20 21 22 23 24 25 26 27
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 ##
#########################
########################
28 29
set(KDE_MIN_VERSION "4.1.0")
find_package(KDE4 4.1.0 REQUIRED)
Thomas Zander's avatar
Thomas Zander committed
30
find_package(Qt4 4.5.0 REQUIRED)
31

32
include(KDE4Defaults)
33
include(MacroLibrary)
34 35 36 37 38 39 40 41
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

 ###########################
############################
## Required dependencies  ##
############################
###########################
42

Laurent Montel's avatar
Laurent Montel committed
43 44
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
45
find_package(PNG REQUIRED)
46

47 48 49
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
50

51 52 53 54 55
 ################################
#################################
## Check wich pigment to build ##
#################################
################################
56

57 58 59 60 61 62 63 64
# NO_PIGMENT disabled everything that uses pigment in the crudest matter possible
if (NO_PIGMENT)
    add_definitions(-DNO_PIGMENT)
    set (FULL_PIGMENT FALSE)
    set (SMALL_PIGMENT FALSE)
else (NO_PIGMENT)

    include_directories(${CMAKE_SOURCE_DIR}/libs/pigment)
65
    set (SMALL_PIGMENT FALSE)
66 67 68 69
    # SMALL_PIGMENT provides just the classed needed to compile koffice libs, but not not Krita.
    if (SMALL_PIGMENT) 
        add_definitions(-DSMALL_PIGMENT)
    else (SMALL_PIGMENT)
70 71
#        macro_optional_find_package(LCMS)
	find_package(LCMS REQUIRED)
72 73 74 75 76 77 78 79
        set(REQUIRED_LCMS_VERSION 118)

        if(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
            # FULL_PIGMENT is the most desirable state, we can compile Krita!
            set(HAVE_REQUIRED_LCMS_VERSION TRUE)
            set(FULL_PIGMENT TRUE)
            add_definitions(-DFULL_PIGMENT)
        else(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
80
            message( FATAL_ERROR "Old LCMS version found, upgrade to 1.18.")
81 82 83 84 85 86 87 88 89 90
            set(HAVE_REQUIRED_LCMS_VERSION FALSE)
            set(SMALL_PIGMENT TRUE)
            set(FULL_PIGMENT FALSE)
        endif(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})

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

    endif (SMALL_PIGMENT)
endif (NO_PIGMENT)

91 92 93 94 95 96 97 98 99 100
 ###########################
############################
## Optional dependencies  ##
############################
###########################

##
## Look for OpenGL
##

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
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)

configure_file(config-opengl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-opengl.h )
macro_log_feature(HAVE_OPENGL "OpenGL" "OpenGL support" "" FALSE "" "Required by parts of Krita and optionally by flake")
118

119 120 121 122 123 124 125 126 127 128 129
##
## Look for OpenEXR
##
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
configure_file(config-openexr.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h )
install( FILES  ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)

##
## Test for create ressources
##
130 131
macro_optional_find_package(CreateResources)
macro_log_feature(CreateResources_FOUND "Create Resources" "Create Resources (brushes, palettes etc.)" "http://create.freedesktop.org" FALSE "" "Required by KOffice for optional extra resources.")
Laurent Montel's avatar
Laurent Montel committed
132

133 134 135
##
## Test for kdepimlibs
##
136 137 138
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)")

139 140 141
##
## Test for boost
##
142
macro_optional_find_package(Boost)
143
macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" FALSE "" "Required by KPresenter")
144

145 146 147 148 149
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0" "Required by KSpread and Krita (available as a module in kdesupport)")
150

151 152 153
##
## Test for blitz
##
154
macro_optional_find_package(Blitz)
155
macro_log_feature(BLITZ_FOUND "QImageBlitz" "Image effect library" "http://www.kde.org" FALSE "" "Required by Krita (available in kdesupport)")
156

157 158 159
##
## Test for QCA2
##
160 161 162
macro_optional_find_package(QCA2)
macro_log_feature(QCA2_FOUND "QCA" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0" "Required for encrypted OpenDocument files support (available as a module in kdesupport)")

163 164 165
##
## Test for exiv2
##
166 167 168
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")
169

170 171 172 173 174
##
## Test for bzip2
##
find_program(BZIP2_EXECUTABLE NAMES bzip2 )
macro_log_feature(BZIP2_EXECUTABLE "bzip2" "High-quality data compressor" "http://www.bzip.org" FALSE "" "Required by Kexi")
Laurent Montel's avatar
Laurent Montel committed
175

Thomas Zander's avatar
Thomas Zander committed
176 177
#Set the build of TextShape changetraker

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

180
if(WIN32)
181 182 183 184 185 186 187 188 189 190 191 192 193 194
    # 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} )


195 196 197 198
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

199 200 201
##
## Test endianess
##
David Faure's avatar
David Faure committed
202
include (TestBigEndian)
203 204 205
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
configure_file(config-endian.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-endian.h )

206 207 208 209 210 211 212 213 214 215 216
##
## Generate a file for prefix information
##
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )

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

217
# for config.h and <toplevel/foo.h> includes (if any?)
218
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
219

220 221 222
# koaction depends on threadweaver
set(KOACTION_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koaction ${CMAKE_BINARY_DIR}/libs/koaction ${KDE4_INCLUDES})

223
# kostore is at the bottom of stack, so it has the dependency on the kde4 includes.
224
set(KOSTORE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/store ${CMAKE_BINARY_DIR}/libs/store ${KDE4_INCLUDES})
225

226 227 228 229 230 231
# kopicture depends on kostore
set(KOPICTURE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopicture ${CMAKE_BINARY_DIR}/libs/kopicture ${KOSTORE_INCLUDES})

# koodf depends on kostore and kopicture
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf ${CMAKE_BINARY_DIR}/libs/odf ${KOPICTURE_INCLUDES})

232
# flake depends on koodf
233
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake 
234
                   ${KOODF_INCLUDES}
235 236 237 238
                   ${CMAKE_SOURCE_DIR}/libs/kobase 
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands 
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools 
                   ${CMAKE_BINARY_DIR}/libs/flake)
239 240
# pigment depends on koplugin and lcms
set(PIGMENT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin ${CMAKE_SOURCE_DIR}/libs/pigment ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops ${LCMS_INCLUDE_DIR} ${KDE4_INCLUDES} )
241 242 243

# komain depends on kostore, koplugin, flake and koodf
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
244 245
                    ${FLAKE_INCLUDES}
                    ${PIGMENT_INCLUDES}
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
                    ${CMAKE_SOURCE_DIR}/libs/koproperties
                    ${CMAKE_SOURCE_DIR}/libs/store
                    ${CMAKE_SOURCE_DIR}/libs/kotext
                    ${CMAKE_SOURCE_DIR}/libs/kotext/changetracker
                    ${CMAKE_SOURCE_DIR}/libs/kotext/styles
                    ${CMAKE_SOURCE_DIR}/libs/kotext/kohyphen
                    ${CMAKE_SOURCE_DIR}/libs/kotext/opendocument
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/widgets/progress
                    ${CMAKE_SOURCE_DIR}/libs/widgets/linestyleselector
                    ${CMAKE_SOURCE_DIR}/libs/widgets/aspectbutton
                    ${CMAKE_SOURCE_DIR}/libs/widgets/openpane
                    ${CMAKE_SOURCE_DIR}/libs/widgets/colorwidgets
                    ${CMAKE_SOURCE_DIR}/libs/widgets/resources
                    ${CMAKE_SOURCE_DIR}/libs/widgets/pagelayout
                    ${CMAKE_SOURCE_DIR}/libs/widgets/characterselectiondialog
                    ${CMAKE_SOURCE_DIR}/libs/widgets/csvimportdialog
                    ${CMAKE_SOURCE_DIR}/libs/widgets/documentsectionbox
                    ${CMAKE_SOURCE_DIR}/libs/widgets/zoom
                    ${CMAKE_SOURCE_DIR}/libs/widgets/input
                    ${CMAKE_SOURCE_DIR}/libs/kopicture
                    ${CMAKE_SOURCE_DIR}/libs/koaction
                    ${CMAKE_SOURCE_DIR}/libs/main
                    ${CMAKE_SOURCE_DIR}/libs/resources
                    ${CMAKE_SOURCE_DIR}/libs/koplugin
271 272
 )

273 274 275 276 277 278 279 280 281 282 283 284 285
 # koresources depends on pigment
 set(KORESOURCES_INCLUDES ${CMAKE_SOURCE_DIR}/libs/resources
 			 ${CMAKE_BINARY_DIR}/libs/resources 
 			 ${PIGMENT_INCLUDES} 
			 ${KDE4_INCLUDES})

# KoText depends on store, odf
set(KOTEXT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kotext/styles
                    ${CMAKE_SOURCE_DIR}/libs/kotext/opendocument
                    ${CMAKE_SOURCE_DIR}/libs/kotext
                    ${CMAKE_SOURCE_DIR}/libs/kotext/changetracker
                    ${CMAKE_BINARY_DIR}/libs/kotext)

286
set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
287

David Faure's avatar
David Faure committed
288 289
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
290

291
set(KOPROPERTIES_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kobase ${CMAKE_BINARY_DIR}/libs/kobase)
Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
292

293 294 295 296 297
 #############################################
##############################################
## Detect which applications can be compile ##
##############################################
#############################################
298

299
### Karbon: pigment
300
set(SHOULD_BUILD_KARBON TRUE)
301 302 303
if (NO_PIGMENT)
    set(SHOULD_BUILD_KARBON FALSE)
endif (NO_PIGMENT)
304

305 306 307
### KSpread: eigen2
set(SHOULD_BUILD_KSPREAD TRUE)
if(NOT EIGEN2_FOUND)
Michael Jansen's avatar
Michael Jansen committed
308
    set(SHOULD_BUILD_KSPREAD FALSE)
309
endif(NOT EIGEN2_FOUND)
310

311 312 313
### KPresenter: boost
set(SHOULD_BUILD_KPRESENTER TRUE)
if(NOT Boost_FOUND)
314
    set(SHOULD_BUILD_KPRESENTER FALSE)
315
endif(NOT Boost_FOUND)
316

317 318 319 320 321
### Kexi: bzip2
set(SHOULD_BUILD_KEXI TRUE)
if(NOT BZIP2_EXECUTABLE )
    set(SHOULD_BUILD_KEXI FALSE)
endif(NOT BZIP2_EXECUTABLE )
322

323 324
### Krita: non-win32, pigment, blitz, eigen2, exiv2
set(SHOULD_BUILD_KRITA TRUE)
325 326 327 328
if(WIN32 OR SMALL_PIGMENT OR NO_PIGMENT OR NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
   set(SHOULD_BUILD_KRITA FALSE)
endif(WIN32 OR SMALL_PIGMENT OR NO_PIGMENT OR NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)

329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
### KPlato: kdepimlibs
set(SHOULD_BUILD_KPLATO TRUE)
if(NOT KdepimLibs_FOUND)
    set(SHOULD_BUILD_KPLATO FALSE)
endif(NOT KdepimLibs_FOUND)

 ###################
####################
## Subdirectories ##
####################
###################

add_subdirectory(libs)
add_subdirectory(interfaces)
add_subdirectory(cmake)
344

Boudewijn Rempt's avatar
Boudewijn Rempt committed
345
macro_optional_add_subdirectory(kword)
346 347 348 349 350 351 352
macro_optional_add_subdirectory(kformula)
macro_optional_add_subdirectory(kivio)
macro_optional_add_subdirectory(kounavail)
macro_optional_add_subdirectory(kdgantt)
macro_optional_add_subdirectory(kchart)
macro_optional_add_subdirectory(doc)

353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
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)

Laurent Montel's avatar
Laurent Montel committed
377
add_subdirectory(pics)
378
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
379 380
add_subdirectory(servicetypes)
add_subdirectory(templates)
381 382
add_subdirectory(tools)
add_subdirectory(filters)
Laurent Montel's avatar
Laurent Montel committed
383

384
macro_display_feature_log()
385

386
add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})