Subversion Repositories Scribus

Rev

Rev 17485 | Rev 17538 | 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
14842 mrdocs 7
#its not likely 2.4.x will work any more
8
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
5758 cbradney 9
 
14910 cbradney 10
#IF(WIN32)
11
#  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.6)
12
#    MESSAGE(FATAL_ERROR "Windows builds require CMake 2.6")
13
#  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.6)
14
#ENDIF(WIN32)
10818 craig 15
 
9680 cbradney 16
#Pretty colors
5142 cbradney 17
SET(CMAKE_COLOR_MAKEFILE ON)
9680 cbradney 18
#Dont force verbose
9715 avox 19
SET(CMAKE_VERBOSE_MAKEFILE OFF)
9680 cbradney 20
#Include current dir
5142 cbradney 21
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
16362 malex 22
 
10459 cbradney 23
#RPATH setup - more below too
10327 cbradney 24
IF (WANT_NORPATH OR WANT_DISTROBUILD)
16362 malex 25
    SET(CMAKE_SKIP_RPATH TRUE)
10327 cbradney 26
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
16362 malex 27
    SET(CMAKE_SKIP_BUILD_RPATH TRUE)
28
    SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
29
    SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
30
    SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
10327 cbradney 31
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
8902 cbradney 32
 
10215 cbradney 33
INCLUDE(CheckIncludeFile)
34
INCLUDE(CheckCCompilerFlag)
35
INCLUDE(CheckCXXCompilerFlag)
36
INCLUDE(CheckTypeSize)
37
INCLUDE(TestBigEndian)
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                                                                  ##########
44
 
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
14910 cbradney 77
#Final version is ${VERSION} = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_SUFFIX}
78
#where VERSION_SUFFIX is of the form "", "svn" or "Nsvn" (N being the minor patch level)
5396 cbradney 79
SET (VERSION_MAJOR "1")
16067 mrdocs 80
SET (VERSION_MINOR "4")
17485 craig 81
SET (VERSION_PATCH "2")
82
SET (VERSION_SUFFIX "svn")
14910 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
)
109
 
14453 cbradney 110
MESSAGE(STATUS  "Machine: ${MACHINE}, void pointer size: ${CMAKE_SIZEOF_VOID_P}")
10238 cbradney 111
STRING(REGEX MATCH "(i?86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
112
IF (_machine_x86)
113
    MESSAGE(STATUS "Found target X86")
114
    SET(ARCH_X86 1)
115
ENDIF (_machine_x86)
14453 cbradney 116
IF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND ARCH_X86 EQUAL 1)
117
  MESSAGE(STATUS "Found Snow Leopard Target: Apple, 64 bit, X86")
118
  UNSET(ARCH_X86)
119
  SET(ARCH_X86_64 1)
120
  SET(APPLE_10_6_X 1 CACHE TYPE BOOL)
121
ENDIF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND ARCH_X86 EQUAL 1)
10238 cbradney 122
 
123
STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _machine_x86_64 "${MACHINE}")
124
IF (_machine_x86_64)
125
    MESSAGE(STATUS "Found target X86_64")
126
    SET(ARCH_X86_64 1)
127
ENDIF (_machine_x86_64)
128
 
11407 cbradney 129
STRING(REGEX MATCH "(sparc64-*)|(SPARC64-*)" _machine_sparc_64 "${MACHINE}")
130
IF (_machine_sparc_64)
131
    MESSAGE(STATUS "Found target SPARC 64")
132
    SET(ARCH_SPARC_64 1)
133
ENDIF (_machine_sparc_64)
134
 
135
STRING(REGEX MATCH "(mips64-*)|(MIPS64-*)" _machine_mips_64 "${MACHINE}")
136
IF (_machine_mips_64)
137
    MESSAGE(STATUS "Found target MIPS 64")
138
    SET(ARCH_MIPS_64 1)
139
ENDIF (_machine_mips_64)
140
 
14420 malex 141
STRING(REGEX MATCH "(mips-*)|(MIPS-*)" _machine_mips "${MACHINE}")
142
IF (_machine_mips)
143
    MESSAGE(STATUS "Found target MIPS")
144
    SET(ARCH_MIPS 1)
145
ENDIF (_machine_mips)
146
 
147
STRING(REGEX MATCH "(hppa-*)" _machine_hppa "${MACHINE}")
148
IF (_machine_hppa)
149
    MESSAGE(STATUS "Found target HPPA")
150
    SET(ARCH_HPPA 1)
151
ENDIF (_machine_hppa)
152
 
12570 cbradney 153
STRING(REGEX MATCH "(ppc-*)|(powerpc-*)" _machine_ppc "${MACHINE}")
10238 cbradney 154
IF (_machine_ppc)
155
    MESSAGE(STATUS "Found target PPC")
156
    SET(ARCH_PPC 1)
157
ENDIF (_machine_ppc)
158
 
12570 cbradney 159
STRING(REGEX MATCH "(ppc64-*)|(PPC64-*)|(powerpc64-*)" _machine_ppc_64 "${MACHINE}")
11407 cbradney 160
IF (_machine_ppc_64)
161
    MESSAGE(STATUS "Found target PPC64")
162
    SET(ARCH_PPC_64 1)
163
ENDIF (_machine_ppc_64)
164
 
12074 mrdocs 165
STRING(REGEX MATCH "(sparc-*)" _machine_sparc "${MACHINE}")
166
IF (_machine_sparc)
167
    MESSAGE(STATUS "Found target Sparc")
168
    SET(ARCH_SPARC 1)
169
ENDIF (_machine_sparc)
170
 
171
STRING(REGEX MATCH "(sparcv9-*)" _machine_sparcv9 "${MACHINE}")
172
IF (_machine_sparcv9)
173
    MESSAGE(STATUS "Found target Sparc v9")
174
    SET(ARCH_SPARCV9 1)
175
ENDIF (_machine_sparcv9)
176
 
177
STRING(REGEX MATCH "(sparc64-*)" _machine_sparc64 "${MACHINE}")
178
IF (_machine_sparc64)
179
    MESSAGE(STATUS "Found target Sparc64")
180
    SET(ARCH_SPARC64 1)
181
    SET(ARCH64BIT 1)
182
ENDIF (_machine_sparc64)
183
 
11407 cbradney 184
#convert any 64 bit build into generic 64 tag for below
185
IF (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64)
186
  SET(ARCH64BIT 1)
187
ENDIF (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64)
188
 
189
MESSAGE(STATUS "Building for target ${MACHINE}")
190
 
10238 cbradney 191
##############################################################################################################
10215 cbradney 192
########## Versioning Setup                                                                         ##########
193
 
9409 cbradney 194
#On Apple, we ignore the versioning tag so all items are "scribus" not "scribus-version"
9508 cbradney 195
IF (NOT BUILD_OSX_BUNDLE)
9680 cbradney 196
  SET(BUILD_OSX_BUNDLE ${APPLE} CACHE TYPE BOOL)
9508 cbradney 197
ENDIF (NOT BUILD_OSX_BUNDLE)
198
 
9680 cbradney 199
#Simplify future conditionals for Apple
200
IF (APPLE AND BUILD_OSX_BUNDLE)
201
  SET(APPLEBUNDLE TRUE CACHE TYPE BOOL)
202
ENDIF (APPLE AND BUILD_OSX_BUNDLE)
203
 
204
#Announce we cached a version request before, overridden below for OSX
9508 cbradney 205
IF(TAG_VERSION)
9680 cbradney 206
  IF (NOT APPLEBUNDLE)
207
    MESSAGE(STATUS "Previously selected version tag: ${TAG_VERSION}")
208
  ENDIF (NOT APPLEBUNDLE)
6891 cbradney 209
  SET(WANT_VERSIONING 1)
210
  SET(CACHED_VERSIONING 1)
9508 cbradney 211
ENDIF(TAG_VERSION)
212
 
9680 cbradney 213
#Remove version tags on OSX so our bundle is Scribus.app
214
IF (APPLEBUNDLE)
215
  IF (WANT_VERSIONING OR CACHED_VERSIONING)
216
    MESSAGE(STATUS "Ignoring version tag on OSX when building bundle")
217
    SET(WANT_VERSIONING 0)
218
    SET(CACHED_VERSIONING 0)
219
  ENDIF (WANT_VERSIONING OR CACHED_VERSIONING)
220
ENDIF (APPLEBUNDLE)
9508 cbradney 221
 
9680 cbradney 222
#Store our version string if require
6891 cbradney 223
IF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
5396 cbradney 224
  IF (NOT CUSTOM_VERSIONTAG)
6891 cbradney 225
    SET(TAG_VERSION "-${VERSION}" CACHE TYPE STRING)
5396 cbradney 226
  ELSE (NOT CUSTOM_VERSIONTAG)
6891 cbradney 227
    SET(TAG_VERSION ${CUSTOM_VERSIONTAG} CACHE TYPE STRING)
5396 cbradney 228
  ENDIF (NOT CUSTOM_VERSIONTAG)
6891 cbradney 229
ENDIF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
5379 cbradney 230
 
10215 cbradney 231
##############################################################################################################
232
########## Install/Directory Setup                                                                  ##########
233
 
12457 avox 234
IF (APPLEBUNDLE)
235
  IF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
236
    # all ok
237
  ELSE ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
238
    IF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
239
      # add "/Contents" subpath
240
      SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Contents")
241
    ELSE ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
242
      # no bundle name spcified, use appname and version
243
      SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Scribus${VERSION}.app/Contents")
244
    ENDIF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
245
  ENDIF ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
246
 
247
  MESSAGE(STATUS "APPLEBUNDLE install prefix: ${CMAKE_INSTALL_PREFIX}")
248
ENDIF (APPLEBUNDLE)
249
 
250
 
9680 cbradney 251
#Setp all the directories we will use
7269 cbradney 252
#MAN
13271 fschmid 253
CMAKE_POLICY(SET CMP0005 OLD)
7269 cbradney 254
SET(MANDIR "share/man/")
16344 malex 255
IF(WANT_VERSIONING)
256
    SET(SHAREDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/")
257
ELSE(WANT_VERSIONING)
258
    SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
259
ENDIF(WANT_VERSIONING)
5142 cbradney 260
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
9680 cbradney 261
 
9409 cbradney 262
#SHARE - use the default on Apple as TAG_VERSION is empty
14948 jghali 263
IF(WIN32 OR OS2)
264
  SET(DOCDIR "share/doc/")
265
ELSE (WIN32 OR OS2)
266
  IF(TAG_VERSION OR BUILD_OSX_BUNDLE)
267
    SET(DOCDIR "share/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
268
  ELSE(TAG_VERSION OR BUILD_OSX_BUNDLE)
16346 malex 269
        IF(NOT WANT_VERSIONING)
270
            SET(DOCDIR "share/doc/${MAIN_DIR_NAME}/")
271
        ELSE(NOT WANT_VERSIONING)
272
            SET(DOCDIR "share/doc/${MAIN_DIR_NAME}-${VERSION}/")
273
        ENDIF(NOT WANT_VERSIONING)
14948 jghali 274
  ENDIF (TAG_VERSION OR BUILD_OSX_BUNDLE)
275
ENDIF (WIN32 OR OS2)
5142 cbradney 276
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
9680 cbradney 277
 
7269 cbradney 278
#ICON
10779 craig 279
IF(WIN32)
280
  SET(ICONDIR "share/icons/")
281
ELSE(WIN32)
282
  SET(ICONDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
283
ENDIF(WIN32)
5142 cbradney 284
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
9680 cbradney 285
 
7269 cbradney 286
#SAMPLES
5379 cbradney 287
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
5142 cbradney 288
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
9680 cbradney 289
 
7269 cbradney 290
#SCRIPTS
5379 cbradney 291
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
5142 cbradney 292
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
9680 cbradney 293
 
7269 cbradney 294
#TEMPLATES
10779 craig 295
IF(WIN32)
296
  SET(TEMPLATEDIR "share/templates/")
297
ELSE(WIN32)
298
  SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
299
ENDIF(WIN32)
5142 cbradney 300
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
9680 cbradney 301
 
9660 cbradney 302
#DESKTOP
9653 mrdocs 303
SET(DESKTOPDIR "share/applications/")
304
ADD_DEFINITIONS("-DDESKTOPDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DESKTOPDIR}\\\"")
9680 cbradney 305
 
13066 subik 306
# APPLICATION_DATA_DIR
307
# It allows specify the user configuration directory in the compile time.
308
# Example: I want to use special ~/.scribus135svn config directory for my trunk
309
#          cmake -DAPPLICATION_DATA_DIR=.scribus135svn ...
310
IF (APPLICATION_DATA_DIR)
13171 cbradney 311
	MESSAGE(STATUS "Using ApplicationDataDir ${APPLICATION_DATA_DIR} instead of the platform default.")
13066 subik 312
    ADD_DEFINITIONS("-DAPPLICATION_DATA_DIR=\\\"${APPLICATION_DATA_DIR}\\\"")
313
ELSE (APPLICATION_DATA_DIR)
314
    MESSAGE(STATUS "Using standard ApplicationDataDir. You can change it with -DAPPLICATION_DATA_DIR")
315
ENDIF (APPLICATION_DATA_DIR)
316
 
10161 cbradney 317
#LIB LOCATION - lib or lib64 normally
7269 cbradney 318
#LIB
10161 cbradney 319
IF(WANT_LIB64)
10239 cbradney 320
  IF(NOT ARCH_X86_64)
321
    MESSAGE(STATUS "WARNING: BUILDING 64 Bit build on non 64 bit architecture")
322
  ENDIF(NOT ARCH_X86_64)
323
  SET(LIB_SUFFIX "64" CACHE TYPE STRING)
10161 cbradney 324
ENDIF(WANT_LIB64)
10239 cbradney 325
SET(LIB_DIR_NAME "lib${LIB_SUFFIX}")
10161 cbradney 326
SET(LIBDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 327
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
9680 cbradney 328
 
7269 cbradney 329
#PLUGINS
10779 craig 330
IF(WIN32)
10781 craig 331
  SET(PLUGINDIR "plugins")
332
ELSE(WIN32)
10779 craig 333
  SET(PLUGINDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
334
ENDIF(WIN32)
5142 cbradney 335
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
9680 cbradney 336
 
9660 cbradney 337
#INCLUDE
338
SET(INCLUDEDIR "include/${MAIN_DIR_NAME}${TAG_VERSION}/")
339
#NO ADD DEFINITIONS, WE ONLY INSTALL WITH IT
9680 cbradney 340
 
7269 cbradney 341
#RPATH
10459 cbradney 342
IF (WANT_NORPATH OR WANT_DISTROBUILD)
343
  set(CMAKE_INSTALL_RPATH "")
344
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
345
  set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
346
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
5142 cbradney 347
 
6319 mrdocs 348
# Set the XDG mime stuff
6320 mrdocs 349
SET(MIMEDIR "share/mime/packages/")
11715 malex 350
SET(MIMELNKDIR "share/mimelnk/application/")
6319 mrdocs 351
 
10215 cbradney 352
##############################################################################################################
353
########## Build Setup                                                                              ##########
6319 mrdocs 354
 
9680 cbradney 355
#Convert our simpler command line option to the CMake style
5142 cbradney 356
#None, Debug, Release, .. or custom ones
7943 cbradney 357
# SET(WANT_DEBUG 1)
5142 cbradney 358
IF(WANT_DEBUG)
359
  SET(CMAKE_BUILD_TYPE Debug)
13238 cbradney 360
ENDIF(WANT_DEBUG)
361
IF (WANT_RELEASEWITHDEBUG)
362
  SET(CMAKE_BUILD_TYPE RelWithDebInfo)
363
ENDIF (WANT_RELEASEWITHDEBUG)
364
IF(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
5142 cbradney 365
  SET(CMAKE_BUILD_TYPE RELEASE)
13238 cbradney 366
ENDIF(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
5142 cbradney 367
 
13238 cbradney 368
 
369
 
9680 cbradney 370
#Based on our build type, setup our build options
5468 avox 371
IF(APPLE)
14453 cbradney 372
  IF(APPLE_10_6_X)
373
    SET(OSXMINVER "10.6" CACHE TYPE STRING)
14697 cbradney 374
  ELSE(APPLE_10_6_X)
14453 cbradney 375
    SET(OSXMINVER "10.4" CACHE TYPE STRING)
376
  ENDIF(APPLE_10_6_X)
10750 craig 377
  # gcc/mac
12556 cbradney 378
  IF(WANT_UNIVERSAL_BUNDLE)
379
    MESSAGE("Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
380
    SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
381
    SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
14697 cbradney 382
    SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
12559 cbradney 383
    SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
12556 cbradney 384
  ELSE(WANT_UNIVERSAL_BUNDLE)
385
    IF(ARCH_PPC OR ARCH_PPC_64)
386
      MESSAGE("Setting PPC Architecture for OSX Build/Bundle")
387
      SET(CMAKE_OSX_ARCHITECTURES "ppc" )
388
      SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
389
    ELSE(ARCH_PPC OR ARCH_PPC_64)
14453 cbradney 390
      IF(APPLE_10_6_X)
391
        MESSAGE("Setting x86_64 Architecture for OSX Build/Bundle")
392
        SET(CMAKE_OSX_ARCHITECTURES "x86_64" )
393
        SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
14697 cbradney 394
#        SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
14453 cbradney 395
      ELSE(APPLE_10_6_X)
396
        MESSAGE("Setting i386 Architecture for OSX Build/Bundle")
397
        SET(CMAKE_OSX_ARCHITECTURES "i386" )
398
        SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
14697 cbradney 399
#        SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
14453 cbradney 400
      ENDIF(APPLE_10_6_X)
12556 cbradney 401
    ENDIF(ARCH_PPC OR ARCH_PPC_64)
402
  ENDIF(WANT_UNIVERSAL_BUNDLE)
12528 cbradney 403
  MESSAGE(STATUS "${CMAKE_OSX_ARCHITECTURES} ${CMAKE_OSX_SYSROOT}")
14697 cbradney 404
  MESSAGE(STATUS "OSX Minimum Version: ${OSXMINVER}")
14453 cbradney 405
  SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
5468 avox 406
  SET( ENV{LD_PREBIND} 1 )
407
  SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
13238 cbradney 408
  IF (WANT_DEBUG)
17485 craig 409
	SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
410
	SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
13238 cbradney 411
  ENDIF (WANT_DEBUG)
412
  IF (WANT_RELEASEWITHDEBUG)
14453 cbradney 413
    SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
414
    SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
13238 cbradney 415
  ENDIF (WANT_RELEASEWITHDEBUG)
416
  IF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
14453 cbradney 417
    SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
418
    SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
13238 cbradney 419
  ENDIF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
5468 avox 420
ELSE(APPLE)
10750 craig 421
  IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
422
    # Windows build with Visual Studio
423
    # Surely there's a better way to identify the compiler?
424
    SET(CMAKE_CXX_FLAGS_DEBUG)
425
    SET(CMAKE_C_FLAGS_DEBUG)
426
  ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
427
    # vanilla gcc
428
    SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
429
    SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
12195 cbradney 430
 
431
    IF (_machine_x86 OR _machine_x86_64)
432
      SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
433
      SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
434
    ENDIF (_machine_x86 OR _machine_x86_64)
435
 
10750 craig 436
  ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5468 avox 437
ENDIF(APPLE)
9680 cbradney 438
 
10750 craig 439
IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
440
  SET(CMAKE_CXX_FLAGS_RELEASE)
441
  SET(CMAKE_C_FLAGS_RELEASE)
442
ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
12233 cbradney 443
  SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -fPIC")
444
  SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIC")
13271 fschmid 445
  ADD_DEFINITIONS(-DNDEBUG)
10750 craig 446
ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5142 cbradney 447
 
10750 craig 448
IF(WIN32)
449
  ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN
12167 cbradney 450
                  -DAVOID_WIN32_FILEIO
10750 craig 451
                  -D_CRT_SECURE_NO_DEPRECATE
12167 cbradney 452
                  -DCOMPILE_PLUGIN_AS_DLL
453
  )
10750 craig 454
  SET(BUILD_WINDOWS_VERSION 1)
455
  SET(SC_USE_GDI 1)
456
  IF(NOT SC_SHOULD_NOT_USE_GDIPLUS)
457
    SET(SC_USE_GDIPLUS 1)
458
  ENDIF(NOT SC_SHOULD_NOT_USE_GDIPLUS)
459
  SET(DLL_USE_NATIVE_API 1)
460
ENDIF(WIN32)
461
 
10215 cbradney 462
##############################################################################################################
463
########## Find Dependencies                                                                        ##########
5466 cbradney 464
 
9680 cbradney 465
#<< Qt
10719 cbradney 466
SET (QT_MT_REQUIRED TRUE)
15341 jghali 467
SET (QT_MIN_VERSION "4.6.0")
16928 craig 468
IF(APPLE)
469
  IF (WANT_QT4MAC_COCOA)
470
	SET (QT_MAC_USE_COCOA TRUE)
471
  ELSE (WANT_QT4MAC_COCOA)
472
	SET (HAVE_CARBON 1 CACHE TYPE BOOL)
473
	ADD_DEFINITIONS("-DHAVE_CARBON=1")
474
  ENDIF (WANT_QT4MAC_COCOA)
475
  SET( QT_USE_QTSQL TRUE )
476
ENDIF(APPLE)
10719 cbradney 477
IF (WANT_QT3SUPPORT)
10392 cbradney 478
  SET (QT_USE_QT3SUPPORT TRUE)
10719 cbradney 479
ELSE (WANT_QT3SUPPORT)
480
  SET (QT_USE_QT3SUPPORT FALSE)
481
ENDIF (WANT_QT3SUPPORT)
10392 cbradney 482
SET (QT_USE_QTXML TRUE )
9409 cbradney 483
SET( QT_USE_QTNETWORK TRUE )
8499 cbradney 484
FIND_PACKAGE(Qt4 REQUIRED)
485
INCLUDE( ${QT_USE_FILE} )
5142 cbradney 486
IF (QT_FOUND)
9680 cbradney 487
  MESSAGE("Qt4 Found OK")
10719 cbradney 488
  IF (WANT_QT3SUPPORT)
489
    MESSAGE(STATUS "Building with Qt3 Support")
490
  ELSE (WANT_QT3SUPPORT)
491
    MESSAGE(STATUS "Building without Qt3 Support (GOOD)")
492
  ENDIF (WANT_QT3SUPPORT)
9680 cbradney 493
  #Add our Qt definitions
494
  ADD_DEFINITIONS(
495
    ${QT_DEFINITIONS}
496
    -DQT_CORE_LIB
497
    -DQT_GUI_LIB
498
    -DQT_THREAD_LIB
499
    -DQT_XML_LIB
500
  )
5142 cbradney 501
ELSE(QT_FOUND)
9680 cbradney 502
  MESSAGE(FATAL_ERROR "No Qt4 found")
5142 cbradney 503
ENDIF(QT_FOUND)
9680 cbradney 504
#>> Qt
505
 
10818 craig 506
#<< ZLIB, PNG
507
IF (WIN32)
508
  # On win32 we can use Qt's zlib and libpng, so we use some
509
  # custom cmake includes. This permits us to honour the
510
  # USE_QT_ZLIB_PNGLIB flag if passed.
511
  SET(PNG_DIR ${CMAKE_MODULE_PATH})
512
  SET(ZLIB_DIR ${CMAKE_MODULE_PATH})
513
ENDIF (WIN32)
514
FIND_PACKAGE(ZLIB REQUIRED)
515
IF (ZLIB_FOUND)
516
  MESSAGE("ZLIB Library Found OK")
517
  SET(HAVE_LIBZ 1)
518
ENDIF(ZLIB_FOUND)
5142 cbradney 519
FIND_PACKAGE(PNG REQUIRED)
520
IF (PNG_FOUND)
521
  MESSAGE("PNG Library Found OK")
522
ENDIF(PNG_FOUND)
10818 craig 523
#>> ZLIB, PNG
524
 
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
6686 cbradney 578
IF(RENDER_LIB)
579
  MESSAGE(STATUS "Previously selected rendering system: ${RENDER_LIB}")
7013 cbradney 580
ELSE(RENDER_LIB)
10972 cbradney 581
  IF (NOT WANT_QTARTHUR)
582
    SET(WANT_CAIRO 1)
583
  ENDIF (NOT WANT_QTARTHUR)
6686 cbradney 584
ENDIF(RENDER_LIB)
7013 cbradney 585
 
9680 cbradney 586
IF (WANT_CAIRO OR RENDER_LIB STREQUAL "CAIRO")
587
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
588
  FIND_PACKAGE(CAIRO)
589
  IF(CAIRO_FOUND)
5142 cbradney 590
    MESSAGE("CAIRO Library Found OK")
6686 cbradney 591
    SET(RENDER_LIB "CAIRO" CACHE TYPE STRING)
9680 cbradney 592
  ELSE(CAIRO_FOUND)
593
    SET(OLDRENDERLIBLOST TRUE)
594
  ENDIF(CAIRO_FOUND)
595
ENDIF (WANT_CAIRO OR RENDER_LIB STREQUAL "CAIRO")
5142 cbradney 596
 
11945 jghali 597
#Cairo is required on Windows for printing system
598
IF (WIN32)
599
  IF (NOT CAIRO_FOUND)
600
    MESSAGE(FATAL_ERROR "Cairo >= 1.5.16 is required for Windows build")
601
  ENDIF (NOT CAIRO_FOUND)
602
ENDIF (WIN32)
603
 
9680 cbradney 604
IF (OLDRENDERLIBLOST OR WANT_QTARTHUR OR RENDER_LIB STREQUAL "QTARTHUR" OR NOT RENDER_LIB)
605
  SET(RENDER_LIB "QTARTHUR" CACHE TYPE STRING)
606
  MESSAGE("Qt4's Arthur selected for renderer")
607
  IF (OLDRENDERLIBLOST)
608
    MESSAGE("CAIRO could no longer be found, replaced by Qt4's Arthur")
609
  ENDIF (OLDRENDERLIBLOST)
610
ENDIF (OLDRENDERLIBLOST OR WANT_QTARTHUR OR RENDER_LIB STREQUAL "QTARTHUR" OR NOT RENDER_LIB)
611
#>>Render Library
612
 
613
#<<CUPS
10747 craig 614
IF(NOT WIN32)
615
  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
616
    SET(Cups_DIR ${CMAKE_MODULE_PATH})
617
  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
618
  FIND_PACKAGE(Cups REQUIRED)
619
  IF(CUPS_FOUND)
620
    SET(HAVE_CUPS 1)
621
    MESSAGE("CUPS Library Found OK")
622
  ENDIF(CUPS_FOUND)
623
ELSE(NOT WIN32)
624
  # Windows doesn't use CUPS
625
  SET(CUPS_INCLUDE_DIR)
626
ENDIF(NOT WIN32)
9680 cbradney 627
#>>CUPS
5142 cbradney 628
 
9680 cbradney 629
#<<LibXML2
7203 cbradney 630
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
631
  SET(LibXml2_DIR ${CMAKE_MODULE_PATH})
632
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
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})
16586 jghali 642
FIND_PACKAGE(LCMS2)
643
IF (LCMS2_FOUND)
644
  IF (LCMS2_VERSION GREATER 2010 OR LCMS2_VERSION EQUAL 2010)
645
    SET(HAVE_CMS 1)
646
    SET(HAVE_LCMS21 1)
647
    SET(CMS_INC "\"lcms2.h\"")
648
    MESSAGE("LittleCMS Library >= 2.1 Found OK")
649
  ENDIF (LCMS2_VERSION GREATER 2010 OR LCMS2_VERSION EQUAL 2010)
650
ENDIF (LCMS2_FOUND)
651
IF (NOT HAVE_LCMS21)
652
  FIND_PACKAGE(LCMS REQUIRED)
653
  IF(LCMS_FOUND)
654
    SET(HAVE_CMS 1)
655
    SET(CMS_INC "\"lcms.h\"")
656
    MESSAGE("LittleCMS Library Found OK")
657
  ELSE(LCMS_FOUND)
658
    MESSAGE(FATAL_ERROR "Could not find the LittleCMS Library")
659
  ENDIF(LCMS_FOUND)
660
ENDIF (NOT HAVE_LCMS21)
9680 cbradney 661
#>>LittleCMS
5142 cbradney 662
 
9680 cbradney 663
#<<FontConfig
10747 craig 664
IF(NOT WIN32)
665
  SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
666
  FIND_PACKAGE(FONTCONFIG)
667
  IF(FONTCONFIG_FOUND)
5142 cbradney 668
	MESSAGE("FontConfig Found OK")
669
	SET(HAVE_FONTCONFIG 1)
10747 craig 670
  ENDIF(FONTCONFIG_FOUND)
671
ELSE(NOT WIN32)
672
  # Windows builds neither use nor require fontconfig
673
  SET(FONTCONFIG_INCLUDE_DIR)
674
ENDIF(NOT WIN32)
9680 cbradney 675
#>>FontConfig
5142 cbradney 676
 
11106 cbradney 677
#<<ASPELL for Speelling support
14967 cbradney 678
OPTION(WITH_ASPELL "Enable support for spell checking" ON)
679
IF (WITH_ASPELL)
680
  FIND_PACKAGE(ASPELL)
681
  IF (ASPELL_FOUND)
682
    MESSAGE("ASpell Found OK")
683
    SET(HAVE_ASPELL 1)
684
  ELSE (ASPELL_FOUND)
685
    MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking")
686
  ENDIF (ASPELL_FOUND)
687
ENDIF (WITH_ASPELL)
11106 cbradney 688
#>>ASPELL for Speelling support
689
 
17485 craig 690
#<<HUNSPELL for Speelling support
691
OPTION(WANT_HUNSPELL "Enable support for spell checking with hunspell" OFF)
692
IF (WANT_HUNSPELL)
693
  FIND_PACKAGE(HUNSPELL)
694
  IF (HUNSPELL_FOUND)
695
    MESSAGE("Hunspell Found OK")
696
    SET(HAVE_HUNSPELL 1)
697
  ELSE (HUNSPELL_FOUND)
698
    MESSAGE("HunSpell or its developer libraries NOT found - Disabling support for spell checking")
699
  ENDIF (HUNSPELL_FOUND)
700
ENDIF (WANT_HUNSPELL)
701
#>>HUNSPELL for Speelling support
11106 cbradney 702
 
17485 craig 703
 
10238 cbradney 704
#<<PoDoFo for AI PDF import
14967 cbradney 705
OPTION(WITH_PODOFO "Enable support for PDF embedded in AI" ON)
706
IF (WITH_PODOFO)
707
  FIND_PACKAGE(LIBPODOFO)
708
  IF (LIBPODOFO_FOUND)
709
    MESSAGE("PoDoFo found OK")
710
    SET(HAVE_PODOFO 1)
711
  ELSE (LIBPODOFO_FOUND)
712
    MESSAGE("PoDoFo NOT found - Disabling support for PDF embedded in AI")
713
  ENDIF (LIBPODOFO_FOUND)
714
ENDIF (WITH_PODOFO)
10238 cbradney 715
#>>PoDoFo for AI PDF import
10234 fschmid 716
 
16358 craig 717
#<<HYPHEN for system hyphenation library
718
FIND_PACKAGE(HYPHEN)
719
IF(HYPHEN_FOUND)
720
  MESSAGE("system hyphenation library found OK")
721
  SET(HAVE_HYPHEN 1)
722
ELSE(HYPHEN_FOUND)
723
  MESSAGE("system hyphenation library NOT found - will use internal one")
724
ENDIF(HYPHEN_FOUND)
725
#>>HYPHEN for system hyphenation library
726
 
10215 cbradney 727
##############################################################################################################
728
########## Include Setup                                                                            ##########
8499 cbradney 729
 
10215 cbradney 730
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
731
 
5142 cbradney 732
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
733
IF(HAVE_DLFCN_H)
734
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
735
ENDIF(HAVE_DLFCN_H)
736
 
737
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
738
IF(HAVE_UNISTD_H)
739
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
740
ENDIF(HAVE_UNISTD_H)
741
 
742
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
743
# IF(HAVE_SYS_TYPES_H)
744
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
745
# ENDIF(HAVE_SYS_TYPES_H)
746
 
747
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
748
# IF(HAVE_SYS_STAT_H)
749
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
750
# ENDIF(HAVE_SYS_STAT_H)
9680 cbradney 751
#>>Test for existing include files
5142 cbradney 752
 
753
 
5150 cbradney 754
#Create configure files.. config.h and uninstall
755
#config.h
5142 cbradney 756
INCLUDE (ConfigureChecks.cmake)
10779 craig 757
  IF(WIN32)
758
    SET(CONFIG_NAME win-config.h)
759
  ELSE(WIN32)
760
    SET(CONFIG_NAME config.h)
761
  ENDIF(WIN32)
762
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
5142 cbradney 763
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
9680 cbradney 764
 
5142 cbradney 765
 
5150 cbradney 766
 
5157 cbradney 767
#Set up include dirs with all found packages
5142 cbradney 768
INCLUDE_DIRECTORIES(
9680 cbradney 769
  ${CMAKE_BINARY_DIR}
770
  ${CMAKE_BINARY_DIR}/scribus
771
  ${QT_INCLUDES}
772
  ${CUPS_INCLUDE_DIR}
773
  ${FREETYPE_INCLUDE_DIR}
774
  ${FONTCONFIG_INCLUDE_DIR}
9712 avox 775
  ${JPEG_INCLUDE_DIR}
9680 cbradney 776
  ${LCMS_INCLUDE_DIR}
777
  ${LIBXML2_INCLUDE_DIR}
778
  ${PYTHON_INCLUDE_PATH}
779
  ${TIFF_INCLUDE_DIR}
780
  ${ZLIB_INCLUDE_DIR}
5142 cbradney 781
)
782
 
10215 cbradney 783
##############################################################################################################
784
########## Uninstall Setup                                                                          ##########
785
 
786
CONFIGURE_FILE(
787
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
788
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
789
  IMMEDIATE @ONLY
790
)
791
 
792
ADD_CUSTOM_TARGET(uninstall
793
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
794
 
795
 
796
##############################################################################################################
797
########## Add our subdirs                                                                          ##########
798
 
5157 cbradney 799
#Add our source subdirs
5142 cbradney 800
ADD_SUBDIRECTORY(scribus)
14101 cbradney 801
ADD_SUBDIRECTORY(resources/dicts)
14104 cbradney 802
ADD_SUBDIRECTORY(resources/editorconfig)
14102 cbradney 803
ADD_SUBDIRECTORY(resources/icons)
804
ADD_SUBDIRECTORY(resources/keysets)
805
ADD_SUBDIRECTORY(resources/loremipsum)
14049 cbradney 806
ADD_SUBDIRECTORY(resources/swatches)
14102 cbradney 807
ADD_SUBDIRECTORY(resources/templates)
15477 craig 808
ADD_SUBDIRECTORY(resources/translations/po)
5142 cbradney 809
 
5157 cbradney 810
#Install our READMEs etc.
5142 cbradney 811
INSTALL(FILES
9386 cbradney 812
  AUTHORS
813
  BUILDING
814
  ChangeLog
10359 mrdocs 815
  ChangeLogSVN
9386 cbradney 816
  COPYING
12531 cbradney 817
  LINKS
9386 cbradney 818
  NEWS
819
  PACKAGING
820
  README
821
  TODO
12531 cbradney 822
  TRANSLATION
5142 cbradney 823
  DESTINATION ${DOCDIR}
824
)
9386 cbradney 825
 
17499 craig 826
IF (APPLE)
827
  INSTALL(FILES
828
	README.MacOSX
829
	DESTINATION ${DOCDIR}
830
  )
831
ENDIF (APPLE)
832
 
9680 cbradney 833
#Install our MIME data
6319 mrdocs 834
INSTALL(FILES
9386 cbradney 835
  scribus.xml
836
  DESTINATION ${MIMEDIR}
6319 mrdocs 837
)
11715 malex 838
#KDE workaround until it starts supporting freedesktop spec
839
INSTALL(FILES
840
  vnd.scribus.desktop
11717 cbradney 841
  DESTINATION ${MIMELNKDIR}
11715 malex 842
)
5396 cbradney 843
 
11761 mrdocs 844
## PL We may not need this anymore
9680 cbradney 845
#Install the desktop file
11761 mrdocs 846
## INSTALL(FILES
847
 # scribus.desktop
848
 # #DESTINATION ${DESKTOPDIR}
849
#)
9680 cbradney 850
 
851
#If building an Apple bundle, install these specific files
852
IF(APPLEBUNDLE)
9386 cbradney 853
  INSTALL(FILES
9680 cbradney 854
    Scribus.app/Contents/Info.plist
855
    DESTINATION ${CMAKE_INSTALL_PREFIX}
9386 cbradney 856
  )
857
  INSTALL(FILES
9680 cbradney 858
    Scribus.app/Contents/Resources/Scribus.icns
859
    Scribus.app/Contents/Resources/Scribus-doc.icns
860
    DESTINATION ${CMAKE_INSTALL_PREFIX}/Resources
9386 cbradney 861
  )
9680 cbradney 862
ENDIF(APPLEBUNDLE)
9386 cbradney 863
 
10215 cbradney 864
##############################################################################################################
865
########## Install/CPack Setup                                                                      ##########
866
 
9680 cbradney 867
# If the cmake version includes cpack, use it for tarball building
5396 cbradney 868
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
869
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
870
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
871
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
872
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
873
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
874
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
875
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 876
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 877
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
11761 mrdocs 878
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus-${VERSION}${VERSION_SUFFIX}")
5407 cbradney 879
  SET(CPACK_SOURCE_GENERATOR TBZ2)
11761 mrdocs 880
  SET(CPACK_SYSTEM_NAME "")
881
  SET(CPACK_TOPLEVEL_TAG "")
9680 cbradney 882
  SET(CPACK_SOURCE_IGNORE_FILES
883
    CMakeCache.txt
17485 craig 884
	scribus-1.4.2.tar.gz
885
	scribus-1.4.2.tar.Z
886
	scribus-1.4.2.tar.xz
887
	scribus-1.4.2.gz
888
	scribus-1.4.2.tar.bz2
889
	scribus-1.4.2.tar.7z
9680 cbradney 890
    "~$"
891
    "\\\\.cvsignore$"
892
    "\\\\.o$"
11761 mrdocs 893
    "\\\\.svn-base$"
894
    "\\\\.svn$"
9680 cbradney 895
    "^${PROJECT_SOURCE_DIR}.*/CVS/"
896
    "^${PROJECT_SOURCE_DIR}/debian/"
897
    "^${PROJECT_SOURCE_DIR}/old/"
898
    "^${PROJECT_SOURCE_DIR}.*/CVSROOT/"
899
    "^${PROJECT_SOURCE_DIR}/admin/"
900
  )
5396 cbradney 901
  INCLUDE(CPack)
5463 avox 902
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")