Subversion Repositories Scribus

Rev

Rev 20028 | Rev 20103 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10215 cbradney 1
##############################################################################################################
2
########## CMake Setup                                                                              ##########
3
 
9680 cbradney 4
#Set our CMake minimum version
18447 craig 5
#Require 2.8.9 for Qt5
20014 craig 6
#Require 3.2.0 for add_custom_target with byproducts
20019 avox 7
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9 FATAL_ERROR)
5758 cbradney 8
 
9680 cbradney 9
#Pretty colors
5142 cbradney 10
SET(CMAKE_COLOR_MAKEFILE ON)
20014 craig 11
#Don't force verbose
9715 avox 12
SET(CMAKE_VERBOSE_MAKEFILE OFF)
9680 cbradney 13
#Include current dir
5142 cbradney 14
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
10459 cbradney 15
#RPATH setup - more below too
10327 cbradney 16
IF (WANT_NORPATH OR WANT_DISTROBUILD)
20014 craig 17
	SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
10327 cbradney 18
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
20014 craig 19
	SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
10327 cbradney 20
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
10459 cbradney 21
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
9715 avox 22
SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
8902 cbradney 23
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
24
 
10215 cbradney 25
INCLUDE(CheckIncludeFile)
26
INCLUDE(CheckCCompilerFlag)
27
INCLUDE(CheckCXXCompilerFlag)
28
INCLUDE(CheckTypeSize)
29
INCLUDE(TestBigEndian)
20023 craig 30
INCLUDE(GNUInstallDirs)
10215 cbradney 31
 
16856 craig 32
#ENABLE_TESTING()
33
 
9680 cbradney 34
#Set the custom CMake module directory where our include/lib finders are
5142 cbradney 35
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
9680 cbradney 36
 
10215 cbradney 37
##############################################################################################################
38
########## toplevel compiler flags                                                                  ##########
15099 cbradney 39
MESSAGE(STATUS "Shared Library Flags: ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
10215 cbradney 40
 
9680 cbradney 41
#Project Setup
5142 cbradney 42
PROJECT(scribus)
9680 cbradney 43
#Set our version values
14911 cbradney 44
#Final version is ${VERSION} = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_SUFFIX}
14373 cbradney 45
#where VERSION_SUFFIX is of the form "", "svn" or "Nsvn" (N being the minor patch level)
5396 cbradney 46
SET (VERSION_MAJOR "1")
13511 mrdocs 47
SET (VERSION_MINOR "5")
20100 craig 48
SET (VERSION_PATCH "1")
49
SET (VERSION_SUFFIX "svn")
14911 cbradney 50
SET (VERSION ${VERSION_MAJOR})
51
IF (VERSION_MINOR GREATER -1)
20014 craig 52
	SET (VERSION ${VERSION}.${VERSION_MINOR})
14911 cbradney 53
ENDIF (VERSION_MINOR GREATER -1)
54
IF (VERSION_PATCH GREATER -1)
20014 craig 55
	SET (VERSION ${VERSION}.${VERSION_PATCH})
14911 cbradney 56
ENDIF (VERSION_PATCH GREATER -1)
57
IF (VERSION_SUFFIX)
20014 craig 58
	SET (VERSION ${VERSION}.${VERSION_SUFFIX})
14911 cbradney 59
ENDIF (VERSION_SUFFIX)
20014 craig 60
MESSAGE(STATUS "Scribus ${VERSION} will be built and installed into ${CMAKE_INSTALL_PREFIX}")
5142 cbradney 61
 
9680 cbradney 62
#Set the permissions to be used when installing plugins
5142 cbradney 63
SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
64
 
9680 cbradney 65
#Our main directory is scribus
5379 cbradney 66
SET(MAIN_DIR_NAME "scribus")
9680 cbradney 67
 
10215 cbradney 68
##############################################################################################################
10238 cbradney 69
########## check for the CPU we build for                                                           ##########
70
 
71
EXECUTE_PROCESS(
20014 craig 72
	COMMAND ${CMAKE_C_COMPILER} -dumpmachine
73
	OUTPUT_VARIABLE MACHINE
74
	OUTPUT_STRIP_TRAILING_WHITESPACE
10238 cbradney 75
)
20014 craig 76
 
77
## Find out what machine/cpu we are running on
14373 cbradney 78
MESSAGE(STATUS  "Machine: ${MACHINE}, void pointer size: ${CMAKE_SIZEOF_VOID_P}")
19233 craig 79
STRING(REGEX MATCH "(i[0-9]86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
10238 cbradney 80
IF (_machine_x86)
20014 craig 81
	MESSAGE(STATUS "Found target X86")
82
	SET(ARCH_X86 1)
10238 cbradney 83
ENDIF (_machine_x86)
84
 
85
STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _machine_x86_64 "${MACHINE}")
86
IF (_machine_x86_64)
19233 craig 87
	MESSAGE(STATUS "Found target X86_64")
88
	SET(ARCH_X86_64 1)
10238 cbradney 89
ENDIF (_machine_x86_64)
90
 
20014 craig 91
STRING(REGEX MATCH "(sparc64-*)|(SPARC64-*)" _machine_sparc_64 "${MACHINE}")
92
IF (_machine_sparc_64)
93
	MESSAGE(STATUS "Found target SPARC 64")
94
	SET(ARCH_SPARC_64 1)
95
ENDIF (_machine_sparc_64)
96
 
97
STRING(REGEX MATCH "(mips64-*)|(MIPS64-*)" _machine_mips_64 "${MACHINE}")
98
IF (_machine_mips_64)
99
	MESSAGE(STATUS "Found target MIPS 64")
100
	SET(ARCH_MIPS_64 1)
101
ENDIF (_machine_mips_64)
102
 
103
STRING(REGEX MATCH "(ppc-*)|(powerpc-*)" _machine_ppc "${MACHINE}")
104
IF (_machine_ppc)
105
	MESSAGE(STATUS "Found target PPC")
106
	SET(ARCH_PPC 1)
107
ENDIF (_machine_ppc)
108
 
109
STRING(REGEX MATCH "(ppc64-*)|(PPC64-*)|(powerpc64-*)" _machine_ppc_64 "${MACHINE}")
110
IF (_machine_ppc_64)
111
	MESSAGE(STATUS "Found target PPC64")
112
	SET(ARCH_PPC_64 1)
113
ENDIF (_machine_ppc_64)
114
 
115
STRING(REGEX MATCH "(sparc-*)" _machine_sparc "${MACHINE}")
116
IF (_machine_sparc)
117
	MESSAGE(STATUS "Found target Sparc")
118
	SET(ARCH_SPARC 1)
119
ENDIF (_machine_sparc)
120
 
121
STRING(REGEX MATCH "(sparcv9-*)" _machine_sparcv9 "${MACHINE}")
122
IF (_machine_sparcv9)
123
	MESSAGE(STATUS "Found target Sparc v9")
124
	SET(ARCH_SPARCV9 1)
125
ENDIF (_machine_sparcv9)
126
 
127
STRING(REGEX MATCH "(sparc64-*)" _machine_sparc64 "${MACHINE}")
128
IF (_machine_sparc64)
129
	MESSAGE(STATUS "Found target Sparc64")
130
	SET(ARCH_SPARC64 1)
131
	SET(ARCH64BIT 1)
132
ENDIF (_machine_sparc64)
133
 
134
## Do our Apple OSX version setup
19233 craig 135
IF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (ARCH_X86 EQUAL 1 OR ARCH_X86_64 EQUAL 1))
136
	STRING(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}")
137
	IF (_apple_ver EQUAL "14")
138
		MESSAGE(STATUS "Found OSX Yosemite Target: Apple, 64 bit, X86")
139
		SET(APPLE_10_10_X 1 CACHE TYPE BOOL)
140
	ENDIF (_apple_ver EQUAL "14")
141
	IF (_apple_ver EQUAL "13")
142
		MESSAGE(STATUS "Found OSX Mavericks Target: Apple, 64 bit, X86")
143
		SET(APPLE_10_9_X 1 CACHE TYPE BOOL)
144
	ENDIF (_apple_ver EQUAL "13")
145
	IF (_apple_ver EQUAL "12")
146
		MESSAGE(STATUS "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
147
		SET(APPLE_10_8_X 1 CACHE TYPE BOOL)
148
	ENDIF (_apple_ver EQUAL "12")
149
	IF (_apple_ver EQUAL "11")
150
		MESSAGE(STATUS "Found OSX Lion Target: Apple, 64 bit, X86")
151
		SET(APPLE_10_7_X 1 CACHE TYPE BOOL)
152
	ENDIF (_apple_ver EQUAL "11")
153
	IF (_apple_ver EQUAL "10")
154
		MESSAGE(STATUS "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
155
		SET(APPLE_10_6_X 1 CACHE TYPE BOOL)
156
	ENDIF (_apple_ver EQUAL "10")
157
	IF (_apple_ver EQUAL "9")
19353 craig 158
		MESSAGE(STATUS "Found OSX Leopard Target: Apple, 32 bit, X86")
19242 craig 159
		SET(APPLE_10_5_X 1 CACHE TYPE BOOL)
19233 craig 160
	ENDIF (_apple_ver EQUAL "9")
161
	UNSET(ARCH_X86)
162
ENDIF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (ARCH_X86 EQUAL 1 OR ARCH_X86_64 EQUAL 1))
163
 
164
 
11407 cbradney 165
#convert any 64 bit build into generic 64 tag for below
19222 fschmid 166
IF (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64)
20014 craig 167
	SET(ARCH64BIT 1)
19222 fschmid 168
ENDIF (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64)
11407 cbradney 169
 
170
MESSAGE(STATUS "Building for target ${MACHINE}")
171
 
10238 cbradney 172
##############################################################################################################
10215 cbradney 173
########## Versioning Setup                                                                         ##########
174
 
9409 cbradney 175
#On Apple, we ignore the versioning tag so all items are "scribus" not "scribus-version"
9508 cbradney 176
IF (NOT BUILD_OSX_BUNDLE)
20014 craig 177
	SET(BUILD_OSX_BUNDLE ${APPLE} CACHE TYPE BOOL)
9508 cbradney 178
ENDIF (NOT BUILD_OSX_BUNDLE)
179
 
9680 cbradney 180
#Simplify future conditionals for Apple
181
IF (APPLE AND BUILD_OSX_BUNDLE)
20014 craig 182
	SET(APPLEBUNDLE TRUE CACHE TYPE BOOL)
9680 cbradney 183
ENDIF (APPLE AND BUILD_OSX_BUNDLE)
184
 
185
#Announce we cached a version request before, overridden below for OSX
9508 cbradney 186
IF(TAG_VERSION)
20014 craig 187
	IF (NOT APPLEBUNDLE)
188
		MESSAGE(STATUS "Previously selected version tag: ${TAG_VERSION}")
189
	ENDIF (NOT APPLEBUNDLE)
190
	SET(WANT_VERSIONING 1)
191
	SET(CACHED_VERSIONING 1)
9508 cbradney 192
ENDIF(TAG_VERSION)
193
 
9680 cbradney 194
#Remove version tags on OSX so our bundle is Scribus.app
18766 craig 195
IF (APPLEBUNDLE OR WIN32)
196
	IF (WANT_VERSIONING OR CACHED_VERSIONING)
197
		MESSAGE(STATUS "Ignoring version tag on Win32 or OSX when building bundle")
198
		SET(WANT_VERSIONING 0)
199
		SET(CACHED_VERSIONING 0)
200
	ENDIF (WANT_VERSIONING OR CACHED_VERSIONING)
18770 jghali 201
ENDIF (APPLEBUNDLE OR WIN32)
9508 cbradney 202
 
20014 craig 203
#Store our version string if required
6891 cbradney 204
IF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
20014 craig 205
	IF (NOT CUSTOM_VERSIONTAG)
206
		SET(TAG_VERSION "-${VERSION}" CACHE TYPE STRING)
207
	ELSE (NOT CUSTOM_VERSIONTAG)
208
		SET(TAG_VERSION ${CUSTOM_VERSIONTAG} CACHE TYPE STRING)
209
	ENDIF (NOT CUSTOM_VERSIONTAG)
6891 cbradney 210
ENDIF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
5379 cbradney 211
 
10215 cbradney 212
##############################################################################################################
213
########## Install/Directory Setup                                                                  ##########
214
 
12457 avox 215
IF (APPLEBUNDLE)
19631 craig 216
SET (APPLE_APP_DIR "${CMAKE_INSTALL_PREFIX}")
20014 craig 217
	IF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
218
		# all ok
219
	ELSE ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
220
		IF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
221
			# add "/Contents" subpath
222
			SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Contents")
223
		ELSE ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
224
			# no bundle name spcified, use appname and version
225
			SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Scribus${VERSION}.app/Contents")
226
		ENDIF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
227
	ENDIF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
228
	MESSAGE(STATUS "APPLEBUNDLE install prefix: ${APPLE_APP_DIR}")
12457 avox 229
ENDIF (APPLEBUNDLE)
230
 
231
 
19353 craig 232
#Setup all the directories we will use
13271 fschmid 233
CMAKE_POLICY(SET CMP0005 OLD)
20023 craig 234
#SHARE
16347 malex 235
IF(WANT_VERSIONING)
20023 craig 236
	SET(SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/")
16345 malex 237
ELSE(WANT_VERSIONING)
20023 craig 238
	SET(SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}/")
16345 malex 239
ENDIF(WANT_VERSIONING)
20023 craig 240
IF(NOT IS_ABSOLUTE ${SHAREDIR})
241
	ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
242
ELSE()
243
	ADD_DEFINITIONS("-DSHAREDIR=\\\"${SHAREDIR}\\\"")
244
ENDIF()
9680 cbradney 245
 
9409 cbradney 246
#SHARE - use the default on Apple as TAG_VERSION is empty
14949 jghali 247
IF(WIN32 OR OS2)
20023 craig 248
	SET(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/")
14949 jghali 249
ELSE (WIN32 OR OS2)
20014 craig 250
	IF(TAG_VERSION OR BUILD_OSX_BUNDLE)
20023 craig 251
		SET(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
20014 craig 252
	ELSE(TAG_VERSION OR BUILD_OSX_BUNDLE)
253
		IF(NOT WANT_VERSIONING)
20023 craig 254
			SET(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}/")
20014 craig 255
		ELSE(NOT WANT_VERSIONING)
20023 craig 256
			SET(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}-${VERSION}/")
20014 craig 257
		ENDIF(NOT WANT_VERSIONING)
258
	ENDIF (TAG_VERSION OR BUILD_OSX_BUNDLE)
14949 jghali 259
ENDIF (WIN32 OR OS2)
20023 craig 260
IF(NOT IS_ABSOLUTE ${DOCDIR})
261
	ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
262
ELSE()
263
	ADD_DEFINITIONS("-DDOCDIR=\\\"${DOCDIR}\\\"")
264
ENDIF()
9680 cbradney 265
 
18763 craig 266
#ICONS
10779 craig 267
IF(WIN32)
20023 craig 268
	SET(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/icons/")
10779 craig 269
ELSE(WIN32)
20023 craig 270
	SET(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
10779 craig 271
ENDIF(WIN32)
20023 craig 272
IF(NOT IS_ABSOLUTE ${ICONDIR})
273
	ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
274
ELSE()
275
	ADD_DEFINITIONS("-DICONDIR=\\\"${ICONDIR}\\\"")
276
ENDIF()
9680 cbradney 277
 
7269 cbradney 278
#SAMPLES
20023 craig 279
SET(SAMPLESDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
280
IF(NOT IS_ABSOLUTE ${SAMPLESDIR})
281
	ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
282
ELSE()
283
	ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${SAMPLESDIR}\\\"")
284
ENDIF()
9680 cbradney 285
 
7269 cbradney 286
#SCRIPTS
20023 craig 287
SET(SCRIPTSDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
288
IF(NOT IS_ABSOLUTE ${SCRIPTSDIR})
289
	ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
290
ELSE()
291
	ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${SCRIPTSDIR}\\\"")
292
ENDIF()
9680 cbradney 293
 
7269 cbradney 294
#TEMPLATES
10779 craig 295
IF(WIN32)
20023 craig 296
	SET(TEMPLATEDIR "${CMAKE_INSTALL_DATAROOTDIR}/templates/")
10779 craig 297
ELSE(WIN32)
20023 craig 298
	SET(TEMPLATEDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
10779 craig 299
ENDIF(WIN32)
20023 craig 300
IF(NOT IS_ABSOLUTE ${TEMPLATEDIR})
301
	ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
302
ELSE()
303
	ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${TEMPLATEDIR}\\\"")
304
ENDIF()
9680 cbradney 305
 
18763 craig 306
#QML
18764 jghali 307
IF(WIN32)
20023 craig 308
	SET(QMLDIR "${CMAKE_INSTALL_DATAROOTDIR}/qml/")
18764 jghali 309
ELSE(WIN32)
20023 craig 310
	SET(QMLDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/qml/")
18764 jghali 311
ENDIF(WIN32)
18763 craig 312
ADD_DEFINITIONS("-DQMLDIR=\\\"${CMAKE_INSTALL_PREFIX}/${QMLDIR}\\\"")
313
 
9660 cbradney 314
#DESKTOP
20023 craig 315
SET(DESKTOPDIR "${CMAKE_INSTALL_DATAROOTDIR}/applications/")
316
IF(NOT IS_ABSOLUTE ${DESKTOPDIR})
317
	ADD_DEFINITIONS("-DDESKTOPDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DESKTOPDIR}\\\"")
318
ELSE()
319
	ADD_DEFINITIONS("-DDESKTOPDIR=\\\"${DESKTOPDIR}\\\"")
320
ENDIF()
9680 cbradney 321
 
13066 subik 322
# APPLICATION_DATA_DIR
323
# It allows specify the user configuration directory in the compile time.
324
# Example: I want to use special ~/.scribus135svn config directory for my trunk
325
#          cmake -DAPPLICATION_DATA_DIR=.scribus135svn ...
326
IF (APPLICATION_DATA_DIR)
13171 cbradney 327
	MESSAGE(STATUS "Using ApplicationDataDir ${APPLICATION_DATA_DIR} instead of the platform default.")
20014 craig 328
	ADD_DEFINITIONS("-DAPPLICATION_DATA_DIR=\\\"${APPLICATION_DATA_DIR}\\\"")
13066 subik 329
ELSE (APPLICATION_DATA_DIR)
20014 craig 330
	MESSAGE(STATUS "Using standard ApplicationDataDir. You can change it with -DAPPLICATION_DATA_DIR")
13066 subik 331
ENDIF (APPLICATION_DATA_DIR)
332
 
10161 cbradney 333
#LIB LOCATION - lib or lib64 normally
7269 cbradney 334
#LIB
10161 cbradney 335
IF(WANT_LIB64)
19631 craig 336
	IF(NOT ARCH_X86_64)
337
		MESSAGE(STATUS "WARNING: BUILDING 64 Bit build on non 64 bit architecture")
338
	ENDIF(NOT ARCH_X86_64)
339
	 SET(LIB_SUFFIX "64" CACHE TYPE STRING)
10161 cbradney 340
ENDIF(WANT_LIB64)
10239 cbradney 341
SET(LIB_DIR_NAME "lib${LIB_SUFFIX}")
19631 craig 342
IF (APPLEBUNDLE)
19676 craig 343
	SET(LIBDIR "lib/")
19631 craig 344
ELSE (APPLEBUNDLE)
345
	SET(LIBDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/")
346
ENDIF (APPLEBUNDLE)
5142 cbradney 347
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
9680 cbradney 348
 
18763 craig 349
#C++11 Support
350
IF(WANT_CPP11)
351
	MESSAGE(STATUS "Enabling C++11 compiler features")
352
	ADD_DEFINITIONS("-std=c++11")
353
ENDIF(WANT_CPP11)
354
 
7269 cbradney 355
#PLUGINS
10779 craig 356
IF(WIN32)
19631 craig 357
	SET(PLUGINDIR "plugins")
10781 craig 358
ELSE(WIN32)
19631 craig 359
	IF (APPLEBUNDLE)
360
		SET(PLUGINDIR "${LIBDIR}")
361
	ELSE (APPLEBUNDLE)
362
		SET(PLUGINDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
363
	ENDIF (APPLEBUNDLE)
10779 craig 364
ENDIF(WIN32)
5142 cbradney 365
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
9680 cbradney 366
 
18763 craig 367
 
9660 cbradney 368
#INCLUDE
369
SET(INCLUDEDIR "include/${MAIN_DIR_NAME}${TAG_VERSION}/")
370
#NO ADD DEFINITIONS, WE ONLY INSTALL WITH IT
9680 cbradney 371
 
7269 cbradney 372
#RPATH
10459 cbradney 373
IF (WANT_NORPATH OR WANT_DISTROBUILD)
20014 craig 374
	set(CMAKE_INSTALL_RPATH "")
10459 cbradney 375
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
20014 craig 376
	set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
10459 cbradney 377
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
5142 cbradney 378
 
6319 mrdocs 379
# Set the XDG mime stuff
20023 craig 380
SET(MIMEDIR "${CMAKE_INSTALL_DATAROOTDIR}/mime/packages/")
381
SET(MIMELNKDIR "${CMAKE_INSTALL_DATAROOTDIR}/mimelnk/application/")
6319 mrdocs 382
 
10215 cbradney 383
##############################################################################################################
384
########## Build Setup                                                                              ##########
6319 mrdocs 385
 
9680 cbradney 386
#Convert our simpler command line option to the CMake style
5142 cbradney 387
#None, Debug, Release, .. or custom ones
7943 cbradney 388
# SET(WANT_DEBUG 1)
5142 cbradney 389
IF(WANT_DEBUG)
20014 craig 390
	SET(CMAKE_BUILD_TYPE Debug)
13238 cbradney 391
ENDIF(WANT_DEBUG)
392
IF (WANT_RELEASEWITHDEBUG)
20014 craig 393
	SET(CMAKE_BUILD_TYPE RelWithDebInfo)
13238 cbradney 394
ENDIF (WANT_RELEASEWITHDEBUG)
395
IF(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
20014 craig 396
	SET(CMAKE_BUILD_TYPE RELEASE)
13238 cbradney 397
ENDIF(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
5142 cbradney 398
 
13238 cbradney 399
 
400
 
9680 cbradney 401
#Based on our build type, setup our build options
5468 avox 402
IF(APPLE)
19229 craig 403
	IF(APPLE_10_10_X)
404
		SET(OSXMINVER "10.10" CACHE TYPE STRING)
19260 craig 405
		IF (WANT_OSX_SDK)
406
			SET(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")
407
		ENDIF (WANT_OSX_SDK)
19229 craig 408
	ENDIF(APPLE_10_10_X)
409
	IF(APPLE_10_9_X)
410
		SET(OSXMINVER "10.9" CACHE TYPE STRING)
19260 craig 411
		IF (WANT_OSX_SDK)
412
			SET(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
413
		ENDIF (WANT_OSX_SDK)
19229 craig 414
	ENDIF(APPLE_10_9_X)
415
	IF(APPLE_10_8_X)
416
		SET(OSXMINVER "10.8" CACHE TYPE STRING)
19260 craig 417
		IF (WANT_OSX_SDK)
418
			SET(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk")
419
		ENDIF (WANT_OSX_SDK)
19229 craig 420
	ENDIF(APPLE_10_8_X)
421
	IF(APPLE_10_7_X)
422
		SET(OSXMINVER "10.7" CACHE TYPE STRING)
19260 craig 423
		IF (WANT_OSX_SDK)
424
			SET(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
425
		ENDIF (WANT_OSX_SDK)
19229 craig 426
	ENDIF(APPLE_10_7_X)
427
	IF(APPLE_10_6_X)
428
		SET(OSXMINVER "10.6" CACHE TYPE STRING)
19260 craig 429
		IF (WANT_OSX_SDK)
430
			SET(CMAKE_OSX_SYSROOT "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk")
431
		ENDIF (WANT_OSX_SDK)
19229 craig 432
	ENDIF(APPLE_10_6_X)
433
	IF(APPLE_10_5_X)
434
		SET(OSXMINVER "10.5" CACHE TYPE STRING)
19260 craig 435
		IF (WANT_OSX_SDK)
436
			SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
437
		ENDIF (WANT_OSX_SDK)
19229 craig 438
	ENDIF(APPLE_10_5_X)
439
	IF(APPLE_10_4_X)
440
		SET(OSXMINVER "10.4" CACHE TYPE STRING)
19260 craig 441
		IF (WANT_OSX_SDK)
442
			SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
443
		ENDIF (WANT_OSX_SDK)
19229 craig 444
	ENDIF(APPLE_10_4_X)
19233 craig 445
	# gcc/mac
446
	IF(WANT_UNIVERSAL_BUNDLE)
447
		MESSAGE("Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
448
		SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
449
		SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
19260 craig 450
		IF (WANT_OSX_SDK)
451
			SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
452
		ENDIF (WANT_OSX_SDK)
19233 craig 453
	ELSE(WANT_UNIVERSAL_BUNDLE)
454
		IF(ARCH_PPC OR ARCH_PPC_64)
455
			MESSAGE("Setting PPC Architecture for OSX Build/Bundle")
456
			SET(CMAKE_OSX_ARCHITECTURES "ppc" )
457
			SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
458
		ELSE(ARCH_PPC OR ARCH_PPC_64)
19260 craig 459
			IF (WANT_OSX_SDK)
460
				SET(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}")
461
			ENDIF (WANT_OSX_SDK)
19233 craig 462
			IF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
463
				MESSAGE("Setting x86_64 Architecture for OSX Build/Bundle")
464
				SET(CMAKE_OSX_ARCHITECTURES "x86_64" )
465
				SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
466
			ELSE(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
467
				MESSAGE("Setting i386 Architecture for OSX Build/Bundle")
468
				SET(CMAKE_OSX_ARCHITECTURES "i386" )
469
				SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
470
			ENDIF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
471
		ENDIF(ARCH_PPC OR ARCH_PPC_64)
472
	ENDIF(WANT_UNIVERSAL_BUNDLE)
473
	MESSAGE(STATUS "${CMAKE_OSX_ARCHITECTURES} ${CMAKE_OSX_SYSROOT}")
474
	SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
475
	SET(ENV{LD_PREBIND} 1 )
476
	SET(ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
477
	IF (WANT_DEBUG)
478
		SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
479
		SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
480
	ENDIF (WANT_DEBUG)
481
	IF (WANT_RELEASEWITHDEBUG)
482
		SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
483
		SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
484
	ENDIF (WANT_RELEASEWITHDEBUG)
485
	IF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
486
		SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
487
		SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
488
	ENDIF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
5468 avox 489
ELSE(APPLE)
19233 craig 490
	IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
491
		# Windows build with Visual Studio
492
		# Surely there's a better way to identify the compiler?
493
		SET(CMAKE_CXX_FLAGS_DEBUG)
494
		SET(CMAKE_C_FLAGS_DEBUG)
495
	ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
496
		# vanilla gcc
497
		SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
498
		SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
499
		IF (_machine_x86 OR _machine_x86_64)
500
			SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
501
			SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
502
		ENDIF (_machine_x86 OR _machine_x86_64)
503
	ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5468 avox 504
ENDIF(APPLE)
9680 cbradney 505
 
10750 craig 506
IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
19233 craig 507
	SET(CMAKE_CXX_FLAGS_RELEASE)
508
	SET(CMAKE_C_FLAGS_RELEASE)
10750 craig 509
ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
19233 craig 510
	SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -fPIC")
511
	SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIC")
512
	ADD_DEFINITIONS(-DNDEBUG)
10750 craig 513
ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5142 cbradney 514
 
10750 craig 515
IF(WIN32)
20014 craig 516
	ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN
517
					-DAVOID_WIN32_FILEIO
518
					-D_CRT_SECURE_NO_DEPRECATE
519
					-D_USE_MATH_DEFINES
520
					-DCOMPILE_PLUGIN_AS_DLL
521
					)
522
	SET(BUILD_WINDOWS_VERSION 1)
523
	SET(DLL_USE_NATIVE_API 1)
10750 craig 524
ENDIF(WIN32)
525
 
10215 cbradney 526
##############################################################################################################
527
########## Find Dependencies                                                                        ##########
5466 cbradney 528
 
9680 cbradney 529
#<< Qt
20014 craig 530
SET (QT_MIN_VERSION "5.2.0")
531
SET(CMAKE_PREFIX_PATH "${QT_PREFIX}/lib/cmake")
532
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
533
FIND_PACKAGE(Qt5Core REQUIRED)
534
IF(Qt5Core_FOUND)
535
	MESSAGE(STATUS "----- USE QT 5-----")
536
ELSE(Qt5Core_FOUND)
537
	MESSAGE(FATAL_ERROR "ERROR: No QT 5 found")
538
ENDIF(Qt5Core_FOUND)
539
FIND_PACKAGE(Qt5Widgets REQUIRED)
540
IF(Qt5Widgets_FOUND)
541
	MESSAGE(STATUS "----- USE QT Widgets-----")
542
ELSE(Qt5Widgets_FOUND)
543
	MESSAGE(FATAL_ERROR "ERROR: No QT Widgets found")
544
ENDIF(Qt5Widgets_FOUND)
545
FIND_PACKAGE(Qt5Gui REQUIRED)
546
IF(Qt5Gui_FOUND)
547
	MESSAGE(STATUS "----- USE Qt5Gui -----")
548
ELSE(Qt5Gui_FOUND)
549
	MESSAGE(FATAL_ERROR "ERROR: Qt5Gui found")
550
ENDIF(Qt5Gui_FOUND)
551
FIND_PACKAGE(Qt5Xml REQUIRED)
552
IF(Qt5Xml_FOUND)
553
	MESSAGE(STATUS "----- USE QT 5 XML -----")
554
ELSE(Qt5Xml_FOUND)
555
	MESSAGE(FATAL_ERROR "ERROR: No QT 5 XML found")
556
ENDIF(Qt5Xml_FOUND)
557
FIND_PACKAGE(Qt5WebKit REQUIRED)
558
IF(Qt5WebKit_FOUND)
559
	MESSAGE(STATUS "----- USE Qt5WebKit -----")
560
ELSE(Qt5WebKit_FOUND)
561
	MESSAGE(FATAL_ERROR "ERROR: No Qt5WebKit found")
562
ENDIF(Qt5WebKit_FOUND)
563
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
564
IF(Qt5WebKitWidgets_FOUND)
565
	MESSAGE(STATUS "----- USE Qt5WebKitWidgets -----")
566
ELSE(Qt5WebKitWidgets_FOUND)
567
	MESSAGE(FATAL_ERROR "ERROR: No Qt5WebKitWidgets found")
568
ENDIF(Qt5WebKitWidgets_FOUND)
569
FIND_PACKAGE(Qt5Network REQUIRED)
570
IF(Qt5Network_FOUND)
571
	MESSAGE(STATUS "----- USE Qt5Network -----")
572
ELSE(Qt5Network_FOUND)
573
	MESSAGE(FATAL_ERROR "ERROR: No Qt5Network found")
574
ENDIF(Qt5Network_FOUND)
575
FIND_PACKAGE(Qt5OpenGL REQUIRED)
576
IF(Qt5OpenGL_FOUND)
577
	MESSAGE(STATUS "----- USE Qt5OpenGL -----")
578
ELSE(Qt5OpenGL_FOUND)
579
	MESSAGE(FATAL_ERROR "ERROR: No Qt5OpenGL found")
580
ENDIF(Qt5OpenGL_FOUND)
581
FIND_PACKAGE(Qt5LinguistTools REQUIRED)
582
IF(Qt5LinguistTools_FOUND)
583
	MESSAGE(STATUS "----- USE Qt5LinguistTools -----")
584
ELSE(Qt5LinguistTools_FOUND)
585
	MESSAGE(FATAL_ERROR "ERROR: No Qt5LinguistTools found")
586
ENDIF(Qt5LinguistTools_FOUND)
587
FIND_PACKAGE(Qt5Quick REQUIRED)
588
IF(Qt5Quick_FOUND)
589
	MESSAGE(STATUS "----- USE Qt5Quick -----")
590
ELSE(Qt5Quick_FOUND)
591
	MESSAGE(FATAL_ERROR "ERROR: No Qt5Quick found")
592
ENDIF(Qt5Quick_FOUND)
593
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
594
IF(Qt5PrintSupport_FOUND)
595
	MESSAGE(STATUS "----- USE Qt5PrintSupport -----")
596
ELSE(Qt5PrintSupport_FOUND)
597
	MESSAGE(FATAL_ERROR "ERROR: No Qt5PrintSupport found")
598
ENDIF(Qt5PrintSupport_FOUND)
599
INCLUDE_DIRECTORIES(${Qt5Core_INCLUDE_DIRS})
600
ADD_DEFINITIONS(${Qt5Core_DEFINITIONS})
601
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
602
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})
603
INCLUDE_DIRECTORIES(${Qt5Gui_INCLUDE_DIRS})
604
ADD_DEFINITIONS(${Qt5Gui_DEFINITIONS})
605
INCLUDE_DIRECTORIES(${Qt5Xml_INCLUDE_DIRS})
606
ADD_DEFINITIONS(${Qt5Xml_DEFINITIONS})
607
INCLUDE_DIRECTORIES(${Qt5WebKit_INCLUDE_DIRS})
608
ADD_DEFINITIONS(${Qt5WebKit_DEFINITIONS})
609
INCLUDE_DIRECTORIES(${Qt5WebKitWidgets_INCLUDE_DIRS})
610
ADD_DEFINITIONS(${Qt5WebKitWidgets_DEFINITIONS})
611
INCLUDE_DIRECTORIES(${Qt5Network_INCLUDE_DIRS})
612
ADD_DEFINITIONS(${Qt5Network_DEFINITIONS})
613
INCLUDE_DIRECTORIES(${Qt5OpenGL_INCLUDE_DIRS})
614
ADD_DEFINITIONS(${Qt5OpenGL_DEFINITIONS})
615
INCLUDE_DIRECTORIES(${Qt5Quick_INCLUDE_DIRS})
616
ADD_DEFINITIONS(${Qt5Quick_DEFINITIONS})
617
INCLUDE_DIRECTORIES(${Qt5PrintSupport_INCLUDE_DIRS})
618
ADD_DEFINITIONS(${Qt5PrintSupport_DEFINITIONS})
9680 cbradney 619
#>> Qt
620
 
10818 craig 621
#<< ZLIB, PNG
622
IF (WIN32)
20014 craig 623
	# On win32 we can use Qt's zlib and libpng, so we use some
624
	# custom cmake includes. This permits us to honour the
625
	# USE_QT_ZLIB_PNGLIB flag if passed.
626
	SET(PNG_DIR ${CMAKE_MODULE_PATH})
627
	SET(ZLIB_DIR ${CMAKE_MODULE_PATH})
10818 craig 628
ENDIF (WIN32)
629
FIND_PACKAGE(ZLIB REQUIRED)
630
IF (ZLIB_FOUND)
20014 craig 631
	MESSAGE("ZLIB Library Found OK")
632
	SET(HAVE_LIBZ 1)
10818 craig 633
ENDIF(ZLIB_FOUND)
19112 craig 634
#FIND_PACKAGE(PNG REQUIRED)
635
#IF (PNG_FOUND)
20014 craig 636
#	MESSAGE("PNG Library Found OK")
19112 craig 637
#ENDIF(PNG_FOUND)
10818 craig 638
#>> ZLIB, PNG
639
 
13839 fschmid 640
IF (WANT_NOOSG)
20014 craig 641
	MESSAGE("Building without 3D Extension")
13839 fschmid 642
ELSE (WANT_NOOSG)
20014 craig 643
	FIND_PACKAGE(OSG)
644
	IF(OSG_FOUND)
645
		MESSAGE("OSG found OK")
646
		SET(HAVE_OSG 1)
647
		FIND_PACKAGE(OpenGL)
648
	ELSE(OSG_FOUND)
649
		MESSAGE("No OSG found, building without 3D Extension")
650
	ENDIF(OSG_FOUND)
13839 fschmid 651
ENDIF (WANT_NOOSG)
652
 
17954 jghali 653
#<< JPEG, TIFF
5142 cbradney 654
FIND_PACKAGE(JPEG REQUIRED)
655
IF (JPEG_FOUND)
20014 craig 656
	MESSAGE("JPEG Library Found OK")
5142 cbradney 657
ENDIF(JPEG_FOUND)
658
FIND_PACKAGE(TIFF REQUIRED)
659
IF (TIFF_FOUND)
20014 craig 660
	MESSAGE("TIFF Library Found OK")
661
	SET(HAVE_TIFF 1)
6211 cbradney 662
ELSE(TIFF_FOUND)
20014 craig 663
	MESSAGE(FATAL_ERROR "Could not find the TIFF Library")
5142 cbradney 664
ENDIF(TIFF_FOUND)
17954 jghali 665
#<< JPEG, TIFF
666
 
667
#<< PYTHON
18948 craig 668
#SET(PythonLibs_FIND_VERSION 2)
669
FIND_PACKAGE(PythonLibs 2 REQUIRED)
5142 cbradney 670
IF (PYTHON_LIBRARY)
20014 craig 671
	MESSAGE("Python Library Found OK")
672
	SET(HAVE_PYTHON 1)
673
	SET(COMPILE_PYTHON 1)
5142 cbradney 674
ENDIF(PYTHON_LIBRARY)
17954 jghali 675
#>> PYTHON
5142 cbradney 676
 
9680 cbradney 677
#<< FreeType2
20014 craig 678
FIND_PACKAGE(Freetype REQUIRED)
679
IF (FREETYPE_FOUND)
680
	MESSAGE(STATUS "FreeType2 Library Found OK")
681
	INCLUDE(CheckLibraryExists)
682
	CHECK_LIBRARY_EXISTS(${FREETYPE_LIBRARY} FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
683
	CHECK_LIBRARY_EXISTS(${FREETYPE_LIBRARY} FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
684
	# here we have an alternative
685
	# a) Setup CFLAGS with the FREETYPE_INCLUDE_DIR_freetype2 provided by cmake
686
	# b) Insert ${FREETYPE_INCLUDE_DIRS} in include sections of CMakeLists that need it
687
	# I prefer (b) and at some point & from my opinion it should  be just needed in scribus/fonts/CmakeLists.txt - pm
688
ELSE (FREETYPE_FOUND)
689
	MESSAGE(FATAL_ERROR "No Freetype Found")
690
ENDIF(FREETYPE_FOUND)
9680 cbradney 691
#>> FreeType2
5142 cbradney 692
 
9680 cbradney 693
#<<Render Library
18496 jghali 694
IF (WANT_PRIVATE_CAIRO)
20014 craig 695
	MESSAGE("We no longer support the private cairo library as the latest public release is more up to date, setting WANT_SYSTEM_CAIRO=1")
17563 craig 696
ENDIF(WANT_PRIVATE_CAIRO)
7013 cbradney 697
 
18496 jghali 698
IF (RENDER_LIB)
20014 craig 699
	IF (RENDER_LIB STREQUAL "QTARTHUR")
700
		MESSAGE("Qt4's Arthur as renderer is not supported anymore, performing renderer detection again")
701
	ENDIF (RENDER_LIB STREQUAL "QTARTHUR")
18496 jghali 702
ENDIF(RENDER_LIB)
5142 cbradney 703
 
18496 jghali 704
SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
705
FIND_PACKAGE(CAIRO REQUIRED)
706
IF(CAIRO_FOUND)
20014 craig 707
	MESSAGE("CAIRO Library Found OK")
708
	SET(RENDER_LIB "CAIRO_SYSTEM" CACHE TYPE STRING)
18496 jghali 709
ELSE(CAIRO_FOUND)
20014 craig 710
	MESSAGE(FATAL_ERROR "No Cairo Found")
18496 jghali 711
ENDIF(CAIRO_FOUND)
9680 cbradney 712
#>>Render Library
713
 
714
#<<CUPS
18186 craig 715
IF(NOT WIN32 AND NOT HAIKU)
20014 craig 716
	FIND_PACKAGE(Cups REQUIRED)
717
	IF(CUPS_FOUND)
718
		SET(HAVE_CUPS 1)
719
		MESSAGE("CUPS Library Found OK")
720
	ENDIF(CUPS_FOUND)
18186 craig 721
ELSE(NOT WIN32 AND NOT HAIKU)
20014 craig 722
	# Windows doesn't use CUPS
723
	SET(CUPS_INCLUDE_DIR)
18186 craig 724
ENDIF(NOT WIN32 AND NOT HAIKU)
9680 cbradney 725
#>>CUPS
5142 cbradney 726
 
9680 cbradney 727
#<<LibXML2
7203 cbradney 728
FIND_PACKAGE(LibXml2 REQUIRED)
5142 cbradney 729
IF(LIBXML2_FOUND)
20014 craig 730
	SET(HAVE_XML 1)
731
	MESSAGE("LIBXML2 Library Found OK")
5142 cbradney 732
ENDIF(LIBXML2_FOUND)
9680 cbradney 733
#>>LibXML2
5142 cbradney 734
 
9680 cbradney 735
#<<LittleCMS
5142 cbradney 736
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
18497 jghali 737
FIND_PACKAGE(LCMS2 REQUIRED)
15143 fschmid 738
IF(LCMS2_FOUND)
20014 craig 739
	SET(HAVE_LCMS2 1)
740
	SET(HAVE_CMS 1)
741
	SET(CMS_INC "\"lcms2.h\"")
742
	MESSAGE("LittleCMS-2 Library Found OK")
15143 fschmid 743
ELSE(LCMS2_FOUND)
20014 craig 744
	MESSAGE(FATAL_ERROR "Could not find the LittleCMS 2 Library")
15143 fschmid 745
ENDIF(LCMS2_FOUND)
9680 cbradney 746
#>>LittleCMS
5142 cbradney 747
 
9680 cbradney 748
#<<FontConfig
10747 craig 749
IF(NOT WIN32)
20014 craig 750
	SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
751
	FIND_PACKAGE(FONTCONFIG)
752
	IF(FONTCONFIG_FOUND)
753
		MESSAGE("FontConfig Found OK")
754
		SET(HAVE_FONTCONFIG 1)
755
	ENDIF(FONTCONFIG_FOUND)
10747 craig 756
ELSE(NOT WIN32)
20014 craig 757
	# Windows builds neither use nor require fontconfig
758
	SET(FONTCONFIG_INCLUDE_DIR)
10747 craig 759
ENDIF(NOT WIN32)
9680 cbradney 760
#>>FontConfig
5142 cbradney 761
 
17501 craig 762
#<<HUNSPELL for Speelling support
18099 craig 763
OPTION(WANT_HUNSPELL "Enable support for spell checking with hunspell" ON)
17501 craig 764
IF (WANT_HUNSPELL)
20014 craig 765
	FIND_PACKAGE(HUNSPELL)
766
	IF (HUNSPELL_FOUND)
767
		MESSAGE("Hunspell Found OK")
768
		SET(HAVE_HUNSPELL 1)
769
	ELSE (HUNSPELL_FOUND)
770
		MESSAGE("Hunspell or its developer libraries NOT found - Disabling support for spell checking")
771
	ENDIF (HUNSPELL_FOUND)
17501 craig 772
ENDIF (WANT_HUNSPELL)
773
#>>HUNSPELL for Speelling support
11106 cbradney 774
 
10238 cbradney 775
#<<PoDoFo for AI PDF import
14968 cbradney 776
OPTION(WITH_PODOFO "Enable support for PDF embedded in AI" ON)
777
IF (WITH_PODOFO)
20014 craig 778
	FIND_PACKAGE(LIBPODOFO)
779
	IF (LIBPODOFO_FOUND)
780
		MESSAGE("PoDoFo found OK")
781
		SET(HAVE_PODOFO 1)
782
	ELSE (LIBPODOFO_FOUND)
783
		MESSAGE("PoDoFo NOT found - Disabling support for PDF embedded in AI")
784
	ENDIF (LIBPODOFO_FOUND)
14968 cbradney 785
ENDIF (WITH_PODOFO)
10238 cbradney 786
#>>PoDoFo for AI PDF import
10234 fschmid 787
 
14937 fschmid 788
#<<Boost for 2Geom Tools
14968 cbradney 789
OPTION(WITH_BOOST "Enable support for Boost based enhancements" ON)
790
IF (WITH_BOOST)
20014 craig 791
	FIND_PACKAGE(Boost)
792
	IF (Boost_FOUND)
793
		MESSAGE("Boost Library Found OK")
794
		SET(HAVE_BOOST 1)
795
	ELSE(Boost_FOUND)
796
		MESSAGE("Boost: NOT FOUND, not building 2geomtools")
797
	ENDIF (Boost_FOUND)
14968 cbradney 798
ENDIF (WITH_BOOST)
14937 fschmid 799
#>>Boost for 2Geom Tools
800
 
15714 christoph 801
#<<GraphicksMagick for image import
14516 cbradney 802
IF (WANT_GRAPHICSMAGICK)
20014 craig 803
	SET(GMAGICK_DIR ${CMAKE_MODULE_PATH})
804
	pkg_check_modules(GMAGICK GraphicsMagick)
805
	# FIND_PACKAGE(GMAGICK)
806
	IF(GMAGICK_FOUND)
807
		MESSAGE("GraphicksMagick Found OK")
808
	ELSE(GMAGICK_FOUND)
809
		MESSAGE("GraphicksMagick NOT found! Building without additional image format support!")
810
	ENDIF(GMAGICK_FOUND)
14516 cbradney 811
ELSE (WANT_GRAPHICSMAGICK)
20014 craig 812
	MESSAGE("Building without GraphicksMagick (use -DWANT_GRAPHICSMAGICK=1 to enable)")
14516 cbradney 813
ENDIF (WANT_GRAPHICSMAGICK)
15714 christoph 814
#>>GraphicksMagick for image import
13957 herm 815
 
16729 fschmid 816
#<<Poppler for PDF import
817
FIND_PACKAGE(POPPLER)
818
IF (POPPLER_FOUND)
819
	IF (FREETYPE_FOUND)
820
		SET( HAVE_POPPLER 1 )
821
		MESSAGE(STATUS "Found poppler")
822
		MESSAGE(STATUS "Found poppler libs: ${POPPLER_LIBRARY}")
823
		MESSAGE(STATUS "Found poppler includes: ${POPPLER_INCLUDE_DIR}")
824
	ELSE (FREETYPE_FOUND)
825
		MESSAGE("Poppler NOT found - Disabling support for native PDF import")
826
	ENDIF (FREETYPE_FOUND)
827
ELSE (POPPLER_FOUND)
828
	MESSAGE("Poppler NOT found - Disabling support for native PDF import")
829
ENDIF (POPPLER_FOUND)
830
#>>Poppler for PDF import
831
 
19222 fschmid 832
# librevenge for MsPub import
833
pkg_check_modules(LIBREVENGE librevenge-0.0)
834
IF (LIBREVENGE_FOUND)
835
	pkg_check_modules(LIBREVENGE_STREAM librevenge-stream-0.0)
836
	IF (LIBREVENGE_STREAM_FOUND)
837
		pkg_check_modules(LIBREVENGE_GENERATORS librevenge-generators-0.0)
838
		IF (LIBREVENGE_GENERATORS_FOUND)
839
			SET(HAVE_REVENGE 1)
840
		ENDIF (LIBREVENGE_GENERATORS_FOUND)
841
	ENDIF (LIBREVENGE_STREAM_FOUND)
842
ENDIF (LIBREVENGE_FOUND)
16729 fschmid 843
 
10215 cbradney 844
##############################################################################################################
845
########## Include Setup                                                                            ##########
8499 cbradney 846
 
10215 cbradney 847
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
19222 fschmid 848
 
5142 cbradney 849
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
850
IF(HAVE_DLFCN_H)
20014 craig 851
	ADD_DEFINITIONS(-DHAVE_DLFCN_H)
5142 cbradney 852
ENDIF(HAVE_DLFCN_H)
853
 
854
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
855
IF(HAVE_UNISTD_H)
20014 craig 856
	ADD_DEFINITIONS(-DHAVE_UNISTD_H)
5142 cbradney 857
ENDIF(HAVE_UNISTD_H)
858
 
859
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
860
# IF(HAVE_SYS_TYPES_H)
861
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
862
# ENDIF(HAVE_SYS_TYPES_H)
863
 
864
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
865
# IF(HAVE_SYS_STAT_H)
866
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
867
# ENDIF(HAVE_SYS_STAT_H)
9680 cbradney 868
#>>Test for existing include files
5142 cbradney 869
 
870
 
5150 cbradney 871
#Create configure files.. config.h and uninstall
872
#config.h
5142 cbradney 873
INCLUDE (ConfigureChecks.cmake)
20014 craig 874
	IF(WIN32)
875
		SET(CONFIG_NAME win-config.h)
876
	ELSE(WIN32)
877
		SET(CONFIG_NAME config.h)
878
	ENDIF(WIN32)
10779 craig 879
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
5142 cbradney 880
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
9680 cbradney 881
 
5142 cbradney 882
 
5150 cbradney 883
 
5157 cbradney 884
#Set up include dirs with all found packages
5142 cbradney 885
INCLUDE_DIRECTORIES(
20014 craig 886
	${CMAKE_BINARY_DIR}
887
	${CMAKE_BINARY_DIR}/scribus
888
	${QT_INCLUDES}
889
	${FREETYPE_INCLUDE_DIR}
890
	${FONTCONFIG_INCLUDE_DIR}
891
	${JPEG_INCLUDE_DIR}
892
	${LCMS2_INCLUDE_DIR}
893
	${LIBXML2_INCLUDE_DIR}
894
	${TIFF_INCLUDE_DIR}
895
	${ZLIB_INCLUDE_DIR}
896
	${OPENGL_INCLUDE_DIR}
897
	${OSG_INCLUDE_DIR}
898
	${GSL_INCLUDE_DIR}
5142 cbradney 899
)
900
 
18186 craig 901
IF (NOT WIN32 AND NOT HAIKU)
902
INCLUDE_DIRECTORIES(
20014 craig 903
	${CUPS_INCLUDE_DIR}
18186 craig 904
)
905
ENDIF (NOT WIN32 AND NOT HAIKU)
906
 
10215 cbradney 907
##############################################################################################################
908
########## Uninstall Setup                                                                          ##########
909
 
910
CONFIGURE_FILE(
20014 craig 911
	"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
912
	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
913
	IMMEDIATE @ONLY
10215 cbradney 914
)
915
 
916
ADD_CUSTOM_TARGET(uninstall
20014 craig 917
	"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
918
)
19222 fschmid 919
 
920
 
10215 cbradney 921
##############################################################################################################
922
########## Add our subdirs                                                                          ##########
923
 
5157 cbradney 924
#Add our source subdirs
5142 cbradney 925
ADD_SUBDIRECTORY(scribus)
13527 cbradney 926
ADD_SUBDIRECTORY(doc)
14098 cbradney 927
ADD_SUBDIRECTORY(resources/dicts)
14097 cbradney 928
ADD_SUBDIRECTORY(resources/editorconfig)
14095 cbradney 929
ADD_SUBDIRECTORY(resources/icons)
14096 cbradney 930
ADD_SUBDIRECTORY(resources/keysets)
14097 cbradney 931
ADD_SUBDIRECTORY(resources/loremipsum)
14096 cbradney 932
ADD_SUBDIRECTORY(resources/profiles)
14047 cbradney 933
ADD_SUBDIRECTORY(resources/swatches)
14097 cbradney 934
ADD_SUBDIRECTORY(resources/templates)
18404 craig 935
ADD_SUBDIRECTORY(resources/translations)
5142 cbradney 936
 
5157 cbradney 937
#Install our READMEs etc.
5142 cbradney 938
INSTALL(FILES
19171 craig 939
	AUTHORS
940
	BUILDING
941
	ChangeLog
942
	ChangeLogSVN
943
	COPYING
944
	LINKS
945
	NEWS
946
	PACKAGING
947
	README
948
	TODO
949
	TRANSLATION
950
	DESTINATION ${DOCDIR}
5142 cbradney 951
)
9386 cbradney 952
 
17500 craig 953
IF (APPLE)
20014 craig 954
	INSTALL(FILES
955
		README.MacOSX
956
		DESTINATION ${DOCDIR}
957
	)
18763 craig 958
 
20014 craig 959
	#	EXECUTE_PROCESS (COMMAND mkdir -p "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats")
960
	#	IF (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
961
	#MESSAGE(STATUS ${QT_PREFIX})
962
	#MESSAGE(STATUS "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib")
963
	#MESSAGE(STATUS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
964
	#		EXECUTE_PROCESS (COMMAND ditto "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib" "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
965
	#	ENDIF()
18763 craig 966
 
17500 craig 967
ENDIF (APPLE)
968
 
9680 cbradney 969
#Install our MIME data
6319 mrdocs 970
INSTALL(FILES
20014 craig 971
	scribus.xml
972
	DESTINATION ${MIMEDIR}
6319 mrdocs 973
)
11715 malex 974
#KDE workaround until it starts supporting freedesktop spec
975
INSTALL(FILES
20014 craig 976
	vnd.scribus.desktop
977
	DESTINATION ${MIMELNKDIR}
11715 malex 978
)
5396 cbradney 979
 
9680 cbradney 980
#If building an Apple bundle, install these specific files
981
IF(APPLEBUNDLE)
20014 craig 982
	INSTALL(FILES
983
		Scribus.app/Contents/Info.plist
984
		DESTINATION ${CMAKE_INSTALL_PREFIX}
985
	)
986
	INSTALL(FILES
987
		Scribus.app/Contents/Resources/Scribus.icns
988
		Scribus.app/Contents/Resources/Scribus-doc.icns
989
		DESTINATION ${CMAKE_INSTALL_PREFIX}/Resources
990
	)
9680 cbradney 991
ENDIF(APPLEBUNDLE)
9386 cbradney 992
 
10215 cbradney 993
##############################################################################################################
994
########## Install/CPack Setup                                                                      ##########
995
 
9680 cbradney 996
# If the cmake version includes cpack, use it for tarball building
5396 cbradney 997
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
20014 craig 998
	SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
999
	SET(CPACK_PACKAGE_VENDOR "Scribus Team")
1000
	SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
1001
	SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
1002
	SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
1003
	SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
1004
	SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
1005
	SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
1006
	SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
1007
	SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus-${VERSION}${VERSION_SUFFIX}")
1008
	SET(CPACK_SOURCE_GENERATOR TBZ2)
1009
	SET(CPACK_SYSTEM_NAME "")
1010
	SET(CPACK_TOPLEVEL_TAG "")
1011
	SET(CPACK_SOURCE_IGNORE_FILES
1012
		CMakeCache.txt
1013
		scribus-1.5.0.svn.tar.bz2
1014
		scribus-1.5.0.svn.tar.Z
1015
		scribus-1.5.0.svn.tar.gz
1016
		"~$"
1017
		"\\\\.cvsignore$"
1018
		"\\\\.o$"
1019
		"\\\\.svn-base$"
1020
		"\\\\.svn$"
1021
		"^${PROJECT_SOURCE_DIR}.*/CVS/"
1022
		"^${PROJECT_SOURCE_DIR}/debian/"
1023
		"^${PROJECT_SOURCE_DIR}/old/"
1024
		"^${PROJECT_SOURCE_DIR}.*/CVSROOT/"
1025
		"^${PROJECT_SOURCE_DIR}/admin/"
1026
	)
1027
	INCLUDE(CPack)
5463 avox 1028
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
14097 cbradney 1029
 
20014 craig 1030
#include (cmakeconfigreport optional)