Subversion Repositories Scribus

Rev

Rev 6553 | Rev 6686 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5142 cbradney 1
#CMAKE SETUP
5758 cbradney 2
#Require 2.4.2 for Qt finding
3
#Require 2.4.3 for moc change detection
4
#Require 2.4.3 for rpath updates for custom cairo install
5
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3)
6
 
5142 cbradney 7
SET(CMAKE_COLOR_MAKEFILE ON)
8
SET(CMAKE_VERBOSE_MAKEFILE ON)
9
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
5758 cbradney 10
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
5790 cbradney 11
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
5758 cbradney 12
#SET(CMAKE_SKIP_RPATH:BOOL NO)
5144 cbradney 13
SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
14
 
5142 cbradney 15
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
16
# SET(CMAKE_SHARED_MODULE_LINK_FLAGS "${CMAKE_SHARED_MODULE_LINK_FLAGS} -export-dynamic")
17
# SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS} -export-dynamic")
18
# SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -export-dynamic")
19
# SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -export-dynamic")
20
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_FLAGS})
21
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS})
22
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
23
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
24
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_MODULE})
25
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
26
 
27
#IMPORT FROM COMMANDLINE
28
# SET with cmake -DWANT_CAIRO=1, etc
29
# MESSAGE(STATUS ${WANT_CAIRO})
30
# MESSAGE(STATUS ${WANT_LIBART})
31
# MESSAGE(STATUS ${WANT_DEBUG})
5157 cbradney 32
 
33
# SET(WANT_CAIRO 0)
34
# SET(WANT_LIBART 1)
35
 
5142 cbradney 36
#PROJECT SETUP
37
PROJECT(scribus)
5396 cbradney 38
SET (VERSION_MAJOR "1")
39
SET (VERSION_MINOR "3")
40
SET (VERSION_PATCH "4")
41
SET (VERSION_SUFFIX "cvs")
5407 cbradney 42
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
43
MESSAGE(STATUS "Scribus ${VERSION} will be built to install into ${CMAKE_INSTALL_PREFIX}")
5142 cbradney 44
 
45
SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
46
 
5379 cbradney 47
SET(MAIN_DIR_NAME "scribus")
48
IF (WANT_VERSIONING)
5396 cbradney 49
  IF (NOT CUSTOM_VERSIONTAG)
50
    SET(TAG_VERSION "-${VERSION}")
51
  ELSE (NOT CUSTOM_VERSIONTAG)
52
    SET(TAG_VERSION ${CUSTOM_VERSIONTAG})
53
  ENDIF (NOT CUSTOM_VERSIONTAG)
5379 cbradney 54
ENDIF (WANT_VERSIONING)
55
 
5142 cbradney 56
SET(MANDIR "man/")
57
SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
58
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
5379 cbradney 59
SET(DOCDIR "share/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 60
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
5379 cbradney 61
SET(ICONDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
5142 cbradney 62
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
5379 cbradney 63
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
5142 cbradney 64
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
5379 cbradney 65
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
5142 cbradney 66
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
5379 cbradney 67
SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
5142 cbradney 68
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
5379 cbradney 69
SET(LIBDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 70
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
5379 cbradney 71
SET(PLUGINDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
5142 cbradney 72
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
73
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
74
 
6319 mrdocs 75
# Set the XDG mime stuff
6320 mrdocs 76
SET(MIMEDIR "share/mime/packages/")
6319 mrdocs 77
 
78
 
5142 cbradney 79
#BUILD SETUP
80
#None, Debug, Release, .. or custom ones
81
SET(WANT_DEBUG 1)
82
IF(WANT_DEBUG)
83
  SET(CMAKE_BUILD_TYPE Debug)
84
ELSE(WANT_DEBUG)
85
  SET(CMAKE_BUILD_TYPE RELEASE)
86
ENDIF(WANT_DEBUG)
87
 
5468 avox 88
IF(APPLE)
89
  SET( ENV{MACOSX_DEPLOYMENT_TARGET} 10.3 )
90
  SET( ENV{LD_PREBIND} 1 )
91
  SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
92
  SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
93
  SET(CMAKE_C_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
5558 avox 94
  SET(BUILD_MAC_BUNDLE 1)
5468 avox 95
ELSE(APPLE)
96
  SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall")
97
  SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall")
98
ENDIF(APPLE)
5271 mrdocs 99
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
100
SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
5142 cbradney 101
 
5466 cbradney 102
 
103
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
5467 avox 104
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
5466 cbradney 105
 
5142 cbradney 106
#FIND DEPENDENCIES
107
# START QT
108
SET (QT_MT_REQUIRED true)
5382 cbradney 109
SET (QT_MIN_VERSION "3.3.4")
5142 cbradney 110
FIND_PACKAGE(Qt3 REQUIRED)
111
IF (QT_FOUND)
5382 cbradney 112
  MESSAGE("Qt3 Found OK (${qt_version_str})")
5474 cbradney 113
#   MESSAGE("$ENV{QTDIR}")
114
#   MESSAGE("${QT_MOC_EXECUTABLE}")
115
#   MESSAGE("${QT_UIC_EXECUTABLE}")
116
#   MESSAGE("${QT_QT_LIBRARY}")
117
#   MESSAGE("${QT_INCLUDE_DIR}")
118
#   MESSAGE("${qt_version_str}")
5382 cbradney 119
#   MESSAGE(${qt_version_str_lib})
5142 cbradney 120
ELSE(QT_FOUND)
121
  MESSAGE(FATAL_ERROR "No Qt3")
122
ENDIF(QT_FOUND)
123
# END QT
124
# START PNG, JPEG, TIFF
125
FIND_PACKAGE(PNG REQUIRED)
126
IF (PNG_FOUND)
127
  MESSAGE("PNG Library Found OK")
128
ENDIF(PNG_FOUND)
129
FIND_PACKAGE(JPEG REQUIRED)
130
IF (JPEG_FOUND)
131
  MESSAGE("JPEG Library Found OK")
132
ENDIF(JPEG_FOUND)
133
FIND_PACKAGE(TIFF REQUIRED)
134
IF (TIFF_FOUND)
135
  MESSAGE("TIFF Library Found OK")
136
  SET(HAVE_TIFF 1)
6211 cbradney 137
ELSE(TIFF_FOUND)
138
  MESSAGE(FATAL_ERROR "Could not find the TIFF Library")
5142 cbradney 139
ENDIF(TIFF_FOUND)
140
FIND_PACKAGE(ZLIB REQUIRED)
141
IF (ZLIB_FOUND)
142
  MESSAGE("ZLIB Library Found OK")
143
  SET(HAVE_LIBZ 1)
144
ENDIF(ZLIB_FOUND)
145
FIND_PACKAGE(PythonLibs REQUIRED)
146
IF (PYTHON_LIBRARY)
147
  MESSAGE("Python Library Found OK")
148
  SET(HAVE_PYTHON 1)
149
  SET(COMPILE_PYTHON 1)
150
ENDIF(PYTHON_LIBRARY)
151
 
152
# START FREETYPE
153
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
154
FIND_PACKAGE(FREETYPE REQUIRED)
155
IF (FREETYPE_FOUND)
156
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 157
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
158
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 159
ENDIF(FREETYPE_FOUND)
160
#FIXME: if cflags empty add, otherwise replace as now
161
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
162
# END FREETYPE
163
 
164
# START LIBART_LGPL
5159 cbradney 165
SET(RENDER_LIB "")
5142 cbradney 166
IF (WANT_LIBART OR NOT WANT_CAIRO)
167
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
168
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
169
  IF(LIBART_LGPL_FOUND)
5159 cbradney 170
    SET(RENDER_LIB "LIBART")
5142 cbradney 171
    MESSAGE("Libart_LGPL Library Found OK")
172
  ENDIF(LIBART_LGPL_FOUND)
173
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
174
  # START CAIRO
5157 cbradney 175
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
176
  FIND_PACKAGE(CAIRO)
5142 cbradney 177
  IF(CAIRO_FOUND)
178
    MESSAGE("CAIRO Library Found OK")
5159 cbradney 179
    SET(RENDER_LIB "CAIRO")
5142 cbradney 180
  ENDIF(CAIRO_FOUND)
181
  # END CAIRO
182
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
183
# END LIBART_LGPL
184
 
5159 cbradney 185
IF(NOT RENDER_LIB)
5170 cbradney 186
  MESSAGE(FATAL_ERROR "ERROR: Neither LibArt_LGPL nor cairo have been selected or found, please correct and restart cmake")
5159 cbradney 187
ENDIF(NOT RENDER_LIB)
188
 
189
 
5142 cbradney 190
# START CUPS
191
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
192
FIND_PACKAGE(CUPS REQUIRED)
193
IF(CUPS_FOUND)
194
  SET(HAVE_CUPS 1)
195
  MESSAGE("CUPS Library Found OK")
196
ENDIF(CUPS_FOUND)
197
# END CUPS
198
 
199
# START LIBXML2
200
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
201
FIND_PACKAGE(LIBXML2 REQUIRED)
202
IF(LIBXML2_FOUND)
203
  SET(HAVE_XML 1)
204
  MESSAGE("LIBXML2 Library Found OK")
205
ENDIF(LIBXML2_FOUND)
206
# END LIBXML2
207
 
208
# START LCMS
209
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
210
FIND_PACKAGE(LCMS REQUIRED)
211
IF(LCMS_FOUND)
212
  SET(HAVE_CMS 1)
213
  SET(CMS_INC "lcms.h")
6553 cbradney 214
  MESSAGE("LittleCMS Library Found OK")
215
ELSE(LCMS_FOUND)
216
  MESSAGE(FATAL_ERROR "Could not find the LittleCMS Library")
5142 cbradney 217
ENDIF(LCMS_FOUND)
218
# END LCMS
219
 
220
# START FONTCONFIG
221
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
222
FIND_PACKAGE(FONTCONFIG)
223
IF(FONTCONFIG_FOUND)
224
	MESSAGE("FontConfig Found OK")
225
	SET(HAVE_FONTCONFIG 1)
226
ENDIF(FONTCONFIG_FOUND)
227
# END FONTCONFIG
228
 
229
ADD_DEFINITIONS(${QT_DEFINITIONS})
230
 
231
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
232
IF(HAVE_DLFCN_H)
233
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
234
ENDIF(HAVE_DLFCN_H)
235
 
236
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
237
IF(HAVE_UNISTD_H)
238
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
239
ENDIF(HAVE_UNISTD_H)
240
 
241
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
242
# IF(HAVE_SYS_TYPES_H)
243
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
244
# ENDIF(HAVE_SYS_TYPES_H)
245
 
246
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
247
# IF(HAVE_SYS_STAT_H)
248
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
249
# ENDIF(HAVE_SYS_STAT_H)
250
 
251
 
5150 cbradney 252
#Create configure files.. config.h and uninstall
253
#config.h
5142 cbradney 254
INCLUDE (ConfigureChecks.cmake)
255
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
256
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 257
#uninstall
258
CONFIGURE_FILE(
259
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
260
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
261
  IMMEDIATE @ONLY)
5142 cbradney 262
 
5150 cbradney 263
ADD_CUSTOM_TARGET(uninstall
264
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
265
 
5157 cbradney 266
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 267
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
268
FIND_PACKAGE(SCRIBUSQT)
269
 
5157 cbradney 270
#Set up include dirs with all found packages
5142 cbradney 271
INCLUDE_DIRECTORIES(
5203 cbradney 272
${CMAKE_BINARY_DIR}
5205 cbradney 273
${CMAKE_BINARY_DIR}/scribus
5142 cbradney 274
${QT_INCLUDE_DIR}
275
${QT_INCLUDE_PATH}
276
${CUPS_INCLUDE_DIR}
277
${FREETYPE_INCLUDE_DIR}
278
${FONTCONFIG_INCLUDE_DIR}
279
${LCMS_INCLUDE_DIR}
280
${LIBXML2_INCLUDE_DIR}
281
${PYTHON_INCLUDE_PATH}
282
${TIFF_INCLUDE_DIR}
283
${ZLIB_INCLUDE_DIR}
284
)
285
 
5157 cbradney 286
#Set up libraries to link with all found packages
5758 cbradney 287
 
288
#Select Libart_LGPL or Cairo
289
IF(RENDER_LIB STREQUAL "LIBART")
290
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
291
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
292
ENDIF(RENDER_LIB STREQUAL "LIBART")
293
IF(RENDER_LIB STREQUAL "CAIRO")
294
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
295
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
296
  LINK_DIRECTORIES(${PREFIX_CAIRO_LIB})
297
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${PREFIX_CAIRO_LIB}")
298
ENDIF(RENDER_LIB STREQUAL "CAIRO")
299
 
300
MESSAGE("RPATH: ${CMAKE_INSTALL_RPATH}")
301
 
5142 cbradney 302
LINK_LIBRARIES (
303
${QT_QT_LIBRARY}
304
${CUPS_LIBRARIES}
305
${FREETYPE_LIBRARIES}
306
${FONTCONFIG_LIBRARIES}
307
${LCMS_LIBRARIES}
308
${LIBXML2_LIBRARIES}
309
${PYTHON_LIBRARIES}
310
${TIFF_LIBRARIES}
5463 avox 311
${JPEG_LIBRARIES}
5142 cbradney 312
${ZLIB_LIBRARIES}
313
)
314
 
315
IF(WIN32)
316
  LINK_LIBRARIES(
317
    ${QT_QTMAIN_LIBRARY}
318
  )
319
ENDIF(WIN32)
320
 
321
IF(WIN32)
322
  ADD_DEFINITIONS(-DQT_DLL)
323
ENDIF(WIN32)
324
 
5558 avox 325
IF(APPLE)
326
  LINK_LIBRARIES( "-undefined dynamic_lookup" )
5468 avox 327
  LINK_LIBRARIES( "-framework CoreFoundation" )
5558 avox 328
ENDIF(APPLE)
5468 avox 329
 
5157 cbradney 330
#Add our source subdirs
5142 cbradney 331
ADD_SUBDIRECTORY(scribus)
332
 
5157 cbradney 333
#Install our READMEs etc.
5142 cbradney 334
INSTALL(FILES
335
AUTHORS
336
BUILDING
337
ChangeLog
338
ChangeLogCVS
339
COPYING
340
INSTALL
341
NEWS
342
PACKAGING
343
README
344
README.MacOSX
345
TODO
6319 mrdocs 346
 
5142 cbradney 347
  DESTINATION ${DOCDIR}
348
)
6319 mrdocs 349
INSTALL(FILES
350
scribus.xml
351
DESTINATION ${MIMEDIR}
352
)
5396 cbradney 353
 
354
# If the cmake version includes cpack, use it
355
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
356
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
357
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
358
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
359
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
360
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
361
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
362
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 363
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 364
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
365
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus${TAG_VERSION}")
5407 cbradney 366
  SET(CPACK_SOURCE_GENERATOR TBZ2)
5396 cbradney 367
 
368
  INCLUDE(CPack)
5463 avox 369
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")