CMakeLists.txt 8.58 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 )

5 6 7 8 9
# 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")

Laurent Montel's avatar
Laurent Montel committed
10
# search packages used by KDE
11 12
set(KDE_MIN_VERSION "4.1.0")
find_package(KDE4 4.1.0 REQUIRED)
13
include(KDE4Defaults)
14
include(MacroLibrary)
15
macro_optional_find_package(Boost)
Laurent Montel's avatar
Laurent Montel committed
16 17
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
18
find_package(KdepimLibs REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
19
find_package(LCMS REQUIRED)
20
find_package(PNG REQUIRED)
21 22
find_package(CreateResources)
message( STATUS "Create Resources will be required in the final release")
23
macro_optional_find_package(Eigen2)
24
macro_optional_find_package(Blitz)
25
macro_optional_find_package(QCA2)
26
macro_optional_find_package(Exif)
27 28
macro_optional_find_package(Freetype)
macro_optional_find_package(Fontconfig)
29

30
macro_log_feature(EIGEN2_FOUND "Eigen2" "Eigen2 is needed by KSpread and Krita. They won't be built." "Module in kdesupport" FALSE "2.0")
31

Johannes Simon's avatar
Johannes Simon committed
32
macro_log_feature(QCA2_FOUND "libqca2" "QCA2 is needed to compile support for encrypted OpenDocument files" "Module in kdesupport" FALSE "2.0" "" )
Laurent Montel's avatar
Laurent Montel committed
33

34 35
macro_log_feature(Boost_FOUND "libboost-dev" "Boost is needed by KPresenter. KPresenter will not be built" "http://www.boost.org" FALSE "")

36 37


38 39 40 41 42 43 44 45 46
set(REQUIRED_LCMS_VERSION 115)

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

macro_log_feature(HAVE_REQUIRED_LCMS_VERSION "lcms" "LittleCMS is required to build KOffice" "http://www.littlecms.com" TRUE "1.15")
47

Laurent Montel's avatar
Laurent Montel committed
48 49 50 51 52
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)


53
add_definitions(-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
David Faure's avatar
David Faure committed
54
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
Laurent Montel's avatar
Laurent Montel committed
55

56 57 58 59 60 61 62 63 64 65 66 67
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
68 69 70

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

72
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
David Faure's avatar
David Faure committed
73 74 75

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

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
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 )

95 96 97
# Look for OpenCTL
macro_optional_find_package(OpenCTL)

98
macro_log_feature(OPENCTL_FOUND "OpenCTL" "OpenCTL is needed for some color spaces (High Dynamic Range Color Spaces, YCbCr and LMS)" "http://www.openctl.org" FALSE "0.9.2")
99
configure_file(config-openctl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openctl.h )
100 101


David Faure's avatar
David Faure committed
102
include (TestBigEndian)
103 104 105
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
configure_file(config-endian.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-endian.h )

106
# for config.h and <toplevel/foo.h> includes (if any?)
Laurent Montel's avatar
Laurent Montel committed
107
include_directories(${QDBUS_INCLUDE_DIRS}  ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
108 109

# kostore is at the bottom of stack, so it has the dependency on the kde4 includes.
110
set(KOSTORE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/store ${CMAKE_BINARY_DIR}/libs/store ${KDE4_INCLUDES})
David Faure's avatar
David Faure committed
111 112 113 114
# 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
115
# pigment depends on komain and lcms
116
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
117
# flake depends on komain
118
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)
119 120
# koresources depends on pigment
set(KORESOURCES_INCLUDES ${CMAKE_SOURCE_DIR}/libs/resources ${CMAKE_BINARY_DIR}/libs/resources ${PIGMENT_INCLUDES})
121
# koguiutils depends on komain, flake and pigment
122
set(KOGUIUTILS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/guiutils ${CMAKE_BINARY_DIR}/libs/guiutils ${KOMAIN_INCLUDES} ${FLAKE_INCLUDES} ${PIGMENT_INCLUDES} ${KORESOURCES_INCLUDES})
123 124

# The rest must be specified independently, in addition to one of the above three
125
set(KOTEXT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kotext/styles ${CMAKE_SOURCE_DIR}/libs/kotext/opendocument ${CMAKE_SOURCE_DIR}/libs/kotext ${CMAKE_BINARY_DIR}/libs/kotext)
126
set(KFORMULA_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kformula ${CMAKE_BINARY_DIR}/libs/kformula)
127
set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
David Faure's avatar
David Faure committed
128 129
# kopageapp
set(KOPAGEAPP_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
130 131
# Those are included with e.g. <koproperty/set.h>
set(KOPROPERTY_INCLUDES ${CMAKE_SOURCE_DIR}/libs ${CMAKE_BINARY_DIR}/libs)
132

133
set(SHOULD_BUILD_KRITA TRUE)
134

135
if(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND)
136
   set(SHOULD_BUILD_KRITA FALSE)
137
endif(NOT BLITZ_FOUND OR NOT EIGEN2_FOUND)
138

139 140
macro_log_feature(BLITZ_FOUND "qimageblitz" "Krita requires qimageblitz. Krita will not be built" "qimageblitz is available from kdesupport" FALSE "")

141
#Check if build kpresenter here to be able to test if we can build filters/kpresenter
142
if(Boost_FOUND)
143
    set(SHOULD_BUILD_KPRESENTER TRUE)
144
else(Boost_FOUND)
145
    set(SHOULD_BUILD_KPRESENTER FALSE)
146
endif(Boost_FOUND)
147

Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
148 149 150
if(WIN32)
    set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR}
                        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
151 152
                        LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS}
                        ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} )
Jarosław Staniek's avatar
fix:  
Jarosław Staniek committed
153 154
endif(WIN32)

155
add_subdirectory(libs)
Laurent Montel's avatar
Laurent Montel committed
156
add_subdirectory(interfaces)
Laurent Montel's avatar
Laurent Montel committed
157
add_subdirectory(cmake)
158

159 160 161
macro_log_feature(FREETYPE_FOUND "FreeType" "Karbon requires FreeType. Karbon will not be built" "http://www.freetype.org" FALSE "")
macro_log_feature(FONTCONFIG_FOUND "Fontconfig" "Karbon requires Fontconfig. Karbon will not be built" "http://fontconfig.org" FALSE "")

162
if(FREETYPE_FOUND AND FONTCONFIG_FOUND )
163
   set(SHOULD_BUILD_KARBON true)
164 165
endif(FREETYPE_FOUND AND FONTCONFIG_FOUND)

166
if(SHOULD_BUILD_KARBON)
167
	macro_optional_add_subdirectory(karbon)
David Faure's avatar
David Faure committed
168
endif(SHOULD_BUILD_KARBON)
169

170

Michael Jansen's avatar
Michael Jansen committed
171
if(EIGEN2_FOUND)
172
    macro_optional_add_subdirectory(kspread)
Michael Jansen's avatar
Michael Jansen committed
173 174 175 176 177 178 179 180
    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)
181

182 183 184 185
if(SHOULD_BUILD_KPRESENTER)
    macro_optional_add_subdirectory(kpresenter)
endif(SHOULD_BUILD_KPRESENTER)

186
macro_optional_add_subdirectory(kdgantt)
187
macro_optional_add_subdirectory(kchart)
188

Laurent Montel's avatar
Laurent Montel committed
189
FIND_PROGRAM(BZIP2_EXECUTABLE NAMES bzip2 )
190 191 192

macro_log_feature(BZIP2_EXECUTABLE "bzip2" "bzip2 program is necessary to compile kexi. kexi will not be built" "http://www.bzip.org" FALSE "")

Laurent Montel's avatar
Laurent Montel committed
193
if( BZIP2_EXECUTABLE )
194
  macro_optional_add_subdirectory(kexi)
Laurent Montel's avatar
Laurent Montel committed
195
endif( BZIP2_EXECUTABLE )
196

197
macro_optional_add_subdirectory(kformula)
198
macro_optional_add_subdirectory(kool)
199 200
macro_optional_add_subdirectory(kivio)
macro_optional_add_subdirectory(kounavail)
201
macro_optional_add_subdirectory(kplato)
202
macro_optional_add_subdirectory(krita)
203
macro_optional_add_subdirectory(kword)
Laurent Montel's avatar
Laurent Montel committed
204
add_subdirectory(pics)
205
add_subdirectory(plugins)
Laurent Montel's avatar
Laurent Montel committed
206 207
add_subdirectory(servicetypes)
add_subdirectory(templates)
208 209
add_subdirectory(tools)
add_subdirectory(filters)
210
macro_optional_add_subdirectory(doc)
Laurent Montel's avatar
Laurent Montel committed
211

212
MACRO_DISPLAY_FEATURE_LOG()
213

Stefan Nikolaus's avatar
Stefan Nikolaus committed
214
ADD_CUSTOM_TARGET(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Cyrille Berger's avatar
Cyrille Berger committed
215 216 217

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