Subversion Repositories Scribus

Rev

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