Subversion Repositories Scribus

Rev

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