Subversion Repositories Scribus

Rev

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