CMakeLists.txt 9.27 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
include(KDE4Defaults)
22
include(MacroLibrary)
Laurent Montel's avatar
Laurent Montel committed
23 24
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
25

Laurent Montel's avatar
Laurent Montel committed
26
find_package(LCMS REQUIRED)
27
set(REQUIRED_LCMS_VERSION 118)
28

29 30 31 32 33
if(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
else(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
    set(HAVE_REQUIRED_LCMS_VERSION FALSE)
endif(LCMS_FOUND AND NOT LCMS_VERSION LESS ${REQUIRED_LCMS_VERSION})
34

35
macro_log_feature(HAVE_REQUIRED_LCMS_VERSION "LittleCMS" "Color management engine" "http://www.littlecms.com" TRUE "1.18" "Required by KOffice")
36

37 38 39 40
find_package(PNG REQUIRED)

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
41

42 43 44 45
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)
46
macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" FALSE "" "Required by KPresenter")
47

48 49 50 51
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)")

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

54 55 56 57 58 59
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")
60

61

Laurent Montel's avatar
Laurent Montel committed
62 63 64 65 66
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)


Thomas Zander's avatar
Thomas Zander committed
67 68
#Set the build of TextShape changetraker

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

71 72 73 74 75 76 77 78 79 80 81 82
if(WIN32)
  # 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}")
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Laurent Montel's avatar
Laurent Montel committed
83 84 85

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

87
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
David Faure's avatar
David Faure committed
88 89 90

macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
91
configure_file(config-openexr.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h )
Laurent Montel's avatar
Laurent Montel committed
92

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
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)

108 109
macro_log_feature(HAVE_OPENGL "OpenGL" "OpenGL support" "" FALSE "" "Required by parts of Krita")

110 111
configure_file(config-opengl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-opengl.h )

112 113 114
# Look for OpenCTL
macro_optional_find_package(OpenCTL)

115
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")
116
configure_file(config-openctl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openctl.h )
117 118


David Faure's avatar
David Faure committed
119
include (TestBigEndian)
120 121 122
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
configure_file(config-endian.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-endian.h )

123
# for config.h and <toplevel/foo.h> includes (if any?)
124
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
125 126

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

David Faure's avatar
David Faure committed
129 130
# koodf depends on kostore
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf ${CMAKE_BINARY_DIR}/libs/odf ${KOSTORE_INCLUDES})
131

David Faure's avatar
David Faure committed
132 133
# komain depends on koodf
set(KOMAIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/main ${CMAKE_SOURCE_DIR}/libs/main/threadAction ${CMAKE_BINARY_DIR}/libs/main ${KOODF_INCLUDES})
134

Casper Boemann's avatar
Casper Boemann committed
135
# pigment depends on komain and lcms
136
set(PIGMENT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/pigment ${CMAKE_SOURCE_DIR}/libs/pigment/colorspaces ${CMAKE_SOURCE_DIR}/libs/pigment/colorprofiles ${LCMS_INCLUDE_DIR} )
137

Casper Boemann's avatar
Casper Boemann committed
138
# flake depends on komain
139
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake ${CMAKE_SOURCE_DIR}/libs/flake/commands ${CMAKE_SOURCE_DIR}/libs/flake/tools ${CMAKE_BINARY_DIR}/libs/flake)
140

141 142
# koresources depends on pigment
set(KORESOURCES_INCLUDES ${CMAKE_SOURCE_DIR}/libs/resources ${CMAKE_BINARY_DIR}/libs/resources ${PIGMENT_INCLUDES})
143

144
# koguiutils depends on komain, flake and pigment
145
set(KOGUIUTILS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/guiutils ${CMAKE_BINARY_DIR}/libs/guiutils ${KOMAIN_INCLUDES} ${FLAKE_INCLUDES} ${PIGMENT_INCLUDES} ${KORESOURCES_INCLUDES})
146 147

# The rest must be specified independently, in addition to one of the above three
Thomas Zander's avatar
Thomas Zander committed
148
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)
149
set(KFORMULA_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kformula ${CMAKE_BINARY_DIR}/libs/kformula)
150
set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
151

David Faure's avatar
David Faure committed
152 153
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
154

155 156
# Those are included with e.g. <koproperty/set.h>
set(KOPROPERTY_INCLUDES ${CMAKE_SOURCE_DIR}/libs ${CMAKE_BINARY_DIR}/libs)
157

158 159 160 161 162
if(WIN32)
  set(SHOULD_BUILD_KRITA FALSE)
else(WIN32)
  set(SHOULD_BUILD_KRITA TRUE)
endif(WIN32)
163

164
if(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
165
   set(SHOULD_BUILD_KRITA FALSE)
166
endif(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
167

168
#Check if build kpresenter here to be able to test if we can build filters/kpresenter
169
if(Boost_FOUND)
170
    set(SHOULD_BUILD_KPRESENTER TRUE)
171
else(Boost_FOUND)
172
    set(SHOULD_BUILD_KPRESENTER FALSE)
173
endif(Boost_FOUND)
174

Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
175 176 177
if(WIN32)
    set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR}
                        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
178 179
                        LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS}
                        ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} )
Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
180 181
endif(WIN32)

182
add_subdirectory(libs)
Laurent Montel's avatar
Laurent Montel committed
183
add_subdirectory(interfaces)
Laurent Montel's avatar
Laurent Montel committed
184
add_subdirectory(cmake)
185

186 187
set(SHOULD_BUILD_KARBON TRUE)

188
macro_optional_add_subdirectory(karbon)
189

Michael Jansen's avatar
Michael Jansen committed
190
if(EIGEN2_FOUND)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
191
   macro_optional_add_subdirectory(kspread)
Michael Jansen's avatar
Michael Jansen committed
192
    if(BUILD_kspread)
193
        set(SHOULD_BUILD_KSPREAD TRUE)
Michael Jansen's avatar
Michael Jansen committed
194 195 196 197 198 199
    else(BUILD_kspread)
        set(SHOULD_BUILD_KSPREAD FALSE)
    endif(BUILD_kspread)
else(EIGEN2_FOUND)
    set(SHOULD_BUILD_KSPREAD FALSE)
endif(EIGEN2_FOUND)
200

201
if(SHOULD_BUILD_KPRESENTER)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
202
    macro_optional_add_subdirectory(kpresenter)
203 204
endif(SHOULD_BUILD_KPRESENTER)

Boudewijn Rempt's avatar
Boudewijn Rempt committed
205 206
macro_optional_add_subdirectory(kdgantt)
macro_optional_add_subdirectory(kchart)
207

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

211 212 213 214 215 216
OPTION(BUILD_kexi "Build kexi" FALSE)
if(BUILD_kexi)
    if( BZIP2_EXECUTABLE )
        macro_optional_add_subdirectory(kexi)
    endif( BZIP2_EXECUTABLE )
endif(BUILD_kexi)
217

Boudewijn Rempt's avatar
Boudewijn Rempt committed
218 219 220
macro_optional_add_subdirectory(kformula)
macro_optional_add_subdirectory(kivio)
macro_optional_add_subdirectory(kounavail)
221

222
if(KdepimLibs_FOUND)
223
	macro_optional_add_subdirectory(kplato)
224
endif(KdepimLibs_FOUND)
225

226
macro_optional_add_subdirectory(krita)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
227
macro_optional_add_subdirectory(kword)
Laurent Montel's avatar
Laurent Montel committed
228
add_subdirectory(pics)
229
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
230 231
add_subdirectory(servicetypes)
add_subdirectory(templates)
232 233
add_subdirectory(tools)
add_subdirectory(filters)
234
macro_optional_add_subdirectory(doc)
Laurent Montel's avatar
Laurent Montel committed
235

236
MACRO_DISPLAY_FEATURE_LOG()
237

Stefan Nikolaus's avatar
Stefan Nikolaus committed
238
ADD_CUSTOM_TARGET(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Cyrille Berger's avatar
Cyrille Berger committed
239 240 241

install( FILES
         ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h
Laurent Montel's avatar
Laurent Montel committed
242
         DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)