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 12.6 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1 2 3 4
project(koffice)

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

Thomas Zander's avatar
Thomas Zander committed
5 6 7 8 9
if(KDE4_BUILD_TESTS)
    # only with this definition will the FOO_TEST_EXPORT macro do something
    add_definitions(-DCOMPILING_TESTS)
endif(KDE4_BUILD_TESTS)

10 11 12 13 14
# 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")

15 16
cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)

Laurent Montel's avatar
Laurent Montel committed
17
# search packages used by KDE
18 19
set(KDE_MIN_VERSION "4.1.0")
find_package(KDE4 4.1.0 REQUIRED)
Thomas Zander's avatar
Thomas Zander committed
20
find_package(Qt4 4.5.0 REQUIRED)
21

22
include(KDE4Defaults)
23
include(MacroLibrary)
24

Laurent Montel's avatar
Laurent Montel committed
25 26
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
27
find_package(PNG REQUIRED)
28

29

30 31 32
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 )
33

34 35 36 37 38 39 40 41
# 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)
42
    set (SMALL_PIGMENT FALSE)
43 44 45 46
    # 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)
47 48
#        macro_optional_find_package(LCMS)
	find_package(LCMS REQUIRED)
49 50 51 52 53 54 55 56
        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})
57
            message( FATAL_ERROR "Old LCMS version found, upgrade to 1.18.")
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
            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)

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")
86 87 88

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
89

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

macro_optional_find_package(Boost)
94
macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" FALSE "" "Required by KPresenter")
95

Benoît Jacob's avatar
Benoît Jacob committed
96 97
macro_optional_find_package(Eigen2 2.0.3)
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0.3" "Required by KSpread and Krita")
98 99

macro_optional_find_package(Blitz)
100
macro_log_feature(BLITZ_FOUND "QImageBlitz" "Image effect library" "http://www.kde.org" FALSE "" "Required by Krita (available in kdesupport)")
101

102 103 104 105 106 107
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)")

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

109

Laurent Montel's avatar
Laurent Montel committed
110 111 112 113 114
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)


Thomas Zander's avatar
Thomas Zander committed
115 116
#Set the build of TextShape changetraker

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

119
if(WIN32)
120 121 122 123 124 125 126 127 128 129 130 131 132 133
    # 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} )


134 135 136 137
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Laurent Montel's avatar
Laurent Montel committed
138 139 140

include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)
Laurent Montel's avatar
Laurent Montel committed
141

142
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
David Faure's avatar
David Faure committed
143

144
# Look for OpenCTL (XXX: move this inside full_pigment? Or inside pigment?)
145 146
macro_optional_find_package(OpenCTL)

147
macro_log_feature(OPENCTL_FOUND "OpenCTL" "Free Color Transformation Language implementation" "http://www.openctl.org" FALSE "0.9.2" "Required for High Dynamic Range Color Spaces, YCbCr and LMS support")
148
configure_file(config-openctl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openctl.h )
149

David Faure's avatar
David Faure committed
150
include (TestBigEndian)
151 152 153
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
configure_file(config-endian.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-endian.h )

154
# for config.h and <toplevel/foo.h> includes (if any?)
155
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
156

157 158 159
# koaction depends on threadweaver
set(KOACTION_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koaction ${CMAKE_BINARY_DIR}/libs/koaction ${KDE4_INCLUDES})

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

163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
# 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})


set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake 
                   ${CMAKE_SOURCE_DIR}/libs/odf 
                   ${CMAKE_SOURCE_DIR}/libs/kobase 
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands 
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools 
                   ${CMAKE_BINARY_DIR}/libs/flake)

# komain depends on kostore, koplugin, flake and koodf
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
                    ${CMAKE_SOURCE_DIR}/libs/flake
                    ${CMAKE_SOURCE_DIR}/libs/flake/pics
                    ${CMAKE_SOURCE_DIR}/libs/flake/commands
                    ${CMAKE_SOURCE_DIR}/libs/flake/tools
                    ${CMAKE_SOURCE_DIR}/libs/pigment
                    ${CMAKE_SOURCE_DIR}/libs/pigment/colorspaces
                    ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
                    ${CMAKE_SOURCE_DIR}/libs/pigment/colorprofiles
                    ${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/kobase
                    ${CMAKE_SOURCE_DIR}/libs/koaction
                    ${CMAKE_SOURCE_DIR}/libs/main
                    ${CMAKE_SOURCE_DIR}/libs/resources
                    ${CMAKE_SOURCE_DIR}/libs/odf
                    ${CMAKE_SOURCE_DIR}/libs/koplugin
 )                   
 
 # pigment depends on koplugin and lcms
 set(PIGMENT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin ${CMAKE_SOURCE_DIR}/libs/pigment ${CMAKE_SOURCE_DIR}/libs/pigment/colorspaces ${CMAKE_SOURCE_DIR}/libs/pigment/colorprofiles ${LCMS_INCLUDE_DIR} ${KDE4_INCLUDES} )
 
 # 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)

set(KFORMULA_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kformula
		      ${CMAKE_BINARY_DIR}/libs/kformula)
234

235
set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
236

David Faure's avatar
David Faure committed
237 238
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
239

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

242
add_subdirectory(libs)
Laurent Montel's avatar
Laurent Montel committed
243
add_subdirectory(interfaces)
Laurent Montel's avatar
Laurent Montel committed
244
add_subdirectory(cmake)
245

246
set(SHOULD_BUILD_KARBON TRUE)
247 248 249
if (NO_PIGMENT)
    set(SHOULD_BUILD_KARBON FALSE)
endif (NO_PIGMENT)
250
macro_optional_add_subdirectory(karbon)
251

Michael Jansen's avatar
Michael Jansen committed
252
if(EIGEN2_FOUND)
253
    macro_optional_add_subdirectory(kspread)
Michael Jansen's avatar
Michael Jansen committed
254
    if(BUILD_kspread)
255
        set(SHOULD_BUILD_KSPREAD TRUE)
Michael Jansen's avatar
Michael Jansen committed
256 257 258 259 260 261
    else(BUILD_kspread)
        set(SHOULD_BUILD_KSPREAD FALSE)
    endif(BUILD_kspread)
else(EIGEN2_FOUND)
    set(SHOULD_BUILD_KSPREAD FALSE)
endif(EIGEN2_FOUND)
262

263 264 265
#Check if build kpresenter here to be able to test if we can build filters/kpresenter
if(Boost_FOUND)
    set(SHOULD_BUILD_KPRESENTER TRUE)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
266
    macro_optional_add_subdirectory(kpresenter)
267 268 269
else(Boost_FOUND)
    set(SHOULD_BUILD_KPRESENTER FALSE)
endif(Boost_FOUND)
270

Laurent Montel's avatar
Laurent Montel committed
271
FIND_PROGRAM(BZIP2_EXECUTABLE NAMES bzip2 )
272
macro_log_feature(BZIP2_EXECUTABLE "bzip2" "High-quality data compressor" "http://www.bzip.org" FALSE "" "Required by Kexi")
273

274
if(BUILD_KEXI)
275 276 277
    if( BZIP2_EXECUTABLE )
        macro_optional_add_subdirectory(kexi)
    endif( BZIP2_EXECUTABLE )
278
endif(BUILD_KEXI)
279

280
if(KdepimLibs_FOUND)
281
    macro_optional_add_subdirectory(kplato)
282
endif(KdepimLibs_FOUND)
283

284 285 286 287 288 289 290 291 292

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)
else(WIN32 OR SMALL_PIGMENT OR NO_PIGMENT OR NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
    set(SHOULD_BUILD_KRITA TRUE)
    macro_optional_add_subdirectory(krita)
endif(WIN32 OR SMALL_PIGMENT OR NO_PIGMENT OR NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)


Boudewijn Rempt's avatar
Boudewijn Rempt committed
293
macro_optional_add_subdirectory(kword)
294 295 296 297 298 299 300
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)

Laurent Montel's avatar
Laurent Montel committed
301
add_subdirectory(pics)
302
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
303 304
add_subdirectory(servicetypes)
add_subdirectory(templates)
305 306
add_subdirectory(tools)
add_subdirectory(filters)
Laurent Montel's avatar
Laurent Montel committed
307

308
MACRO_DISPLAY_FEATURE_LOG()
309

Stefan Nikolaus's avatar
Stefan Nikolaus committed
310
ADD_CUSTOM_TARGET(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Cyrille Berger's avatar
Cyrille Berger committed
311

312
install( FILES  ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)