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

3
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
4

5
cmake_policy(SET CMP0002 OLD)
6 7 8 9 10

#cmake_policy CMP0017 was introduced in version 2.8.4
if(${CMAKE_VERSION} VERSION_GREATER 2.8.3)
    cmake_policy(SET CMP0017 NEW)
endif()
Laurent Montel's avatar
Laurent Montel committed
11

12

13 14 15 16 17
 ######################
#######################
## Constants defines ##
#######################
######################
Thomas Zander's avatar
Thomas Zander committed
18

Jigar Raisinghani's avatar
Jigar Raisinghani committed
19 20 21 22 23 24 25 26 27
# define common versions of Calligra applications, used to generate calligraversion.h
# update these version for every release:
set(CALLIGRA_VERSION_STRING "2.9 Pre-Alpha")
set(CALLIGRA_VERSION_MAJOR 2)
set(CALLIGRA_STABLE_VERSION_MINOR 9)
set(CALLIGRA_VERSION_RELEASE 89)  # 89 for Alpha, increase for next test releases, set 0 for first Stable, etc.
set(CALLIGRA_ALPHA 1) # uncomment only for Pre-Alpha and Alpha
#set(CALLIGRA_BETA 1) # uncomment only for Beta
#set(CALLIGRA_RC 1) # uncomment only for RC
28
set(CALLIGRA_YEAR 2014) # update every year
Jigar Raisinghani's avatar
Jigar Raisinghani committed
29 30 31 32 33 34 35

if(NOT DEFINED CALLIGRA_ALPHA AND NOT DEFINED CALLIGRA_BETA AND NOT DEFINED CALLIGRA_RC)
    set(CALLIGRA_STABLE 1) # do not edit
endif()

message(STATUS "Calligra version: ${CALLIGRA_VERSION_STRING}")

Boudewijn Rempt's avatar
Boudewijn Rempt committed
36 37
# define the generic version of the Calligra libraries here
# this makes it easy to advance it when the next Calligra release comes
Jigar Raisinghani's avatar
Jigar Raisinghani committed
38 39 40 41 42 43 44 45
if(CALLIGRA_VERSION_MAJOR EQUAL 2)
    math(EXPR GENERIC_CALLIGRA_LIB_VERSION_MAJOR "${CALLIGRA_STABLE_VERSION_MINOR} + 5")
else()
    # let's make sure we won't forget to update the "5"
    message(FATAL_ERROR "Reminder: please update offset == 5 used to compute GENERIC_CALLIGRA_LIB_VERSION_MAJOR to something bigger")
endif()
set(GENERIC_CALLIGRA_LIB_VERSION "${GENERIC_CALLIGRA_LIB_VERSION_MAJOR}.0.0")
set(GENERIC_CALLIGRA_LIB_SOVERSION "${GENERIC_CALLIGRA_LIB_VERSION_MAJOR}")
46

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

Jigar Raisinghani's avatar
Jigar Raisinghani committed
49 50 51
# fetch git revision for the current build

set(CALLIGRA_GIT_SHA1_STRING "")
52
set(CALLIGRA_GIT_BRANCH_STRING "")
Jigar Raisinghani's avatar
Jigar Raisinghani committed
53 54 55

include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
56
get_git_branch(GIT_BRANCH)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
57

58
if(GIT_SHA1 AND GIT_BRANCH)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
59 60
    string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1)
    set(CALLIGRA_GIT_SHA1_STRING ${GIT_SHA1})
61 62
    set(CALLIGRA_GIT_BRANCH_STRING ${GIT_BRANCH})
endif()
63

64 65 66 67 68
 ########################
#########################
## Product definitions ##
#########################
########################
69 70 71

# There are currently 4 product sets predefined:
# "ACTIVE", "CREATIVE", "DESKTOP", "ALL" (default).
72
# One can define her/his own set, see cmake/productsets/README
73

74 75
# Finding out the products to build is done in 5 steps:
# 1. have the user define the products wanted, by choosing a productset
76 77
# 2. estimate all additional required products
# 3. estimate which of the products can be build by external deps
78 79
# 4. find which products have been temporarily disabled due to problems
# 5. estimate which of the products can be build by internal deps
80 81 82

include(CalligraProductSetMacros)

83 84
if(NOT DEFINED RELEASE_BUILD)
    # estimate mode by CMAKE_BUILD_TYPE content if not set on cmdline
85
    string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
86
    set(RELEASE_BUILD_TYPES "release" "relwithdebinfo" "minsizerel")
87
    list(FIND RELEASE_BUILD_TYPES "${CMAKE_BUILD_TYPE_TOLOWER}" INDEX)
88 89 90 91 92 93 94 95 96
    if (INDEX EQUAL -1)
        set(RELEASE_BUILD FALSE)
    else(INDEX EQUAL -1)
        set(RELEASE_BUILD TRUE)
    endif(INDEX EQUAL -1)
endif(NOT DEFINED RELEASE_BUILD)
message(STATUS "Release build: ${RELEASE_BUILD}")

if (RELEASE_BUILD)
97
    set(CALLIGRA_SHOULD_BUILD_STAGING FALSE)
98 99 100 101
else (RELEASE_BUILD)
    set(CALLIGRA_SHOULD_BUILD_STAGING TRUE)
endif (RELEASE_BUILD)

Jigar Raisinghani's avatar
Jigar Raisinghani committed
102 103 104 105 106
 ############
#############
## Options ##
#############
############
107

Jigar Raisinghani's avatar
Jigar Raisinghani committed
108
option(USEOPENGL "Allow the use of OpenGL for Krita" ON)
109 110 111
if (WIN32)
    option(USE_BREAKPAD "Build the crash handler for Krita (only on windows)" OFF)
endif (WIN32)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
112
option(GHNS "support Get Hot New Stuff" OFF)
113 114 115
# TODO: orthogonal setting, results in minimal features, yet needs to be defined
# option(TINY "compile a tiny Calligra" OFF)
option(QT3SUPPORT "Build the parts of Calligra that still depend on Qt3" ON)
116
option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only." ON)
117 118 119 120 121 122 123 124 125 126 127 128

# TODO: remove option and migration code below before 3.0 release
option(CREATIVEONLY "compile only Karbon and Krita" OFF)

# temporary migration support
set(PRODUCTSET_DEFAULT "ALL")
if (CREATIVEONLY)
    set(WARN_ABOUT_CREATIVEONLY TRUE)
    set(PRODUCTSET_DEFAULT "CREATIVE")
endif (CREATIVEONLY)

if(NOT PRODUCTSET)
129
    set(PRODUCTSET ${PRODUCTSET_DEFAULT} CACHE STRING "Set of products to build" FORCE)
130 131 132 133 134 135 136
endif(NOT PRODUCTSET)

# TODO: also add headers/sdk for all the libs ("_DEVEL"?)
# TODO: note external deps for products, so they are only checked if needed
# There can be required or optional external deps, required will also result
# in automatic disabling of product building
# TODO: some products have multiple optional requirements, but need at least one.
137
# See CONVERTER, EXTRA_*
138 139

# 3rd-party libs
140 141
calligra_define_product(LIB_KDGANTT "libkdgantt")
calligra_define_product(LIB_KDCHART "libkdchart")
142 143
# building tools
calligra_define_product(RNG2CPP "rng2cpp")
144
# Calligra-independent utility libs
145
calligra_define_product(LIB_KOVECTORIMAGE "libkovectorimage")
146 147 148
calligra_define_product(LIB_KOPROPERTY "libkoproperty")
calligra_define_product(LIB_KOREPORT "libkoreport" NEEDS LIB_KOPROPERTY)
calligra_define_product(LIB_CALLIGRADB "libcalligradb")
149
# calligra libs
150
calligra_define_product(CALLIGRA_LIBS "Calligra core libs"  NEEDS RNG2CPP)
151
calligra_define_product(LIB_KOPAGEAPP "Lib for paged documents"  NEEDS CALLIGRA_LIBS)
152
calligra_define_product(LIB_KOODF2 "libkoodf2"  NEEDS CALLIGRA_LIBS)
153
calligra_define_product(LIB_KOODFREADER "libkoodfreader"  NEEDS LIB_KOODF2 CALLIGRA_LIBS)
154
calligra_define_product(LIB_MSO "libmso"  NEEDS CALLIGRA_LIBS)
155
calligra_define_product(LIB_KOMSOOXML "libkomsooxml"  NEEDS LIB_KOODF2 CALLIGRA_LIBS)
156 157
calligra_define_product(SCRIPTING "Scripting feature") # TODO
calligra_define_product(RDF "RDF feature")
158
# plugins
Jigar Raisinghani's avatar
Jigar Raisinghani committed
159
calligra_define_product(PLUGIN_TEXTSHAPE "Text shape plugin"  NEEDS CALLIGRA_LIBS)
160
# apps
161
calligra_define_product(WORDS_PART "Words engine" NEEDS CALLIGRA_LIBS PLUGIN_TEXTSHAPE)
162
calligra_define_product(WORDS_APP "Words executable (for Desktop)"  NEEDS WORDS_PART)
163
calligra_define_product(STAGE_PART "Stage engine"  NEEDS CALLIGRA_LIBS LIB_KOPAGEAPP)
164
calligra_define_product(STAGE_APP "Stage executable (for Desktop)"  NEEDS STAGE_PART)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
165
calligra_define_product(SHEETS_PART "Sheets engine"  NEEDS CALLIGRA_LIBS SCRIPTING)
166
calligra_define_product(SHEETS_APP "Sheets executable (for Desktop)"  NEEDS SHEETS_PART)
167 168
calligra_define_product(AUTHOR_APP "Full Author (for Desktop)"  NEEDS WORDS_PART)
calligra_define_product(KARBON_APP "Full Karbon (for Desktop)"  NEEDS CALLIGRA_LIBS)
169
calligra_define_product(KRITA_APP "Full Krita (for Desktop)"  NEEDS CALLIGRA_LIBS)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
170
calligra_define_product(KEXI_APP "Full Kexi (for Desktop)"  NEEDS CALLIGRA_LIBS LIB_KOREPORT LIB_CALLIGRADB SCRIPTING)
171
calligra_define_product(FLOW_APP "Full Flow (for Desktop)"  NEEDS CALLIGRA_LIBS LIB_KOPAGEAPP)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
172
calligra_define_product(PLAN_APP "Full Plan (for Desktop)"  NEEDS CALLIGRA_LIBS LIB_KOREPORT LIB_KDCHART LIB_KDGANTT SCRIPTING)
173
calligra_define_product(BRAINDUMP_APP "Full Braindump (for Desktop)"  NEEDS CALLIGRA_LIBS)
174
calligra_define_product(DOC "Calligra Documentations")
175
# extras
176 177 178
calligra_define_product(CONVERTER "Format converter for commandline"  NEEDS CALLIGRA_LIBS)
calligra_define_product(EXTRA_PROPERTIES "Plugin for the KDE file properties dialog"  NEEDS CALLIGRA_LIBS)
calligra_define_product(EXTRA_THUMBNAIL "Plugins for KDE filesystem thumbnailing"  NEEDS CALLIGRA_LIBS)
179 180
calligra_define_product(EXTRA_QUICKPRINT "Plugin for the filemanager adding a \"Print\" action")
calligra_define_product(EXTRA_FILEMANAGER_TEMPLATES "File templates for filemanager")
181
calligra_define_product(OKULARODPGENERATOR "Plugin for Okular adding support for ODP" NEEDS STAGE_PART)
182
calligra_define_product(OKULAR_GENERATOR_ODT "Plugin for Okular adding support for ODT" NEEDS WORDS_PART)
183
# more plugins
Jigar Raisinghani's avatar
Jigar Raisinghani committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197
calligra_define_product(PLUGIN_COLORENGINES "Colorengine plugins"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_MUSICSHAPE "Music shape plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_SPACENAVIGATOR "SpaceNavigator input plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_ARTISTICTEXTSHAPE "Artistic shape plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_DOCKERS "Default dockers plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_TEXTEDITING "Textediting plugins"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_KEXI_SPREADSHEETMIGRATION "Import from ODS plugin for Kexi"  NEEDS KEXI_APP SHEETS_PART)
calligra_define_product(PLUGIN_DEFAULTTOOLS "Default Flake tools plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_PATHSHAPES "Path shape plugins"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_VARIABLES "Text variables plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_CHARTSHAPE "Chart shape plugin" NEEDS CALLIGRA_LIBS LIB_KDCHART)
calligra_define_product(PLUGIN_PICTURESHAPE "Picture shape plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_PLUGINSHAPE "Plugin shape plugin"  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_FORMULASHAPE "Formula shape plugin"  NEEDS CALLIGRA_LIBS)
198
calligra_define_product(PLUGIN_VIDEOSHAPE "Plugin for handling videos in Calligra"  NEEDS CALLIGRA_LIBS)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
199 200
calligra_define_product(PLUGIN_VECTORSHAPE "Vectorgraphic shape plugin" NEEDS CALLIGRA_LIBS LIB_KOVECTORIMAGE)
calligra_define_product(PLUGIN_REPORTING "Renderer plugins for libkoreport"  NEEDS LIB_KOREPORT LIB_KDCHART)
201
calligra_define_product(PLUGIN_SEMANTICITEMS "Semantic items plugins"  NEEDS RDF CALLIGRA_LIBS)
202
# staging plugins
Jigar Raisinghani's avatar
Jigar Raisinghani committed
203 204 205
calligra_define_product(PLUGIN_GOOGLEDOCS "Plugin for integration with Google Docs" STAGING  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_THREEDSHAPE "3D shape plugin"  STAGING  NEEDS CALLIGRA_LIBS)
calligra_define_product(PLUGIN_SHEETS_PIVOTTABLES "Plugin for Sheets adding pivot tables"  STAGING  NEEDS SHEETS_PART)
206
# Sheets filters
207 208 209
calligra_define_product(FILTER_XLSX_TO_ODS "XLSX to ODS filter" NEEDS LIB_KOMSOOXML SHEETS_PART)
calligra_define_product(FILTER_XLS_TO_SHEETS "Sheets XLS import filter" NEEDS LIB_MSO LIB_KOMSOOXML SHEETS_PART)
calligra_define_product(FILTER_SHEETS_TO_XLS "Sheets XLS export filter" NEEDS LIB_MSO LIB_KOMSOOXML SHEETS_PART)
210 211 212 213 214 215 216 217 218 219 220 221
calligra_define_product(FILTER_CSV_TO_SHEETS "Sheets CSV import filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_SHEETS_TO_CSV "Sheets CSV export filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_APPLIXSPREAD_TO_KSPREAD "Applix Spreadsheet to KSpread filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_DBASE_TO_KSPREAD "dBASE to KSpread filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_GNUMERIC_TO_SHEETS "Sheets GNUMERIC import filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_SHEETS_TO_GNUMERIC "Sheets GNUMERIC import filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_OPENCALC_TO_SHEETS "Sheets OpenOffice.org Calc import filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_SHEETS_TO_OPENCALC "Sheets OpenOffice.org Calc export filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_QUATTROPRO_TO_SHEETS "Sheets Quattro Pro import filter" NEEDS SHEETS_PART)
calligra_define_product(FILTER_HTML_TO_ODS "HTML to ODS filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_SHEETS_TO_HTML "Sheets HTML export filter"  NEEDS SHEETS_PART)
calligra_define_product(FILTER_KSPREAD_TO_LATEX "KSpread to LaTeX filter"  NEEDS CALLIGRA_LIBS)
222 223 224
calligra_define_product(FILTER_SHEETS_IMPORT "All Sheets import filters"  WANTS FILTER_XLSX_TO_ODS FILTER_XLS_TO_SHEETS FILTER_CSV_TO_SHEETS FILTER_APPLIXSPREAD_TO_KSPREAD FILTER_DBASE_TO_KSPREAD FILTER_GNUMERIC_TO_SHEETS FILTER_OPENCALC_TO_SHEETS FILTER_QUATTROPRO_TO_SHEETS FILTER_HTML_TO_ODS)
calligra_define_product(FILTER_SHEETS_EXPORT "All Sheets export filters"  WANTS FILTER_SHEETS_TO_XLS FILTER_SHEETS_TO_CSV FILTER_SHEETS_TO_GNUMERIC FILTER_SHEETS_TO_OPENCALC FILTER_SHEETS_TO_HTML FILTER_KSPREAD_TO_LATEX)
calligra_define_product(FILTER_SHEETS "All Sheets filters"  WANTS FILTER_SHEETS_IMPORT FILTER_SHEETS_EXPORT)
225
# Flow filters
Jigar Raisinghani's avatar
Jigar Raisinghani committed
226 227
calligra_define_product(FILTER_VISIO_TO_ODG "Visio to ODG filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_WPG_TO_ODG "WPG to ODG filter"  NEEDS CALLIGRA_LIBS)
228 229 230
calligra_define_product(FILTER_FLOW_IMPORT "All Flow import filters"  WANTS FILTER_VISIO_TO_ODG FILTER_WPG_TO_ODG)
calligra_define_product(FILTER_FLOW_EXPORT "All Flow export filters"  WANTS )
calligra_define_product(FILTER_FLOW "All Flow filters"  WANTS FILTER_FLOW_IMPORT FILTER_FLOW_EXPORT)
231
# Stage filters
Jigar Raisinghani's avatar
Jigar Raisinghani committed
232
calligra_define_product(FILTER_KEY_TO_ODP "Apple Keynote to ODP filter"  NEEDS CALLIGRA_LIBS)
233
calligra_define_product(FILTER_KPR_TO_ODP "KPresenter to ODP filter"  NEEDS CALLIGRA_LIBS)
234
calligra_define_product(FILTER_PPT_TO_ODP "PPT to OPD filter" NEEDS LIB_MSO CALLIGRA_LIBS)
235
calligra_define_product(FILTER_PPTX_TO_ODP "PPTX to ODP filter" NEEDS LIB_KOMSOOXML LIB_KOODF2 CALLIGRA_LIBS)
236
calligra_define_product(FILTER_STAGE_IMPORT "All Stage import filters"  WANTS FILTER_KEY_TO_ODP FILTER_KPR_TO_ODP FILTER_PPT_TO_ODP FILTER_PPTX_TO_ODP)
237 238
calligra_define_product(FILTER_STAGE_EXPORT "All Stage export filters"  WANTS )
calligra_define_product(FILTER_STAGE "All Stage filters"  WANTS FILTER_STAGE_IMPORT FILTER_STAGE_EXPORT)
239
# Words filters
240 241
calligra_define_product(FILTER_DOC_TO_ODT "DOC to ODT filter" NEEDS LIB_MSO LIB_KOMSOOXML CALLIGRA_LIBS)
calligra_define_product(FILTER_DOCX_TO_ODT "DOCX to ODT filter" NEEDS LIB_KOMSOOXML LIB_KOODF2 CALLIGRA_LIBS)
242
calligra_define_product(FILTER_ODT_TO_DOCX "ODT to DOCX filter" NEEDS LIB_KOODFREADER LIB_KOODF2 CALLIGRA_LIBS)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
243 244
calligra_define_product(FILTER_WORDPERFECT_TO_ODT "Word Perfect to ODT filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_WORKS_TO_ODT "MS Works to ODT filter"  NEEDS CALLIGRA_LIBS)
245
calligra_define_product(FILTER_APPLIXWORD_TO_ODT "Applixword to ODT filter"  NEEDS CALLIGRA_LIBS)
246
calligra_define_product(FILTER_ASCII_TO_WORDS "Words ASCII import filter"  NEEDS WORDS_PART LIB_KOODF2)
247
calligra_define_product(FILTER_ODT_TO_ASCII "ODT to ASCII filter"  NEEDS LIB_KOODFREADER CALLIGRA_LIBS)
248 249
calligra_define_product(FILTER_RTF_TO_ODT "RTF to ODT filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_ODT_TO_MOBI "Mobi export filter"  NEEDS CALLIGRA_LIBS)
250 251
calligra_define_product(FILTER_ODT_TO_EPUB2 "ODT Epub2 export filter"  NEEDS LIB_KOVECTORIMAGE CALLIGRA_LIBS)
calligra_define_product(FILTER_ODT_TO_HTML "ODT HTML export filter"  NEEDS LIB_KOVECTORIMAGE CALLIGRA_LIBS)
252
calligra_define_product(FILTER_WORDS_IMPORT "All Words import filters"  WANTS FILTER_DOC_TO_ODT FILTER_DOCX_TO_ODT FILTER_WORDPERFECT_TO_ODT FILTER_WORKS_TO_ODT FILTER_APPLIXWORD_TO_ODT FILTER_ASCII_TO_WORDS FILTER_RTF_TO_ODT)
253
calligra_define_product(FILTER_WORDS_EXPORT "All Words export filters"  WANTS FILTER_ODT_TO_ASCII FILTER_ODT_TO_MOBI FILTER_ODT_TO_EPUB2 FILTER_ODT_TO_HTML FILTER_ODT_TO_DOCX)
254
calligra_define_product(FILTER_WORDS "All Words filters"  WANTS FILTER_WORDS_IMPORT FILTER_WORDS_EXPORT)
255 256
# Plan filters
calligra_define_product(FILTER_MPXJ_IMPORT "MS Project import filter"  NEEDS PLAN_APP)
257
calligra_define_product(FILTER_PLAN "All Plan filters" WANTS FILTER_MPXJ_IMPORT)
258
# Karbon filters
259 260 261 262
calligra_define_product(FILTER_EPS_TO_SVG_AI "EPS to SVG/AI filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_XFIG_TO_ODG "XFig to ODG filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_PDF_TO_SVG "PDF to SVG filter"  NEEDS CALLIGRA_LIBS)
calligra_define_product(FILTER_WPG_TO_SVG "WPG to SVG filter"  NEEDS CALLIGRA_LIBS)
263 264 265 266
calligra_define_product(FILTER_KARBON_TO_IMAGE "Karbon image export filter"  NEEDS KARBON_APP)
calligra_define_product(FILTER_KARBON_TO_SVG "Karbon SVG export filter"  NEEDS KARBON_APP)
calligra_define_product(FILTER_SVG_TO_KARBON "Karbon SVG import filter"  NEEDS KARBON_APP)
calligra_define_product(FILTER_KARBON_TO_WMF "Karbon WMF export filter"  NEEDS KARBON_APP)
267
calligra_define_product(FILTER_WMF_TO_SVG "WMF to SVG filter"  NEEDS LIB_KOVECTORIMAGE CALLIGRA_LIBS)
268
calligra_define_product(FILTER_KARBON1X_TO_KARBON "Karbon 1.x import filter"  NEEDS KARBON_APP)
269 270 271
calligra_define_product(FILTER_KARBON_IMPORT "All Karbon import filters"  WANTS FILTER_EPS_TO_SVG_AI FILTER_XFIG_TO_ODG FILTER_PDF_TO_SVG FILTER_WPG_TO_SVG FILTER_SVG_TO_KARBON FILTER_WMF_TO_SVG FILTER_KARBON1X_TO_KARBON)
calligra_define_product(FILTER_KARBON_EXPORT "All Karbon export filters"  WANTS FILTER_KARBON_TO_IMAGE FILTER_KARBON_TO_SVG FILTER_KARBON_TO_WMF)
calligra_define_product(FILTER_KARBON "All Karbon filters"  WANTS FILTER_KARBON_IMPORT FILTER_KARBON_EXPORT)
272
# meta apps
273
calligra_define_product(WORDS "Full Words (for Desktop)"  NEEDS WORDS_APP  WANTS FILTER_WORDS PLUGIN_SEMANTICITEMS)
274
calligra_define_product(STAGE "Full Stage (for Desktop)"  NEEDS STAGE_APP  WANTS FILTER_STAGE)
275 276
calligra_define_product(SHEETS "Full Sheets (for Desktop)"  NEEDS SHEETS_APP  WANTS FILTER_SHEETS PLUGIN_SHEETS_PIVOTTABLES)
calligra_define_product(AUTHOR "Full Author (for Desktop)"  NEEDS AUTHOR_APP  WANTS FILTER_WORDS PLUGIN_SEMANTICITEMS)
277
calligra_define_product(KARBON "Full Karbon (for Desktop)"  NEEDS KARBON_APP  WANTS FILTER_KARBON)
278
calligra_define_product(KRITA "Full Krita (for Desktop)"  NEEDS KRITA_APP)
279
calligra_define_product(KEXI "Full Kexi (for Desktop)"  NEEDS KEXI_APP  WANTS PLUGIN_KEXI_SPREADSHEETMIGRATION PLUGIN_REPORTING)
280 281 282 283
calligra_define_product(FLOW "Full Flow (for Desktop)"  NEEDS FLOW_APP  WANTS FILTER_FLOW)
calligra_define_product(PLAN "Full Plan (for Desktop)"  NEEDS PLAN_APP  WANTS FILTER_PLAN)
calligra_define_product(BRAINDUMP "Full Braindump (for Desktop)"  NEEDS BRAINDUMP_APP)
calligra_define_product(ACTIVE "Calligra Active"  NEEDS SHEETS_PART STAGE_PART WORDS_PART)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
284
calligra_define_product(CALLIGRA "General Calligra program starter"  NEEDS CALLIGRA_LIBS)
285 286 287
# more extras
calligra_define_product(OKULARGENERATOR_PPT "Plugin for Okular extended with support for PPT" NEEDS OKULARODPGENERATOR FILTER_PPT_TO_ODP)
calligra_define_product(OKULARGENERATOR_PPTX "Plugin for Okular extended with support for PPTX" NEEDS OKULARODPGENERATOR FILTER_PPTX_TO_ODP)
288 289
calligra_define_product(OKULAR_GENERATOR_DOC "Plugin for Okular extended with support for DOC" NEEDS OKULAR_GENERATOR_ODT FILTER_DOC_TO_ODT)
calligra_define_product(OKULAR_GENERATOR_DOCX "Plugin for Okular extended with support for DOCX" NEEDS OKULAR_GENERATOR_ODT FILTER_DOCX_TO_ODT)
290
# developer utils
291
calligra_define_product(DEVTOOLS "Tools for developers")
Jigar Raisinghani's avatar
Jigar Raisinghani committed
292
calligra_define_product(CSTESTER "cstester " NEEDS SHEETS_PART STAGE_PART WORDS_PART)
293

294 295 296 297 298 299
# For new products see cmake/productsets/README, "How to add another product?"

#############################################
####      Choose products to build       ####
#############################################

300
calligra_set_productset(${PRODUCTSET})
301

302 303 304 305 306
 ########################
#########################
## Look for KDE and Qt ##
#########################
########################
307 308
set(KDE_MIN_VERSION "4.3.0")
find_package(KDE4 4.3.0 REQUIRED)
Cyrille Berger's avatar
Cyrille Berger committed
309

310
if (QT3SUPPORT)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
311
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus Qt3Support)
312
else (QT3SUPPORT)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
313
    find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtXml QtScript QtSvg QtTest QtWebKit QtDBus)
314
endif (QT3SUPPORT)
315

Jigar Raisinghani's avatar
Jigar Raisinghani committed
316 317 318 319 320
if (USEOPENGL)
    find_package(Qt4 4.6.0 REQUIRED QtOpenGL)
endif (USEOPENGL)


321 322
include (KDE4Defaults)
include (MacroLibrary)
323 324 325
include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)

326 327
if ((${QTVERSION} VERSION_EQUAL 4.8.0) OR (${QTVERSION} VERSION_EQUAL 4.8.1))
    if (NOT IHAVEPATCHEDQT)
328 329
        set(SHOULD_BUILD_WORDS_PART FALSE)
        set(SHOULD_BUILD_STAGE_PART FALSE)
330 331
        set(SHOULD_BUILD_PLUGIN_TEXTSHAPE FALSE)
        set(SHOULD_BUILD_PLUGIN_TEXTEDITING FALSE)
332 333 334 335
        MESSAGE(STATUS "WARNING: You are using a version of Qt that causes crashes. As a result Words and Stage will not be built. Please upgrade to 4.8.2. You can also patch Qt and when building Calligra set IHAVEPATCHEDQT. Patch against Qt can be found in qt48setx.patch")
    endif (NOT IHAVEPATCHEDQT)
endif ((${QTVERSION} VERSION_EQUAL 4.8.0) OR (${QTVERSION} VERSION_EQUAL 4.8.1))

Boudewijn Rempt's avatar
Boudewijn Rempt committed
336 337 338 339
if (GHNS)
    if(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
        set(GHNS FALSE)
    endif(NOT ${KDE_VERSION} VERSION_GREATER 4.4.0)
340

Boudewijn Rempt's avatar
Boudewijn Rempt committed
341 342
    macro_optional_find_package(LibAttica)
    macro_log_feature(LIBATTICA_FOUND "LibAttica" "Attica is used for Get Hot New Stuff." "https://projects.kde.org/projects/kdesupport/attica" FALSE "" "You need at least version 3.0 for uploading of resources to work.")
343

Boudewijn Rempt's avatar
Boudewijn Rempt committed
344 345 346 347 348 349
    if (NOT LIBATTICA_FOUND)
        set(GHNS FALSE)
    else (NOT LIBATTICA_FOUND)
        MESSAGE(STATUS "WARNING: You are compiling with Get Hot New Stuff enabled. Do not do that when building distribution packages. GHNS is unusable these days until someone starts maintaining it again.")
    endif (NOT LIBATTICA_FOUND)
endif (GHNS)
350

351 352
macro_ensure_out_of_source_build("Compiling Calligra inside the source directory is not possible. Please refer to the build instruction http://community.kde.org/Calligra/Building/Building_Calligra")

353 354 355 356 357
if(KDE4_BUILD_TESTS)
    # only with this definition will the FOO_TEST_EXPORT macro do something
    add_definitions(-DCOMPILING_TESTS)
endif(KDE4_BUILD_TESTS)

358 359 360 361 362 363 364 365 366 367 368 369 370
# overcome some platform incompatibilities
if(WIN32)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks)
    add_definitions(-D_USE_MATH_DEFINES)
    add_definitions(-DNOMINMAX)
    set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib)
endif(WIN32)

add_definitions(
    -DQT_USE_FAST_CONCATENATION
    -DQT_USE_FAST_OPERATOR_PLUS
)

371 372 373 374 375 376 377 378
# would need more code changes before 4.8.0, e.g. with qPrintable()
if(NOT ${QTVERSION} VERSION_LESS 4.8.0)
    # enable QStringBuilder enhancement
    add_definitions(
        -DQT_USE_FAST_CONCATENATION
        -DQT_USE_FAST_OPERATOR_PLUS
    )
endif(NOT ${QTVERSION} VERSION_LESS 4.8.0)
379 380


381 382 383 384 385
 ###########################
############################
## Required dependencies  ##
############################
###########################
386

Laurent Montel's avatar
Laurent Montel committed
387 388
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
389
find_package(PNG REQUIRED)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
390 391 392 393
if (APPLE)
    # this is not added correctly on OSX -- see http://forum.kde.org/viewtopic.php?f=139&t=101867&p=221242#p221242
    include_directories(${PNG_INCLUDE_DIR})
endif(APPLE)
394 395
find_package(Boost REQUIRED) # for pigment and stage
if (NOT Boost_FOUND)
396
    MESSAGE(FATAL_ERROR "Did not find Boost. Boost is required for the core libraries, stage, sheets and krita.")
397
endif (NOT Boost_FOUND)
398

399 400 401
if (APPLE)
   find_package(Carbon REQUIRED)
endif (APPLE)
402

403 404 405 406 407 408
 ###########################
############################
## Optional dependencies  ##
############################
###########################

409 410 411 412
##
## Test for sqlite
##
set(SQLITE_MIN_VERSION 3.6.16)
Jarosław Staniek's avatar
Jarosław Staniek committed
413
set(SQLITE_RECOMMENDED_VERSION 3.8.4)
414
set(SQLITE_LOAD_EXTENSION_REQUIRED ON)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
415
macro_optional_find_package(CalligraSqlite ${SQLITE_MIN_VERSION})
416
macro_bool_to_01(SQLITE_FOUND HAVE_SQLITE)
417
macro_log_feature(SQLITE_FOUND "SQLite" "Embedded SQL database engine with enabled extensions loading"
418 419
                  "http://www.sqlite.org" FALSE "${SQLITE_MIN_VERSION}"
                  "Required by Calligra's default database handler for Kexi and bibliography in Words.")
420

421 422 423
##
## Test for ICU
##
424 425
macro_optional_find_package(ICU)
macro_bool_to_01(ICU_FOUND HAVE_ICU)
426
macro_log_feature(ICU_FOUND "ICU" "International Components for Unicode (ICU) Library"
427 428
                  "http://icu-project.org" FALSE ""
                  "Required by Calligra's default database handler for Kexi and Words.")
429

430
##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
431
## Check for OpenEXR
432
##
433

434 435
macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
436

437 438 439
##
## Look for OpenGL
##
440
set(HAVE_OPENGL 0)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
441 442
if (USEOPENGL)
    macro_optional_find_package(OpenGL)
443

Jigar Raisinghani's avatar
Jigar Raisinghani committed
444 445 446 447 448 449 450 451 452 453 454 455 456
    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)
    macro_log_feature(HAVE_OPENGL "OpenGL" "OpenGL support" "" FALSE "" "Required by parts of Krita and optionally by flake")
endif(USEOPENGL)
457

458

459 460 461
##
## Test for kdepimlibs
##
462
macro_optional_find_package(KdepimLibs 4.6.0)
463
macro_log_feature(KDEPIMLIBS_FOUND "KDE PIMLibs" "KDE Personal Information Management Libraries" "http://www.kde.org/" FALSE "" "Required by Plan and the KDE address book integration (available as a module in KDE)")
464

465 466 467 468
##
## Test for eigen2
##
macro_optional_find_package(Eigen2)
469
macro_log_feature(EIGEN2_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "2.0" "Required by Calligra Sheets and Krita")
470

471 472 473
##
## Test for QCA2
##
474
macro_optional_find_package(QCA2)
475
macro_log_feature(QCA2_FOUND "QCA" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0" "Required for encrypted OpenDocument files and encrypted xls files support (available as a module in kdesupport)")
476

477 478 479
##
## Test for exiv2
##
480 481 482
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")
483

484 485 486 487 488 489 490
##
## Test for soprano
##
macro_optional_find_package(Soprano)
macro_log_feature(Soprano_FOUND "Soprano" "KDE4 RDF handling library" "http://soprano.sourceforge.net/" FALSE "" "Required to handle RDF metadata in ODF")
if(NOT Soprano_FOUND)
    set(SOPRANO_INCLUDE_DIR "")
491
endif(NOT Soprano_FOUND)
492 493


494 495 496 497
##
## Test for marble
##
macro_optional_find_package(Marble)
498
macro_log_feature(MARBLE_FOUND "Marble" "KDE4 World Globe Widget library" "http://techbase.kde.org/Projects/Marble/" FALSE "" "Required by RDF, Kexi Forms and Reports to show locations on a map")
499 500 501 502 503
if(NOT MARBLE_FOUND)
    set(CAN_USE_MARBLE FALSE)
    set(MARBLE_INCLUDE_DIR "")
else(NOT MARBLE_FOUND)
    set(CAN_USE_MARBLE TRUE)
Christoph Feck's avatar
Christoph Feck committed
504
endif(NOT MARBLE_FOUND)
505
if( MARBLE_FOUND )
506 507 508 509 510
    add_definitions( -DCAN_USE_MARBLE )
    ##
    ## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
    ## with commit ea177ca. This is for compatibility with older versions.
    ##
511
    find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble)
512
    if( MARBLECONTROLBOX_H )
513 514
    file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
    string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
515 516 517
        if( SETMARBLEWIDGET )
            add_definitions(-DHAVE_SETMARBLEWIDGET)
        endif( SETMARBLEWIDGET)
518 519
    else( MARBLECONTROLBOX_H )
        message( WARNING "MarbleControlBox.h not found, could not properly set the SETMARBLEWIDGET define." )
520
    endif( MARBLECONTROLBOX_H )
521 522
endif( MARBLE_FOUND )

523 524
##
## Test for lcms
525
##
526
macro_optional_find_package(LCMS2)
527
macro_log_feature(LCMS2_FOUND "LittleCMS" "Color management engine" "http://www.littlecms.com" FALSE "2.4" "Will be used for color management and is necesary for Krita")
528
if(LCMS2_FOUND)
529
    if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
530
        set(HAVE_LCMS24 TRUE)
531
    endif(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
532
    set(HAVE_REQUIRED_LCMS_VERSION TRUE)
533
    set(HAVE_LCMS2 TRUE)
534 535
endif(LCMS2_FOUND)

536 537 538 539 540 541
##
## Test for Vc
##

set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} )
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
542
macro_optional_find_package(Vc 0.6.70)
543 544
macro_log_feature(Vc_FOUND "Vc" "Portable, zero-overhead SIMD library for C++" "http://code.compeng.uni-frankfurt.de/projects/vc" FALSE "" "Required by the Krita for vectorization")
macro_bool_to_01(Vc_FOUND HAVE_VC)
545 546
macro_bool_to_01(PACKAGERS_BUILD DO_PACKAGERS_BUILD)

547 548 549 550 551 552
configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h )

if(HAVE_VC)
    message(STATUS "Vc found!")

    SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Vc_CMAKE_MODULES_DIR}")
553 554
    include (VcMacros)

555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
    #Handle Vc master
    if(Vc_VERSION_MAJOR GREATER 0 OR Vc_VERSION_MINOR GREATER 7)
        message(STATUS "Vc version is greater than 0.7, enabling AVX2 support")

        if(Vc_COMPILER_IS_GCC)
            AddCompilerFlag("-std=c++11" _ok)
            if(NOT _ok)
                AddCompilerFlag("-std=c++0x" _ok)
            endif()
        endif(Vc_COMPILER_IS_GCC)

        macro(ko_compile_for_all_implementations_no_scalar _objs _src)
        if(PACKAGERS_BUILD)
            vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY SSE2 SSSE3 SSE4_1 AVX AVX2)
        else(PACKAGERS_BUILD)
            set(${_objs} ${_src})
        endif(PACKAGERS_BUILD)
        endmacro()

        macro(ko_compile_for_all_implementations _objs _src)
        if(PACKAGERS_BUILD)
            vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY Scalar SSE2 SSSE3 SSE4_1 AVX AVX2)
        else(PACKAGERS_BUILD)
            set(${_objs} ${_src})
        endif(PACKAGERS_BUILD)
        endmacro()
    else()
        macro(ko_compile_for_all_implementations_no_scalar _objs _src)
        if(PACKAGERS_BUILD)
            vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY SSE2 SSSE3 SSE4_1 AVX)
        else(PACKAGERS_BUILD)
            set(${_objs} ${_src})
        endif(PACKAGERS_BUILD)
        endmacro()

        macro(ko_compile_for_all_implementations _objs _src)
        if(PACKAGERS_BUILD)
            vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY Scalar SSE2 SSSE3 SSE4_1 AVX)
        else(PACKAGERS_BUILD)
            set(${_objs} ${_src})
        endif(PACKAGERS_BUILD)
        endmacro()
    endif()
598

599 600 601 602
    if (NOT PACKAGERS_BUILD)
      # Optimize the whole Calligra for current architecture
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}")
    endif (NOT PACKAGERS_BUILD)
603 604 605
endif(HAVE_VC)
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH} )

606 607 608 609 610 611 612 613 614
##
## Test for Xinput
##
if(NOT WIN32)
  set(REQUIRED_Xinput_FOUND ${X11_Xinput_FOUND})
else(NOT WIN32)
  set(REQUIRED_Xinput_FOUND TRUE)
endif(NOT WIN32)

615 616 617
##
## Test for KActivities
##
618
macro_optional_find_package(KActivities 6.1.0)
619 620 621 622 623
macro_log_feature(KActivities_FOUND "KActivities" "Activities interface library" "https://projects.kde.org/projects/kde/kdelibs/kactivities" FALSE "" "Required for Activities integration.")
if(KActivities_FOUND)
    set(HAVE_KACTIVITIES TRUE)
endif(KActivities_FOUND)

Thomas Zander's avatar
Thomas Zander committed
624 625
#Set the build of TextShape changetraker

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

628
if(WIN32)
629 630 631 632 633 634 635 636 637 638 639 640 641 642
    # 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} )


643 644 645 646
else(WIN32)
    set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)

Hanzes Matus's avatar
Hanzes Matus committed
647 648 649
##
## Test for Fontconfig
##
650
## Only test if on non-Windows system
651
if(NOT WIN32)
652 653
    macro_optional_find_package(Fontconfig)
    macro_log_feature(FONTCONFIG_FOUND "Fontconfig" "Library for configuring and customizing font access" "http://fontconfig.org" FALSE "" "Required to handle exact font size")
654
endif(NOT WIN32)
Hanzes Matus's avatar
Hanzes Matus committed
655 656 657 658

##
## Test for Freetype
##
659
## Only test if on non-Windows system
660
if(NOT WIN32)
661 662
    macro_optional_find_package(Freetype)
    macro_log_feature(FREETYPE_FOUND "Freetype" "A Free, High-Quality, and Portable Font Engine" "http://www.freetype.org/" FALSE "" "Required to handle exact font size")
663
endif(NOT WIN32)
Hanzes Matus's avatar
Hanzes Matus committed
664

665
if(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
Hanzes Matus's avatar
Hanzes Matus committed
666 667 668
    set(FONTCONFIG_INCLUDE_DIR "")
    set(FREETYPE_INCLUDE_DIRS "")
else(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
669
    add_definitions( -DSHOULD_BUILD_FONT_CONVERSION )
Hanzes Matus's avatar
Hanzes Matus committed
670
endif(NOT FONTCONFIG_FOUND OR NOT FREETYPE_FOUND)
671

Cyrille Berger's avatar
Cyrille Berger committed
672 673 674
##
## Test for Qt Webkit
##
675 676 677 678
macro_log_feature(QT_QTWEBKIT_FOUND "Qt Webkit" "Qt binding for Webkit, the HTML engine." "http://qt.nokia.com" FALSE "" "Required for the web shape, web Kexi widget and web report element")
if(QT_QTWEBKIT_FOUND)
    add_definitions( -DCAN_USE_QTWEBKIT )
endif(QT_QTWEBKIT_FOUND)
Cyrille Berger's avatar
Cyrille Berger committed
679

680 681 682 683 684
##
## Test for KDeclarative
##
macro_optional_find_package(KDeclarative)

685 686 687
##
## Test endianess
##
David Faure's avatar
David Faure committed
688
include (TestBigEndian)
689 690
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)

691 692 693 694 695 696
##
## Test SharedMimeInfo
##
macro_optional_find_package(SharedMimeInfo)
macro_log_feature(SHARED_MIME_INFO_FOUND "SharedMimeInfo" "Shared Mime Info" "http://freedesktop.org/wiki/Software/shared-mime-info" FALSE "" "Required to determine file types OpenRaster (Krita default format), SVM or all of MSOOXML.")

697 698 699 700 701
##
## Test for Okular
##
macro_optional_find_package(Okular)
macro_log_feature(OKULAR_FOUND "Okular" "Okular ODP Plugin" "http://okular.kde.org/" FALSE "" "Required to build the Okular OpenDocument Presenter plugin")
702

703 704 705 706 707 708 709 710 711 712
##
## Test for librevenge
##
macro_optional_find_package(LibRevenge)
macro_log_feature(LIBREVENGE_FOUND "LibRevenge"
                  "A base library for writing document import filters"
                  "http://sf.net/p/libwpd/librevenge/" FALSE ""
                  "Required by various import filters"
)

713
##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
714 715 716 717 718 719 720 721 722 723 724
## Test for libodfgen
##
macro_optional_find_package(LibOdfGen)
macro_log_feature(LIBODFGEN_FOUND "LibOdfGen"
                  "Open Document Format Generation Library"
                  "http://sf.net/p/libwpd/libodfgen/" FALSE ""
                  "Required by various import filters"
)

##
## Test for WordPerfect Document Library
725
##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
726 727 728 729 730 731
macro_optional_find_package(LibWpd)
macro_log_feature(LIBWPD_FOUND "LibWpd"
                  "WordPerfect Document Library"
                  "http://libwpd.sourceforge.net/" FALSE ""
                  "Required by the Words WPD import filter"
)
732 733

##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
734
## Test for WordPerfect Graphics Library
735
##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
736 737 738 739 740 741
macro_optional_find_package(LibWpg)
macro_log_feature(LIBWPG_FOUND "LibWpg"
                  "WordPerfect Graphics Library"
                  "http://libwpg.sourceforge.net/" FALSE ""
                  "Required by the Karbon WPG import filter"
)
742 743 744 745

##
## Test for Microsoft Works Document Library
##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
746 747 748 749 750 751
macro_optional_find_package(LibWps)
macro_log_feature(LIBWPS_FOUND "LibWps"
                  "Microsoft Works Document Library"
                  "http://libwps.sourceforge.net/" FALSE ""
                  "Required by the Words WPS import filter"
)
752 753

##
Jigar Raisinghani's avatar
Jigar Raisinghani committed
754
## Test for Microsoft Visio Document Library
755 756
##
macro_optional_find_package(LibVisio)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771
macro_log_feature(LIBVISIO_FOUND "LibVisio"
                  "Visio Import Filter Library"
                  "http://www.freedesktop.org/wiki/Software/libvisio" FALSE ""
                  "Required by the Flow visio import filter"
)

##
## Test for Apple Keynote Document Library
##
macro_optional_find_package(LibEtonyek)
macro_log_feature(LIBETONYEK_FOUND "LibEtonyek"
                  "Apple Keynote Document Library"
                  "http://www.freedesktop.org/wiki/Software/libetonyek/" FALSE ""
                  "Required by the Stage keynote import filter"
)
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791

##
## Test for qt-poppler
##
macro_optional_find_package(Poppler)
macro_log_feature( POPPLER_FOUND "poppler-qt4" "The Poppler Qt4 interface library" "http://poppler.freedesktop.org" FALSE "" "Required by the Krita PDF filter, Karbon PDF import filter and CSTester PDF feature")

## The Karbon pdf-importer needs the not-officially-supported XPDF Headers
## Installing these is off by default in poppler sources, so lets make
## sure they're really there before trying to build the pdf import
if(POPPLER_FOUND)
    find_path(POPPLER_XPDF_HEADERS poppler-config.h
    HINTS ${POPPLER_INCLUDE_DIR} )
    if(POPPLER_XPDF_HEADERS)
        set(POPPLER_XPDF_HEADERS_FOUND TRUE)
    endif(POPPLER_XPDF_HEADERS)
    macro_log_feature( POPPLER_XPDF_HEADERS_FOUND "poppler-qt4-xpdf-headers" "XPDF headers in the Poppler Qt4 interface library" "http://poppler.freedesktop.org" FALSE "" "Required by the Karbon PDF import filter")
endif(POPPLER_FOUND)


792 793 794 795
##
## Generate a file for prefix information
##

796 797 798 799 800
 ###############################
################################
## Add Calligra helper macros ##
################################
###############################
Cyrille Berger's avatar
Cyrille Berger committed
801

Boudewijn Rempt's avatar
Boudewijn Rempt committed
802
include(MacroCalligraAddBenchmark)
803
include(MacroCalligraBuildTest)
Cyrille Berger's avatar
Cyrille Berger committed
804

805 806 807 808 809 810
 ####################
#####################
## Define includes ##
#####################
####################

811 812 813
# WARNING: make sure that QT_INCLUDES is the first directory to be added to include_directory before
#          any other include directory

814
# for config.h and <toplevel/foo.h> includes (if any?)
Boudewijn Rempt's avatar
Boudewijn Rempt committed
815
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces )
816

817 818 819
# koplugin is at the bottom of the stack
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)

820 821
set(KUNDO2_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kundo2)

822
# koodf is at the bottom of the stack
823 824
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
                   ${CMAKE_BINARY_DIR}/libs/odf
825
                   ${KDE4_INCLUDES})
Boudewijn Rempt's avatar
Boudewijn Rempt committed
826

827

828
# pigment depends on koplugin and lcms
829
set(PIGMENT_INCLUDES ${KOPLUGIN_INCLUDES}
830 831
                   ${CMAKE_SOURCE_DIR}/libs/pigment
                   ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
832
                   ${CMAKE_SOURCE_DIR}/libs/pigment/resources
833
                   ${QT_INCLUDES}
834
                   ${KDE4_INCLUDES})
835

836 837 838 839 840
# flake depends on koodf and pigment
set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake
                   ${KOODF_INCLUDES}
                   ${KOPLUGIN_INCLUDES}
                   ${PIGMENT_INCLUDES}
841
                   ${KUNDO2_INCLUDES}
842
                   ${CMAKE_SOURCE_DIR}/libs/widgetutils
843 844
                   ${CMAKE_SOURCE_DIR}/libs/flake/commands
                   ${CMAKE_SOURCE_DIR}/libs/flake/tools
845
                   ${CMAKE_SOURCE_DIR}/libs/flake/svg
846
                   ${CMAKE_BINARY_DIR}/libs/flake)
847

848
# vectorimage
Jigar Raisinghani's avatar
Jigar Raisinghani committed
849
set(VECTORIMAGE_INCLUDES
850 851 852 853
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libemf
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libsvm
                   ${CMAKE_SOURCE_DIR}/libs/vectorimage/libwmf)
Jigar Raisinghani's avatar
Jigar Raisinghani committed
854

855 856 857 858 859 860
# KoText depends on koplugin, odf
set(KOTEXT_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kotext
                   ${CMAKE_BINARY_DIR}/libs/kotext
                   ${CMAKE_SOURCE_DIR}/libs/kotext/changetracker
                   ${CMAKE_SOURCE_DIR}/libs/kotext/styles
                   ${CMAKE_SOURCE_DIR}/libs/kotext/opendocument
861
                   ${SOPRANO_INCLUDE_DIR}
862
                   ${FLAKE_INCLUDES}
863 864
                   ${KOODF_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/main)
865

866 867 868 869
# TextLayout depends on kotext
set(TEXTLAYOUT_INCLUDES ${KOTEXT_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/textlayout)

C. Boemann's avatar
C. Boemann committed
870 871 872 873 874
# BasicFlakes depends on flake, widgets
set(BASICFLAKES_INCLUDES ${KOWIDGETS_INCLUDES} ${FLAKE_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/basicflakes
                   ${CMAKE_SOURCE_DIR}/libs/basicflakes/tools)

875
# komain depends on kotext & flake
876
set(KOMAIN_INCLUDES ${KDE4_INCLUDES}
877
                    ${TEXTLAYOUT_INCLUDES}
878
                    ${CMAKE_SOURCE_DIR}/libs/widgets
879
                    ${CMAKE_SOURCE_DIR}/libs/widgetutils
880
                    ${CMAKE_SOURCE_DIR}/libs/main
Jigar Raisinghani's avatar
Jigar Raisinghani committed
881
                    ${CMAKE_BINARY_DIR}/libs/main
882
                    ${CMAKE_SOURCE_DIR}/libs/main/config)
883

884 885 886
set(KORDF_INCLUDES ${KOMAIN_INCLUDES}
                   ${CMAKE_SOURCE_DIR}/libs/rdf
)
887
set(KORDF_LIBS kordf)
888

889 890 891
if(SHOULD_BUILD_SCRIPTING)
  set(KOKROSS_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kokross ${CMAKE_BINARY_DIR}/libs/kokross)
endif(SHOULD_BUILD_SCRIPTING)
892

David Faure's avatar
David Faure committed
893
# kopageapp
894 895 896 897 898
set(KOPAGEAPP_INCLUDES ${TEXTLAYOUT_INCLUDES}
                    ${PIGMENT_INCLUDES}
                    ${KOMAIN_INCLUDES}
                    ${CMAKE_SOURCE_DIR}/libs/widgets
                    ${CMAKE_SOURCE_DIR}/libs/kopageapp ${CMAKE_SOURCE_DIR}/libs/kopageapp/commands ${CMAKE_BINARY_DIR}/libs/kopageapp )
899

900 901 902 903
# koproperty
set(KOPROPERTY_INCLUDES ${KOODF_INCLUDES}
                        ${CMAKE_SOURCE_DIR}/libs
                        ${CMAKE_SOURCE_DIR}/libs/widgets)
904
set(KOPROPERTY_LIBS koproperty)
905

906 907 908 909 910 911 912 913 914
# koreport
set(KOREPORT_INCLUDES
    ${CMAKE_SOURCE_DIR}/libs/
    ${CMAKE_SOURCE_DIR}/libs/koreport
    ${CMAKE_SOURCE_DIR}/libs/koreport/common
    ${CMAKE_SOURCE_DIR}/libs/koreport/renderer
    ${CMAKE_SOURCE_DIR}/libs/koreport/wrtembed)
set(KOREPORT_LIBS koreport)

915
# calligradb
916 917 918
set(CALLIGRADB_LIBS calligradb)                    # TODO remove when Predicate lib arrives
set(CALLIGRADB_INCLUDES ${CMAKE_SOURCE_DIR}/libs   # TODO remove when Predicate lib arrives
                        ${CMAKE_BINARY_DIR}/libs/db)
919

920 921 922
#############################################
####          3rd party libraries        ####
#############################################
923

924 925 926
set(KDGANTT_INCLUDES
    ${CMAKE_SOURCE_DIR}/3rdparty/kdgantt
)
927

928 929 930
set(KDCHART_INCLUDES
    ${CMAKE_SOURCE_DIR}/3rdparty/kdchart/include
)
931 932
set(KDCHART_LIBS calligrakdchart)

933

934 935 936 937 938 939 940 941 942
#############################################
####           filter libraries          ####
#############################################

# libodf2
set(KOODF2_INCLUDES
    ${CMAKE_SOURCE_DIR}/filters/libodf2
)

943 944 945 946 947
# libodfreader
set(KOODFREADER_INCLUDES
    ${CMAKE_SOURCE_DIR}/filters/libodfreader
)

948 949 950 951 952
 #########################################
##########################################
## Detect which products can be compile ##
##########################################
#########################################
953

954
#
955 956 957
# WARNING: when adding a dependency for product x if there is already a line
# containing calligra_disable_product(product_x, don't add a new one, just add
# the test to the if construct and the reasoning
958 959
#

960
if(NOT SHARED_MIME_INFO_FOUND)
961
    calligra_disable_product(LIB_KOMSOOXML "SharedMimeInfo not found (needed to install mimetypes)")
962
endif(NOT SHARED_MIME_INFO_FOUND)
963

964 965 966 967
if(NOT Soprano_FOUND)
    calligra_disable_product(RDF "Soprano not found")
endif(NOT Soprano_FOUND)

968
if(NOT EIGEN2_FOUND)
969
    calligra_disable_product(SHEETS_PART "Eigen devel not found")
970
endif(NOT EIGEN2_FOUND)
971

Jigar Raisinghani's avatar
Jigar Raisinghani committed
972 973 974 975 976 977 978
if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION OR NOT SHARED_MIME_INFO_FOUND)
    calligra_disable_product(KRITA_APP "SharedMimeInfo|libeigen2|libexiv2|lcms devel not found ")
endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION OR NOT SHARED_MIME_INFO_FOUND)

if(NOT APPLE AND NOT REQUIRED_Xinput_FOUND)
    calligra_disable_product(KRITA_APP "Xinput devel not found ")
endif(NOT APPLE AND NOT REQUIRED_Xinput_FOUND)
979

980
if (NOT ${QTVERSION} VERSION_GREATER 4.7.0)
981
    calligra_disable_product(ACTIVE "Qt version <= 4.7.0")
982 983
endif (NOT ${QTVERSION} VERSION_GREATER 4.7.0)

984
if (NOT QT_QTDECLARATIVE_FOUND OR NOT KDECLARATIVE_FOUND)
985
    calligra_disable_product(ACTIVE "QtDeclarative|KDeclarative not found")
986
endif(NOT QT_QTDECLARATIVE_FOUND OR NOT KDECLARATIVE_FOUND)
987

988
# TODO: remove when Predicate lib arrives
989
if (NOT HAVE_ICU OR NOT HAVE_SQLITE)
990
    calligra_disable_product(LIB_CALLIGRADB "ICU|sqlite devel not found")
991
endif (NOT HAVE_ICU OR NOT HAVE_SQLITE)
992

993
if (NOT QT3SUPPORT)
994
    calligra_disable_product(KEXI_APP "Qt3Support not found")
995 996
endif (NOT QT3SUPPORT)

997
if(NOT OKULAR_FOUND)
998
    calligra_disable_product(OKULARODPGENERATOR "Okular devel not found")
999
endif(NOT OKULAR_FOUND)
1000

1001 1002 1003 1004
if(NOT OKULAR_FOUND)
    calligra_disable_product(OKULAR_GENERATOR_ODT "Okular devel not found")
endif(NOT OKULAR_FOUND)

1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027
if (NOT LIBODFGEN_FOUND OR NOT LIBETONYEK_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_KEY_TO_ODP "libodfgen|libetonyek|librevenge devel not found")
endif (NOT LIBODFGEN_FOUND OR NOT LIBETONYEK_FOUND OR NOT LIBREVENGE_FOUND)

if (NOT LIBODFGEN_FOUND OR NOT LIBVISIO_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_VISIO_TO_ODG "libodfgen|libvisio|librevenge devel not found")
endif (NOT LIBODFGEN_FOUND OR NOT LIBVISIO_FOUND OR NOT LIBREVENGE_FOUND)

if(NOT LIBODFGEN_FOUND OR NOT LIBWPD_FOUND OR NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_WORDPERFECT_TO_ODT "libodfgen|libwpd|libwpg|librevenge devel not found")
endif(NOT LIBODFGEN_FOUND OR NOT LIBWPD_FOUND OR NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)

if(NOT LIBODFGEN_FOUND OR NOT LIBWPS_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_WORKS_TO_ODT "libodfgen|libwps|librevenge devel not found")
endif(NOT LIBODFGEN_FOUND OR NOT LIBWPS_FOUND OR NOT LIBREVENGE_FOUND)

if (NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_WPG_TO_SVG "libwpg|librevenge devel not found")
endif (NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)

if (NOT LIBODFGEN_FOUND OR NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)
    calligra_disable_product(FILTER_WPG_TO_ODG "libodfgen|libwpg|librevenge devel not found")
endif (NOT LIBODFGEN_FOUND OR NOT LIBWPG_FOUND OR NOT LIBREVENGE_FOUND)
1028 1029

if (WIN32 OR NOT POPPLER_XPDF_HEADERS_FOUND)
1030
    calligra_disable_product(FILTER_PDF_TO_SVG "poppler xpdf headers not found or on win")
1031 1032 1033
endif (WIN32 OR NOT POPPLER_XPDF_HEADERS_FOUND)

if(WIN32 OR QT_MAC_USE_COCOA)
1034
    calligra_disable_product(FILTER_HTML_TO_ODS "not supported on platform")
1035 1036 1037
endif(WIN32 OR QT_MAC_USE_COCOA)

if(WIN32 OR QT_MAC_USE_COCOA)
1038
    calligra_disable_product(FILTER_SHEETS_TO_HTML "not supported on platform")
1039 1040 1041
endif(WIN32 OR QT_MAC_USE_COCOA)

if(WIN32 OR QT_MAC_USE_COCOA)
1042
    calligra_disable_product(FILTER_KSPREAD_TO_LATEX "not supported on platform")
1043 1044
endif(WIN32 OR QT_MAC_USE_COCOA)

1045 1046 1047 1048
if(NOT SHARED_MIME_INFO_FOUND)
    calligra_disable_product(FILTER_MPXJ_IMPORT "SharedMimeInfo not found (needed to install mimetypes)")
endif(NOT SHARED_MIME_INFO_FOUND)

1049
if(WIN32)
1050
    calligra_disable_product(BRAINDUMP_APP "unmaintained on Windows")
1051 1052
endif()

1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068
#############################################
####  Backward compatibility BUILD_x=off ####
#############################################

# workaround: disable directly all products which might be activated by internal
# dependencies, but belong to scope of old flag
calligra_drop_products_on_old_flag(braindump BRAINDUMP_APP)
calligra_drop_products_on_old_flag(flow FLOW_APP)
calligra_drop_products_on_old_flag(karbon KARBON_APP)
calligra_drop_products_on_old_flag(kexi KEXI_APP)
calligra_drop_products_on_old_flag(krita KRITA_APP)
calligra_drop_products_on_old_flag(plan  PLAN_APP)
calligra_drop_products_on_old_flag(sheets SHEETS_PART SHEETS_APP)
calligra_drop_products_on_old_flag(stage  STAGE_PART STAGE_APP)
calligra_drop_products_on_old_flag(words  WORDS_PART WORDS_APP)

1069 1070 1071 1072 1073
#############################################
####      Temporarily broken products    ####
#############################################

# If a product does not build due to some temporary brokeness disable it here,
1074 1075 1076
# by calling calligra_disable_product with the product id and the reason,
# e.g.:
# calligra_disable_product(KEXI_APP "isn't buildable at the moment")
1077 1078 1079 1080 1081

#############################################
####     Calculate buildable products    ####
#############################################

1082
calligra_drop_unbuildable_products()
Jarosław Staniek's avatar
Jarosław Staniek committed
1083

1084

1085 1086 1087 1088 1089 1090 1091 1092 1093
#############################################
####     Setup product-depending vars    ####
#############################################

if(SHOULD_BUILD_RDF)
   add_definitions( -DSHOULD_BUILD_RDF )
endif(SHOULD_BUILD_RDF)


1094 1095 1096 1097 1098 1099
 ###################
####################
## Subdirectories ##
####################
###################

1100
add_subdirectory(words)
1101

1102
if (SHOULD_BUILD_FLOW_APP)
1103
    add_subdirectory(flow)
1104
endif (SHOULD_BUILD_FLOW_APP)
1105

1106
add_subdirectory(stage)
1107

1108
if(SHOULD_BUILD_KEXI_APP)
1109
    add_subdirectory(kexi)
1110
endif(SHOULD_BUILD_KEXI_APP)
1111

1112
if(SHOULD_BUILD_PLAN_APP)
1113
    add_subdirectory(plan)
1114
endif(SHOULD_BUILD_PLAN_APP)
1115

1116
add_subdirectory(sheets)