Subversion Repositories Scribus

Rev

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