Subversion Repositories Scribus

Rev

Rev 10815 | Rev 10972 | 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
8499 cbradney 7
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR)
5758 cbradney 8
 
10818 craig 9
IF(WIN32)
10
  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
11
    MESSAGE(FATAL_ERROR "Windows builds require CMake 2.5")
12
  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
13
ENDIF(WIN32)
14
 
9680 cbradney 15
#Pretty colors
5142 cbradney 16
SET(CMAKE_COLOR_MAKEFILE ON)
9680 cbradney 17
#Dont force verbose
9715 avox 18
SET(CMAKE_VERBOSE_MAKEFILE OFF)
9680 cbradney 19
#Include current dir
5142 cbradney 20
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
10459 cbradney 21
#RPATH setup - more below too
10327 cbradney 22
IF (WANT_NORPATH OR WANT_DISTROBUILD)
23
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
24
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
25
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
26
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
10459 cbradney 27
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
9715 avox 28
SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
8902 cbradney 29
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
30
 
10215 cbradney 31
INCLUDE(CheckIncludeFile)
32
INCLUDE(CheckCCompilerFlag)
33
INCLUDE(CheckCXXCompilerFlag)
34
INCLUDE(CheckTypeSize)
35
INCLUDE(TestBigEndian)
36
 
9680 cbradney 37
#Set the custom CMake module directory where our include/lib finders are
5142 cbradney 38
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
9680 cbradney 39
 
10215 cbradney 40
##############################################################################################################
41
########## toplevel compiler flags                                                                  ##########
42
 
43
# CHECK_C_COMPILER_FLAG(" ${CMAKE_SHARED_LIBRARY_C_FLAGS}" C_HAVE_PIC)
44
# CHECK_CXX_COMPILER_FLAG(" ${CMAKE_SHARED_LIBRARY_C_FLAGS}" CXX_HAVE_PIC)
45
# IF (CXX_HAVE_PIC AND C_HAVE_PIC)
46
#     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
47
#     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
48
# ELSE (CXX_HAVE_PIC AND C_HAVE_PIC)
49
#     MESSAGE(FATAL_ERROR "Shared library support is missing")
50
# ENDIF (CXX_HAVE_PIC AND C_HAVE_PIC)
51
 
5142 cbradney 52
# SET(CMAKE_SHARED_MODULE_LINK_FLAGS "${CMAKE_SHARED_MODULE_LINK_FLAGS} -export-dynamic")
53
# SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS} -export-dynamic")
54
# SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -export-dynamic")
55
# SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -export-dynamic")
56
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_FLAGS})
57
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS})
58
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
59
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
60
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_MODULE})
61
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
62
 
63
#IMPORT FROM COMMANDLINE
64
# SET with cmake -DWANT_CAIRO=1, etc
65
# MESSAGE(STATUS ${WANT_CAIRO})
66
# MESSAGE(STATUS ${WANT_LIBART})
67
# MESSAGE(STATUS ${WANT_DEBUG})
5157 cbradney 68
 
69
# SET(WANT_CAIRO 0)
70
# SET(WANT_LIBART 1)
71
 
9680 cbradney 72
#Project Setup
5142 cbradney 73
PROJECT(scribus)
9680 cbradney 74
#Set our version values
75
#Final version is ${VERSION} = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}
76
#where VERSION_SUFFIX is of the form "", "cvs" or "Ncvs" (N being the minor patch level)
5396 cbradney 77
SET (VERSION_MAJOR "1")
78
SET (VERSION_MINOR "3")
8499 cbradney 79
SET (VERSION_PATCH "5")
9706 cbradney 80
SET (VERSION_SUFFIX "svn")
5407 cbradney 81
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
82
MESSAGE(STATUS "Scribus ${VERSION} will be built to install into ${CMAKE_INSTALL_PREFIX}")
5142 cbradney 83
 
9680 cbradney 84
#Set the permissions to be used when installing plugins
5142 cbradney 85
SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
86
 
9680 cbradney 87
#Our main directory is scribus
5379 cbradney 88
SET(MAIN_DIR_NAME "scribus")
9680 cbradney 89
 
10215 cbradney 90
##############################################################################################################
10238 cbradney 91
########## check for the CPU we build for                                                           ##########
92
 
93
EXECUTE_PROCESS(
94
    COMMAND ${CMAKE_C_COMPILER} -dumpmachine
95
    OUTPUT_VARIABLE MACHINE
96
    OUTPUT_STRIP_TRAILING_WHITESPACE
97
)
98
MESSAGE(STATUS "Building for target ${MACHINE}")
99
 
100
STRING(REGEX MATCH "(i?86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
101
IF (_machine_x86)
102
    MESSAGE(STATUS "Found target X86")
103
    SET(ARCH_X86 1)
104
ENDIF (_machine_x86)
105
 
106
STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _machine_x86_64 "${MACHINE}")
107
IF (_machine_x86_64)
108
    MESSAGE(STATUS "Found target X86_64")
109
    SET(ARCH_X86_64 1)
110
ENDIF (_machine_x86_64)
111
 
112
STRING(REGEX MATCH "(ppc-*)" _machine_ppc "${MACHINE}")
113
IF (_machine_ppc)
114
    MESSAGE(STATUS "Found target PPC")
115
    SET(ARCH_PPC 1)
116
ENDIF (_machine_ppc)
117
 
118
##############################################################################################################
10215 cbradney 119
########## Versioning Setup                                                                         ##########
120
 
9409 cbradney 121
#On Apple, we ignore the versioning tag so all items are "scribus" not "scribus-version"
9508 cbradney 122
IF (NOT BUILD_OSX_BUNDLE)
9680 cbradney 123
  SET(BUILD_OSX_BUNDLE ${APPLE} CACHE TYPE BOOL)
9508 cbradney 124
ENDIF (NOT BUILD_OSX_BUNDLE)
125
 
9680 cbradney 126
#Simplify future conditionals for Apple
127
IF (APPLE AND BUILD_OSX_BUNDLE)
128
  SET(APPLEBUNDLE TRUE CACHE TYPE BOOL)
129
ENDIF (APPLE AND BUILD_OSX_BUNDLE)
130
 
131
#Announce we cached a version request before, overridden below for OSX
9508 cbradney 132
IF(TAG_VERSION)
9680 cbradney 133
  IF (NOT APPLEBUNDLE)
134
    MESSAGE(STATUS "Previously selected version tag: ${TAG_VERSION}")
135
  ENDIF (NOT APPLEBUNDLE)
6891 cbradney 136
  SET(WANT_VERSIONING 1)
137
  SET(CACHED_VERSIONING 1)
9508 cbradney 138
ENDIF(TAG_VERSION)
139
 
9680 cbradney 140
#Remove version tags on OSX so our bundle is Scribus.app
141
IF (APPLEBUNDLE)
142
  IF (WANT_VERSIONING OR CACHED_VERSIONING)
143
    MESSAGE(STATUS "Ignoring version tag on OSX when building bundle")
144
    SET(WANT_VERSIONING 0)
145
    SET(CACHED_VERSIONING 0)
146
  ENDIF (WANT_VERSIONING OR CACHED_VERSIONING)
147
ENDIF (APPLEBUNDLE)
9508 cbradney 148
 
9680 cbradney 149
#Store our version string if require
6891 cbradney 150
IF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
5396 cbradney 151
  IF (NOT CUSTOM_VERSIONTAG)
6891 cbradney 152
    SET(TAG_VERSION "-${VERSION}" CACHE TYPE STRING)
5396 cbradney 153
  ELSE (NOT CUSTOM_VERSIONTAG)
6891 cbradney 154
    SET(TAG_VERSION ${CUSTOM_VERSIONTAG} CACHE TYPE STRING)
5396 cbradney 155
  ENDIF (NOT CUSTOM_VERSIONTAG)
6891 cbradney 156
ENDIF (WANT_VERSIONING AND NOT CACHED_VERSIONING)
5379 cbradney 157
 
10215 cbradney 158
##############################################################################################################
159
########## Install/Directory Setup                                                                  ##########
160
 
9680 cbradney 161
#Setp all the directories we will use
7269 cbradney 162
#MAN
163
SET(MANDIR "share/man/")
6893 cbradney 164
SET(SHAREDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 165
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
9680 cbradney 166
 
9409 cbradney 167
#SHARE - use the default on Apple as TAG_VERSION is empty
168
IF(TAG_VERSION OR BUILD_OSX_BUNDLE)
7269 cbradney 169
  SET(DOCDIR "share/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
9409 cbradney 170
ELSE(TAG_VERSION OR BUILD_OSX_BUNDLE)
7269 cbradney 171
  SET(DOCDIR "share/doc/${MAIN_DIR_NAME}-${VERSION}/")
9409 cbradney 172
ENDIF (TAG_VERSION OR BUILD_OSX_BUNDLE)
5142 cbradney 173
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
9680 cbradney 174
 
7269 cbradney 175
#ICON
10779 craig 176
IF(WIN32)
177
  SET(ICONDIR "share/icons/")
178
ELSE(WIN32)
179
  SET(ICONDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
180
ENDIF(WIN32)
5142 cbradney 181
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
9680 cbradney 182
 
7269 cbradney 183
#SAMPLES
5379 cbradney 184
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
5142 cbradney 185
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
9680 cbradney 186
 
7269 cbradney 187
#SCRIPTS
5379 cbradney 188
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
5142 cbradney 189
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
9680 cbradney 190
 
7269 cbradney 191
#TEMPLATES
10779 craig 192
IF(WIN32)
193
  SET(TEMPLATEDIR "share/templates/")
194
ELSE(WIN32)
195
  SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
196
ENDIF(WIN32)
5142 cbradney 197
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
9680 cbradney 198
 
9660 cbradney 199
#DESKTOP
9653 mrdocs 200
SET(DESKTOPDIR "share/applications/")
201
ADD_DEFINITIONS("-DDESKTOPDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DESKTOPDIR}\\\"")
9680 cbradney 202
 
10161 cbradney 203
#LIB LOCATION - lib or lib64 normally
7269 cbradney 204
#LIB
10161 cbradney 205
IF(WANT_LIB64)
10239 cbradney 206
  IF(NOT ARCH_X86_64)
207
    MESSAGE(STATUS "WARNING: BUILDING 64 Bit build on non 64 bit architecture")
208
  ENDIF(NOT ARCH_X86_64)
209
  SET(LIB_SUFFIX "64" CACHE TYPE STRING)
10161 cbradney 210
ENDIF(WANT_LIB64)
10239 cbradney 211
SET(LIB_DIR_NAME "lib${LIB_SUFFIX}")
10161 cbradney 212
SET(LIBDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 213
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
9680 cbradney 214
 
7269 cbradney 215
#PLUGINS
10779 craig 216
IF(WIN32)
10781 craig 217
  SET(PLUGINDIR "plugins")
218
ELSE(WIN32)
10779 craig 219
  SET(PLUGINDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
220
ENDIF(WIN32)
5142 cbradney 221
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
9680 cbradney 222
 
9660 cbradney 223
#INCLUDE
224
SET(INCLUDEDIR "include/${MAIN_DIR_NAME}${TAG_VERSION}/")
225
#NO ADD DEFINITIONS, WE ONLY INSTALL WITH IT
9680 cbradney 226
 
7269 cbradney 227
#RPATH
10459 cbradney 228
IF (WANT_NORPATH OR WANT_DISTROBUILD)
229
  set(CMAKE_INSTALL_RPATH "")
230
ELSE (WANT_NORPATH OR WANT_DISTROBUILD)
231
  set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
232
ENDIF (WANT_NORPATH OR WANT_DISTROBUILD)
5142 cbradney 233
 
6319 mrdocs 234
# Set the XDG mime stuff
6320 mrdocs 235
SET(MIMEDIR "share/mime/packages/")
6319 mrdocs 236
 
10215 cbradney 237
##############################################################################################################
238
########## Build Setup                                                                              ##########
6319 mrdocs 239
 
9680 cbradney 240
#Convert our simpler command line option to the CMake style
5142 cbradney 241
#None, Debug, Release, .. or custom ones
7943 cbradney 242
# SET(WANT_DEBUG 1)
5142 cbradney 243
IF(WANT_DEBUG)
244
  SET(CMAKE_BUILD_TYPE Debug)
245
ELSE(WANT_DEBUG)
246
  SET(CMAKE_BUILD_TYPE RELEASE)
247
ENDIF(WANT_DEBUG)
248
 
9680 cbradney 249
#Based on our build type, setup our build options
5468 avox 250
IF(APPLE)
10750 craig 251
  # gcc/mac
5468 avox 252
  SET( ENV{MACOSX_DEPLOYMENT_TARGET} 10.3 )
253
  SET( ENV{LD_PREBIND} 1 )
254
  SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
255
  SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
256
  SET(CMAKE_C_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
257
ELSE(APPLE)
10750 craig 258
  IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
259
    # Windows build with Visual Studio
260
    # Surely there's a better way to identify the compiler?
261
    SET(CMAKE_CXX_FLAGS_DEBUG)
262
    SET(CMAKE_C_FLAGS_DEBUG)
263
  ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
264
    # vanilla gcc
265
    SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
266
    SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
267
  ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5468 avox 268
ENDIF(APPLE)
9680 cbradney 269
 
10750 craig 270
IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
271
  SET(CMAKE_CXX_FLAGS_RELEASE)
272
  SET(CMAKE_C_FLAGS_RELEASE)
273
ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
274
  SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
275
  SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
276
ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
5142 cbradney 277
 
10750 craig 278
IF(WIN32)
279
  ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN
280
	          -DAVOID_WIN32_FILEIO
281
                  -D_CRT_SECURE_NO_DEPRECATE
282
		  -DCOMPILE_PLUGIN_AS_DLL
283
		  )
284
  SET(BUILD_WINDOWS_VERSION 1)
285
  SET(SC_USE_GDI 1)
286
  IF(NOT SC_SHOULD_NOT_USE_GDIPLUS)
287
    SET(SC_USE_GDIPLUS 1)
288
  ENDIF(NOT SC_SHOULD_NOT_USE_GDIPLUS)
289
  SET(DLL_USE_NATIVE_API 1)
290
ENDIF(WIN32)
291
 
10215 cbradney 292
##############################################################################################################
293
########## Find Dependencies                                                                        ##########
5466 cbradney 294
 
9680 cbradney 295
#<< Qt
10719 cbradney 296
SET (QT_MT_REQUIRED TRUE)
10104 mrdocs 297
SET (QT_MIN_VERSION "4.3.0")
10719 cbradney 298
IF (WANT_QT3SUPPORT)
10392 cbradney 299
  SET (QT_USE_QT3SUPPORT TRUE)
10719 cbradney 300
ELSE (WANT_QT3SUPPORT)
301
  SET (QT_USE_QT3SUPPORT FALSE)
302
ENDIF (WANT_QT3SUPPORT)
10392 cbradney 303
SET (QT_USE_QTXML TRUE )
9409 cbradney 304
IF (APPLE)
305
  SET( QT_USE_QTSQL TRUE )
306
ENDIF (APPLE)
307
SET( QT_USE_QTNETWORK TRUE )
8499 cbradney 308
FIND_PACKAGE(Qt4 REQUIRED)
309
INCLUDE( ${QT_USE_FILE} )
5142 cbradney 310
IF (QT_FOUND)
9680 cbradney 311
  MESSAGE("Qt4 Found OK")
10719 cbradney 312
  IF (WANT_QT3SUPPORT)
313
    MESSAGE(STATUS "Building with Qt3 Support")
314
  ELSE (WANT_QT3SUPPORT)
315
    MESSAGE(STATUS "Building without Qt3 Support (GOOD)")
316
  ENDIF (WANT_QT3SUPPORT)
9680 cbradney 317
  #Add our Qt definitions
318
  ADD_DEFINITIONS(
319
    ${QT_DEFINITIONS}
320
    -DQT_CORE_LIB
321
    -DQT_GUI_LIB
322
    -DQT_THREAD_LIB
323
    -DQT_XML_LIB
324
  )
5142 cbradney 325
ELSE(QT_FOUND)
9680 cbradney 326
  MESSAGE(FATAL_ERROR "No Qt4 found")
5142 cbradney 327
ENDIF(QT_FOUND)
9680 cbradney 328
#>> Qt
329
 
10818 craig 330
#<< ZLIB, PNG
331
IF (WIN32)
332
  # On win32 we can use Qt's zlib and libpng, so we use some
333
  # custom cmake includes. This permits us to honour the
334
  # USE_QT_ZLIB_PNGLIB flag if passed.
335
  SET(PNG_DIR ${CMAKE_MODULE_PATH})
336
  SET(ZLIB_DIR ${CMAKE_MODULE_PATH})
337
ENDIF (WIN32)
338
FIND_PACKAGE(ZLIB REQUIRED)
339
IF (ZLIB_FOUND)
340
  MESSAGE("ZLIB Library Found OK")
341
  SET(HAVE_LIBZ 1)
342
ENDIF(ZLIB_FOUND)
5142 cbradney 343
FIND_PACKAGE(PNG REQUIRED)
344
IF (PNG_FOUND)
345
  MESSAGE("PNG Library Found OK")
346
ENDIF(PNG_FOUND)
10818 craig 347
#>> ZLIB, PNG
348
 
349
#<< JPEG, TIFF, PYTHON
5142 cbradney 350
FIND_PACKAGE(JPEG REQUIRED)
351
IF (JPEG_FOUND)
352
  MESSAGE("JPEG Library Found OK")
353
ENDIF(JPEG_FOUND)
354
FIND_PACKAGE(TIFF REQUIRED)
355
IF (TIFF_FOUND)
356
  MESSAGE("TIFF Library Found OK")
357
  SET(HAVE_TIFF 1)
6211 cbradney 358
ELSE(TIFF_FOUND)
359
  MESSAGE(FATAL_ERROR "Could not find the TIFF Library")
5142 cbradney 360
ENDIF(TIFF_FOUND)
361
FIND_PACKAGE(PythonLibs REQUIRED)
362
IF (PYTHON_LIBRARY)
363
  MESSAGE("Python Library Found OK")
364
  SET(HAVE_PYTHON 1)
365
  SET(COMPILE_PYTHON 1)
366
ENDIF(PYTHON_LIBRARY)
10818 craig 367
#>> JPEG, TIFF, PYTHON
5142 cbradney 368
 
9680 cbradney 369
#<< FreeType2
5142 cbradney 370
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
371
FIND_PACKAGE(FREETYPE REQUIRED)
372
IF (FREETYPE_FOUND)
373
  MESSAGE("FreeType2 Library Found OK")
8499 cbradney 374
  INCLUDE(CheckLibraryExists)
5170 cbradney 375
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
376
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 377
ENDIF(FREETYPE_FOUND)
378
#FIXME: if cflags empty add, otherwise replace as now
379
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
9680 cbradney 380
#>> FreeType2
5142 cbradney 381
 
9680 cbradney 382
#<<Render Library
383
# Select our rendering library
384
# As of Scribus 1.3.5, we can use cairo or Qt4's Arthur
7013 cbradney 385
# If we have a RENDER_LIB selected from a previous cmake run, then use it
386
# otherwise, we should be defaulting to Libart_LGPL for 1.3.4.x
6686 cbradney 387
IF(RENDER_LIB)
388
  MESSAGE(STATUS "Previously selected rendering system: ${RENDER_LIB}")
7013 cbradney 389
ELSE(RENDER_LIB)
390
  IF (NOT WANT_CAIRO)
9680 cbradney 391
    SET(WANT_QTARTHUR 1)
7013 cbradney 392
  ENDIF (NOT WANT_CAIRO)
6686 cbradney 393
ENDIF(RENDER_LIB)
7013 cbradney 394
 
9680 cbradney 395
IF (WANT_CAIRO OR RENDER_LIB STREQUAL "CAIRO")
396
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
397
  FIND_PACKAGE(CAIRO)
398
  IF(CAIRO_FOUND)
5142 cbradney 399
    MESSAGE("CAIRO Library Found OK")
6686 cbradney 400
    SET(RENDER_LIB "CAIRO" CACHE TYPE STRING)
9680 cbradney 401
  ELSE(CAIRO_FOUND)
402
    SET(OLDRENDERLIBLOST TRUE)
403
  ENDIF(CAIRO_FOUND)
404
ENDIF (WANT_CAIRO OR RENDER_LIB STREQUAL "CAIRO")
5142 cbradney 405
 
9680 cbradney 406
IF (OLDRENDERLIBLOST OR WANT_QTARTHUR OR RENDER_LIB STREQUAL "QTARTHUR" OR NOT RENDER_LIB)
407
  SET(RENDER_LIB "QTARTHUR" CACHE TYPE STRING)
408
  MESSAGE("Qt4's Arthur selected for renderer")
409
  IF (OLDRENDERLIBLOST)
410
    MESSAGE("CAIRO could no longer be found, replaced by Qt4's Arthur")
411
  ENDIF (OLDRENDERLIBLOST)
412
ENDIF (OLDRENDERLIBLOST OR WANT_QTARTHUR OR RENDER_LIB STREQUAL "QTARTHUR" OR NOT RENDER_LIB)
413
#>>Render Library
414
 
415
#<<CUPS
10747 craig 416
IF(NOT WIN32)
417
  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
418
    SET(Cups_DIR ${CMAKE_MODULE_PATH})
419
  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
420
  FIND_PACKAGE(Cups REQUIRED)
421
  IF(CUPS_FOUND)
422
    SET(HAVE_CUPS 1)
423
    MESSAGE("CUPS Library Found OK")
424
  ENDIF(CUPS_FOUND)
425
ELSE(NOT WIN32)
426
  # Windows doesn't use CUPS
427
  SET(CUPS_INCLUDE_DIR)
428
ENDIF(NOT WIN32)
9680 cbradney 429
#>>CUPS
5142 cbradney 430
 
9680 cbradney 431
#<<LibXML2
7203 cbradney 432
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
433
  SET(LibXml2_DIR ${CMAKE_MODULE_PATH})
434
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
435
FIND_PACKAGE(LibXml2 REQUIRED)
5142 cbradney 436
IF(LIBXML2_FOUND)
437
  SET(HAVE_XML 1)
438
  MESSAGE("LIBXML2 Library Found OK")
439
ENDIF(LIBXML2_FOUND)
9680 cbradney 440
#>>LibXML2
5142 cbradney 441
 
9680 cbradney 442
#<<LittleCMS
5142 cbradney 443
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
444
FIND_PACKAGE(LCMS REQUIRED)
445
IF(LCMS_FOUND)
446
  SET(HAVE_CMS 1)
447
  SET(CMS_INC "lcms.h")
6553 cbradney 448
  MESSAGE("LittleCMS Library Found OK")
449
ELSE(LCMS_FOUND)
450
  MESSAGE(FATAL_ERROR "Could not find the LittleCMS Library")
5142 cbradney 451
ENDIF(LCMS_FOUND)
9680 cbradney 452
#>>LittleCMS
5142 cbradney 453
 
9680 cbradney 454
#<<FontConfig
10747 craig 455
IF(NOT WIN32)
456
  SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
457
  FIND_PACKAGE(FONTCONFIG)
458
  IF(FONTCONFIG_FOUND)
5142 cbradney 459
	MESSAGE("FontConfig Found OK")
460
	SET(HAVE_FONTCONFIG 1)
10747 craig 461
  ENDIF(FONTCONFIG_FOUND)
462
ELSE(NOT WIN32)
463
  # Windows builds neither use nor require fontconfig
464
  SET(FONTCONFIG_INCLUDE_DIR)
465
ENDIF(NOT WIN32)
9680 cbradney 466
#>>FontConfig
5142 cbradney 467
 
10238 cbradney 468
#<<PoDoFo for AI PDF import
10234 fschmid 469
FIND_PACKAGE(LIBPODOFO)
470
IF(LIBPODOFO_FOUND)
10235 cbradney 471
  MESSAGE("PoDoFo found OK")
472
  SET(HAVE_PODOFO 1)
473
ELSE(LIBPODOFO_FOUND)
474
  MESSAGE("PoDoFo NOT found - Disabling support for PDF embedded in AI")
10234 fschmid 475
ENDIF(LIBPODOFO_FOUND)
10238 cbradney 476
#>>PoDoFo for AI PDF import
10234 fschmid 477
 
10215 cbradney 478
##############################################################################################################
479
########## Include Setup                                                                            ##########
8499 cbradney 480
 
10215 cbradney 481
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
482
 
5142 cbradney 483
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
484
IF(HAVE_DLFCN_H)
485
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
486
ENDIF(HAVE_DLFCN_H)
487
 
488
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
489
IF(HAVE_UNISTD_H)
490
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
491
ENDIF(HAVE_UNISTD_H)
492
 
493
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
494
# IF(HAVE_SYS_TYPES_H)
495
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
496
# ENDIF(HAVE_SYS_TYPES_H)
497
 
498
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
499
# IF(HAVE_SYS_STAT_H)
500
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
501
# ENDIF(HAVE_SYS_STAT_H)
9680 cbradney 502
#>>Test for existing include files
5142 cbradney 503
 
504
 
5150 cbradney 505
#Create configure files.. config.h and uninstall
506
#config.h
5142 cbradney 507
INCLUDE (ConfigureChecks.cmake)
10779 craig 508
  IF(WIN32)
509
    SET(CONFIG_NAME win-config.h)
510
  ELSE(WIN32)
511
    SET(CONFIG_NAME config.h)
512
  ENDIF(WIN32)
513
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
5142 cbradney 514
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
9680 cbradney 515
 
5142 cbradney 516
 
5150 cbradney 517
 
5157 cbradney 518
#Set up include dirs with all found packages
5142 cbradney 519
INCLUDE_DIRECTORIES(
9680 cbradney 520
  ${CMAKE_BINARY_DIR}
521
  ${CMAKE_BINARY_DIR}/scribus
522
  ${QT_INCLUDES}
523
  ${CUPS_INCLUDE_DIR}
524
  ${FREETYPE_INCLUDE_DIR}
525
  ${FONTCONFIG_INCLUDE_DIR}
9712 avox 526
  ${JPEG_INCLUDE_DIR}
9680 cbradney 527
  ${LCMS_INCLUDE_DIR}
528
  ${LIBXML2_INCLUDE_DIR}
529
  ${PYTHON_INCLUDE_PATH}
530
  ${TIFF_INCLUDE_DIR}
531
  ${ZLIB_INCLUDE_DIR}
5142 cbradney 532
)
533
 
10215 cbradney 534
##############################################################################################################
535
########## Uninstall Setup                                                                          ##########
536
 
537
CONFIGURE_FILE(
538
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
539
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
540
  IMMEDIATE @ONLY
541
)
542
 
543
ADD_CUSTOM_TARGET(uninstall
544
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
545
 
546
 
547
##############################################################################################################
548
########## Add our subdirs                                                                          ##########
549
 
5157 cbradney 550
#Add our source subdirs
5142 cbradney 551
ADD_SUBDIRECTORY(scribus)
552
 
5157 cbradney 553
#Install our READMEs etc.
5142 cbradney 554
INSTALL(FILES
9386 cbradney 555
  AUTHORS
556
  BUILDING
557
  ChangeLog
10359 mrdocs 558
  ChangeLogSVN
9386 cbradney 559
  COPYING
560
  NEWS
561
  PACKAGING
562
  README
563
  README.MacOSX
564
  TODO
5142 cbradney 565
  DESTINATION ${DOCDIR}
566
)
9386 cbradney 567
 
9680 cbradney 568
#Install our MIME data
6319 mrdocs 569
INSTALL(FILES
9386 cbradney 570
  scribus.xml
571
  DESTINATION ${MIMEDIR}
6319 mrdocs 572
)
5396 cbradney 573
 
9680 cbradney 574
#Install the desktop file
9653 mrdocs 575
INSTALL(FILES
576
  scribus.desktop
577
  DESTINATION ${DESKTOPDIR}
578
)
9680 cbradney 579
 
580
#If building an Apple bundle, install these specific files
581
IF(APPLEBUNDLE)
9386 cbradney 582
  INSTALL(FILES
9680 cbradney 583
    Scribus.app/Contents/Info.plist
584
    DESTINATION ${CMAKE_INSTALL_PREFIX}
9386 cbradney 585
  )
586
  INSTALL(FILES
9680 cbradney 587
    Scribus.app/Contents/Resources/Scribus.icns
588
    Scribus.app/Contents/Resources/Scribus-doc.icns
589
    DESTINATION ${CMAKE_INSTALL_PREFIX}/Resources
9386 cbradney 590
  )
9680 cbradney 591
ENDIF(APPLEBUNDLE)
9386 cbradney 592
 
10215 cbradney 593
##############################################################################################################
594
########## Install/CPack Setup                                                                      ##########
595
 
9680 cbradney 596
# If the cmake version includes cpack, use it for tarball building
5396 cbradney 597
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
598
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
599
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
600
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
601
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
602
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
603
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
604
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 605
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 606
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
7392 mrdocs 607
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus-${VERSION}")
5407 cbradney 608
  SET(CPACK_SOURCE_GENERATOR TBZ2)
9680 cbradney 609
 
610
  SET(CPACK_SOURCE_IGNORE_FILES
611
    CMakeCache.txt
612
    scribus-1.3.5cvs.tar.bz2
613
    scribus-1.3.5cvs.tar.Z
614
    scribus-1.3.5cvs.tar.gz
615
    "~$"
616
    "\\\\.cvsignore$"
617
    "\\\\.o$"
618
    "^${PROJECT_SOURCE_DIR}.*/CVS/"
619
    "^${PROJECT_SOURCE_DIR}/debian/"
620
    "^${PROJECT_SOURCE_DIR}/old/"
621
    "^${PROJECT_SOURCE_DIR}.*/CVSROOT/"
622
    "^${PROJECT_SOURCE_DIR}/admin/"
623
  )
5396 cbradney 624
  INCLUDE(CPack)
5463 avox 625
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")