CMakeLists.txt 9.1 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)
23
macro_optional_find_package(Boost)
Laurent Montel's avatar
Laurent Montel committed
24 25
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
26
macro_optional_find_package(KdepimLibs)
Laurent Montel's avatar
Laurent Montel committed
27
find_package(LCMS REQUIRED)
28
find_package(PNG REQUIRED)
29 30
find_package(CreateResources)
message( STATUS "Create Resources will be required in the final release")
31
macro_optional_find_package(Eigen2)
32
macro_optional_find_package(Blitz)
33
macro_optional_find_package(QCA2)
34
set(EXIV2_MIN_VERSION "0.16")
35 36
macro_optional_find_package(Exiv2)

37
macro_log_feature(EXIV2_FOUND "Exiv2" "Image metadata library and tools" "http://www.exiv2.org" FALSE "0.16" "Required by Krita")
38

39
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)")
40

41
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)")
Laurent Montel's avatar
Laurent Montel committed
42

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

45
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)")
46

47
set(REQUIRED_LCMS_VERSION 115)
48 49 50 51 52 53 54

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})

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

Laurent Montel's avatar
Laurent Montel committed
57 58 59 60 61
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)


Thomas Zander's avatar
Thomas Zander committed
62
#Set the build of TextShape changetraker
63
set(CHANGETRK FALSE)
Thomas Zander's avatar
Thomas Zander committed
64 65 66 67 68
    
if(CHANGETRK)
 add_definitions(-DCHANGETRK)
endif(CHANGETRK)

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

110 111 112
# Look for OpenCTL
macro_optional_find_package(OpenCTL)

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


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

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

# kostore is at the bottom of stack, so it has the dependency on the kde4 includes.
125
set(KOSTORE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/store ${CMAKE_BINARY_DIR}/libs/store ${KDE4_INCLUDES})
David Faure's avatar
David Faure committed
126 127 128 129
# koodf depends on kostore
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf ${CMAKE_BINARY_DIR}/libs/odf ${KOSTORE_INCLUDES})
# 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})
Casper Boemann's avatar
Casper Boemann committed
130
# pigment depends on komain and lcms
131
set(PIGMENT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/pigment ${CMAKE_SOURCE_DIR}/libs/pigment/colorspaces ${CMAKE_SOURCE_DIR}/libs/pigment/colorprofiles ${LCMS_INCLUDE_DIR} )
Casper Boemann's avatar
Casper Boemann committed
132
# flake depends on komain
133
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)
134 135
# koresources depends on pigment
set(KORESOURCES_INCLUDES ${CMAKE_SOURCE_DIR}/libs/resources ${CMAKE_BINARY_DIR}/libs/resources ${PIGMENT_INCLUDES})
136
# koguiutils depends on komain, flake and pigment
137
set(KOGUIUTILS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/guiutils ${CMAKE_BINARY_DIR}/libs/guiutils ${KOMAIN_INCLUDES} ${FLAKE_INCLUDES} ${PIGMENT_INCLUDES} ${KORESOURCES_INCLUDES})
138 139

# The rest must be specified independently, in addition to one of the above three
Thomas Zander's avatar
Thomas Zander committed
140
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)
141
set(KFORMULA_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kformula ${CMAKE_BINARY_DIR}/libs/kformula)
142
set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
David Faure's avatar
David Faure committed
143 144
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
145 146
# Those are included with e.g. <koproperty/set.h>
set(KOPROPERTY_INCLUDES ${CMAKE_SOURCE_DIR}/libs ${CMAKE_BINARY_DIR}/libs)
147

148 149 150 151 152
if(WIN32)
  set(SHOULD_BUILD_KRITA FALSE)
else(WIN32)
  set(SHOULD_BUILD_KRITA TRUE)
endif(WIN32)
153

154
if(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
155
   set(SHOULD_BUILD_KRITA FALSE)
156
endif(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND OR NOT EXIV2_FOUND)
157

158
macro_log_feature(BLITZ_FOUND "Blitz" "Image effect library" "http://www.kde.org" FALSE "" "Required by Krita (available in kdesupport)")
159

160
#Check if build kpresenter here to be able to test if we can build filters/kpresenter
161
if(Boost_FOUND)
162
    set(SHOULD_BUILD_KPRESENTER TRUE)
163
else(Boost_FOUND)
164
    set(SHOULD_BUILD_KPRESENTER FALSE)
165
endif(Boost_FOUND)
166

Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
167 168 169
if(WIN32)
    set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR}
                        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
170 171
                        LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS}
                        ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} )
Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
172 173
endif(WIN32)

174
add_subdirectory(libs)
Laurent Montel's avatar
Laurent Montel committed
175
add_subdirectory(interfaces)
Laurent Montel's avatar
Laurent Montel committed
176
add_subdirectory(cmake)
177

178 179
set(SHOULD_BUILD_KARBON TRUE)

180
macro_optional_add_subdirectory(karbon)
181

Michael Jansen's avatar
Michael Jansen committed
182
if(EIGEN2_FOUND)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
183
   macro_optional_add_subdirectory(kspread)
Michael Jansen's avatar
Michael Jansen committed
184 185 186 187 188 189 190 191
    if(BUILD_kspread)
        set(SHOULD_BUILD_KSPREAD true)
    else(BUILD_kspread)
        set(SHOULD_BUILD_KSPREAD FALSE)
    endif(BUILD_kspread)
else(EIGEN2_FOUND)
    set(SHOULD_BUILD_KSPREAD FALSE)
endif(EIGEN2_FOUND)
192

193
if(SHOULD_BUILD_KPRESENTER)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
194
    macro_optional_add_subdirectory(kpresenter)
195 196
endif(SHOULD_BUILD_KPRESENTER)

Boudewijn Rempt's avatar
Boudewijn Rempt committed
197 198
macro_optional_add_subdirectory(kdgantt)
macro_optional_add_subdirectory(kchart)
199

Laurent Montel's avatar
Laurent Montel committed
200
FIND_PROGRAM(BZIP2_EXECUTABLE NAMES bzip2 )
201

202
macro_log_feature(BZIP2_EXECUTABLE "bzip2" "High-quality data compressor" "http://www.bzip.org" FALSE "" "Required by Kexi")
203

204 205 206 207 208 209
OPTION(BUILD_kexi "Build kexi" FALSE)
if(BUILD_kexi)
    if( BZIP2_EXECUTABLE )
        macro_optional_add_subdirectory(kexi)
    endif( BZIP2_EXECUTABLE )
endif(BUILD_kexi)
210

Boudewijn Rempt's avatar
Boudewijn Rempt committed
211 212 213
macro_optional_add_subdirectory(kformula)
macro_optional_add_subdirectory(kivio)
macro_optional_add_subdirectory(kounavail)
214

215
if(KdepimLibs_FOUND)
216
	macro_optional_add_subdirectory(kplato)
217
endif(KdepimLibs_FOUND)
218

219
macro_optional_add_subdirectory(krita)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
220
macro_optional_add_subdirectory(kword)
Laurent Montel's avatar
Laurent Montel committed
221
add_subdirectory(pics)
222
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
223 224
add_subdirectory(servicetypes)
add_subdirectory(templates)
225 226
add_subdirectory(tools)
add_subdirectory(filters)
227
#macro_optional_add_subdirectory(doc)
Laurent Montel's avatar
Laurent Montel committed
228

229
MACRO_DISPLAY_FEATURE_LOG()
230

Stefan Nikolaus's avatar
Stefan Nikolaus committed
231
ADD_CUSTOM_TARGET(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Cyrille Berger's avatar
Cyrille Berger committed
232 233 234

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