Subversion Repositories Scribus

Rev

Rev 6210 | Rev 6319 | 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
 
75
#BUILD SETUP
76
#None, Debug, Release, .. or custom ones
77
SET(WANT_DEBUG 1)
78
IF(WANT_DEBUG)
79
  SET(CMAKE_BUILD_TYPE Debug)
80
ELSE(WANT_DEBUG)
81
  SET(CMAKE_BUILD_TYPE RELEASE)
82
ENDIF(WANT_DEBUG)
83
 
5468 avox 84
IF(APPLE)
85
  SET( ENV{MACOSX_DEPLOYMENT_TARGET} 10.3 )
86
  SET( ENV{LD_PREBIND} 1 )
87
  SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
88
  SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
89
  SET(CMAKE_C_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
5558 avox 90
  SET(BUILD_MAC_BUNDLE 1)
5468 avox 91
ELSE(APPLE)
92
  SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall")
93
  SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall")
94
ENDIF(APPLE)
5271 mrdocs 95
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
96
SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
5142 cbradney 97
 
5466 cbradney 98
 
99
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
5467 avox 100
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
5466 cbradney 101
 
5142 cbradney 102
#FIND DEPENDENCIES
103
# START QT
104
SET (QT_MT_REQUIRED true)
5382 cbradney 105
SET (QT_MIN_VERSION "3.3.4")
5142 cbradney 106
FIND_PACKAGE(Qt3 REQUIRED)
107
IF (QT_FOUND)
5382 cbradney 108
  MESSAGE("Qt3 Found OK (${qt_version_str})")
5474 cbradney 109
#   MESSAGE("$ENV{QTDIR}")
110
#   MESSAGE("${QT_MOC_EXECUTABLE}")
111
#   MESSAGE("${QT_UIC_EXECUTABLE}")
112
#   MESSAGE("${QT_QT_LIBRARY}")
113
#   MESSAGE("${QT_INCLUDE_DIR}")
114
#   MESSAGE("${qt_version_str}")
5382 cbradney 115
#   MESSAGE(${qt_version_str_lib})
5142 cbradney 116
ELSE(QT_FOUND)
117
  MESSAGE(FATAL_ERROR "No Qt3")
118
ENDIF(QT_FOUND)
119
# END QT
120
# START PNG, JPEG, TIFF
121
FIND_PACKAGE(PNG REQUIRED)
122
IF (PNG_FOUND)
123
  MESSAGE("PNG Library Found OK")
124
ENDIF(PNG_FOUND)
125
FIND_PACKAGE(JPEG REQUIRED)
126
IF (JPEG_FOUND)
127
  MESSAGE("JPEG Library Found OK")
128
ENDIF(JPEG_FOUND)
129
FIND_PACKAGE(TIFF REQUIRED)
130
IF (TIFF_FOUND)
131
  MESSAGE("TIFF Library Found OK")
132
  SET(HAVE_TIFF 1)
6211 cbradney 133
ELSE(TIFF_FOUND)
134
  MESSAGE(FATAL_ERROR "Could not find the TIFF Library")
5142 cbradney 135
ENDIF(TIFF_FOUND)
136
FIND_PACKAGE(ZLIB REQUIRED)
137
IF (ZLIB_FOUND)
138
  MESSAGE("ZLIB Library Found OK")
139
  SET(HAVE_LIBZ 1)
140
ENDIF(ZLIB_FOUND)
141
FIND_PACKAGE(PythonLibs REQUIRED)
142
IF (PYTHON_LIBRARY)
143
  MESSAGE("Python Library Found OK")
144
  SET(HAVE_PYTHON 1)
145
  SET(COMPILE_PYTHON 1)
146
ENDIF(PYTHON_LIBRARY)
147
 
148
# START FREETYPE
149
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
150
FIND_PACKAGE(FREETYPE REQUIRED)
151
IF (FREETYPE_FOUND)
152
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 153
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
154
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 155
ENDIF(FREETYPE_FOUND)
156
#FIXME: if cflags empty add, otherwise replace as now
157
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
158
# END FREETYPE
159
 
160
# START LIBART_LGPL
5159 cbradney 161
SET(RENDER_LIB "")
5142 cbradney 162
IF (WANT_LIBART OR NOT WANT_CAIRO)
163
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
164
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
165
  SET(USE_LIBART 1)
166
  IF(LIBART_LGPL_FOUND)
5159 cbradney 167
    SET(RENDER_LIB "LIBART")
5142 cbradney 168
    MESSAGE("Libart_LGPL Library Found OK")
169
  ENDIF(LIBART_LGPL_FOUND)
170
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
171
  # START CAIRO
5157 cbradney 172
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
173
  FIND_PACKAGE(CAIRO)
5142 cbradney 174
  IF(CAIRO_FOUND)
175
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 176
    SET(HAVE_CAIRO 1)
5159 cbradney 177
    SET(RENDER_LIB "CAIRO")
5142 cbradney 178
  ELSE(CAIRO_FOUND)
179
    SET(USE_LIBART 0)
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")
214
ENDIF(LCMS_FOUND)
215
# END LCMS
216
 
217
# START FONTCONFIG
218
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
219
FIND_PACKAGE(FONTCONFIG)
220
IF(FONTCONFIG_FOUND)
221
	MESSAGE("FontConfig Found OK")
222
	SET(HAVE_FONTCONFIG 1)
223
ENDIF(FONTCONFIG_FOUND)
224
# END FONTCONFIG
225
 
226
ADD_DEFINITIONS(${QT_DEFINITIONS})
227
 
228
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
229
IF(HAVE_DLFCN_H)
230
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
231
ENDIF(HAVE_DLFCN_H)
232
 
233
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
234
IF(HAVE_UNISTD_H)
235
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
236
ENDIF(HAVE_UNISTD_H)
237
 
238
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
239
# IF(HAVE_SYS_TYPES_H)
240
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
241
# ENDIF(HAVE_SYS_TYPES_H)
242
 
243
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
244
# IF(HAVE_SYS_STAT_H)
245
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
246
# ENDIF(HAVE_SYS_STAT_H)
247
 
248
 
5150 cbradney 249
#Create configure files.. config.h and uninstall
250
#config.h
5142 cbradney 251
INCLUDE (ConfigureChecks.cmake)
252
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
253
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 254
#uninstall
255
CONFIGURE_FILE(
256
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
257
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
258
  IMMEDIATE @ONLY)
5142 cbradney 259
 
5150 cbradney 260
ADD_CUSTOM_TARGET(uninstall
261
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
262
 
5157 cbradney 263
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 264
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
265
FIND_PACKAGE(SCRIBUSQT)
266
 
5157 cbradney 267
#Set up include dirs with all found packages
5142 cbradney 268
INCLUDE_DIRECTORIES(
5203 cbradney 269
${CMAKE_BINARY_DIR}
5205 cbradney 270
${CMAKE_BINARY_DIR}/scribus
5142 cbradney 271
${QT_INCLUDE_DIR}
272
${QT_INCLUDE_PATH}
273
${CUPS_INCLUDE_DIR}
274
${FREETYPE_INCLUDE_DIR}
275
${FONTCONFIG_INCLUDE_DIR}
276
${LCMS_INCLUDE_DIR}
277
${LIBXML2_INCLUDE_DIR}
278
${PYTHON_INCLUDE_PATH}
279
${TIFF_INCLUDE_DIR}
280
${ZLIB_INCLUDE_DIR}
281
)
282
 
5157 cbradney 283
#Set up libraries to link with all found packages
5758 cbradney 284
 
285
#Select Libart_LGPL or Cairo
286
IF(RENDER_LIB STREQUAL "LIBART")
287
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
288
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
289
ENDIF(RENDER_LIB STREQUAL "LIBART")
290
IF(RENDER_LIB STREQUAL "CAIRO")
291
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
292
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
293
  LINK_DIRECTORIES(${PREFIX_CAIRO_LIB})
294
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${PREFIX_CAIRO_LIB}")
295
ENDIF(RENDER_LIB STREQUAL "CAIRO")
296
 
297
MESSAGE("RPATH: ${CMAKE_INSTALL_RPATH}")
298
 
5142 cbradney 299
LINK_LIBRARIES (
300
${QT_QT_LIBRARY}
301
${CUPS_LIBRARIES}
302
${FREETYPE_LIBRARIES}
303
${FONTCONFIG_LIBRARIES}
304
${LCMS_LIBRARIES}
305
${LIBXML2_LIBRARIES}
306
${PYTHON_LIBRARIES}
307
${TIFF_LIBRARIES}
5463 avox 308
${JPEG_LIBRARIES}
5142 cbradney 309
${ZLIB_LIBRARIES}
310
)
311
 
312
IF(WIN32)
313
  LINK_LIBRARIES(
314
    ${QT_QTMAIN_LIBRARY}
315
  )
316
ENDIF(WIN32)
317
 
318
IF(WIN32)
319
  ADD_DEFINITIONS(-DQT_DLL)
320
ENDIF(WIN32)
321
 
5558 avox 322
IF(APPLE)
323
  LINK_LIBRARIES( "-undefined dynamic_lookup" )
5468 avox 324
  LINK_LIBRARIES( "-framework CoreFoundation" )
5558 avox 325
ENDIF(APPLE)
5468 avox 326
 
5157 cbradney 327
#Add our source subdirs
5142 cbradney 328
ADD_SUBDIRECTORY(scribus)
329
 
5157 cbradney 330
#Install our READMEs etc.
5142 cbradney 331
INSTALL(FILES
332
AUTHORS
333
BUILDING
334
ChangeLog
335
ChangeLogCVS
336
COPYING
337
INSTALL
338
NEWS
339
PACKAGING
340
README
341
README.MacOSX
342
TODO
343
scribus.xml
344
  DESTINATION ${DOCDIR}
345
)
5396 cbradney 346
 
347
# If the cmake version includes cpack, use it
348
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
349
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
350
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
351
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
352
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
353
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
354
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
355
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 356
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 357
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
358
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus${TAG_VERSION}")
5407 cbradney 359
  SET(CPACK_SOURCE_GENERATOR TBZ2)
5396 cbradney 360
 
361
  INCLUDE(CPack)
5463 avox 362
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")