Subversion Repositories Scribus

Rev

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