Subversion Repositories Scribus

Rev

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