Subversion Repositories Scribus

Rev

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