Subversion Repositories Scribus

Rev

Rev 6084 | Rev 6211 | 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)
133
ENDIF(TIFF_FOUND)
134
FIND_PACKAGE(ZLIB REQUIRED)
135
IF (ZLIB_FOUND)
136
  MESSAGE("ZLIB Library Found OK")
137
  SET(HAVE_LIBZ 1)
138
ENDIF(ZLIB_FOUND)
139
FIND_PACKAGE(PythonLibs REQUIRED)
140
IF (PYTHON_LIBRARY)
141
  MESSAGE("Python Library Found OK")
142
  SET(HAVE_PYTHON 1)
143
  SET(COMPILE_PYTHON 1)
144
ENDIF(PYTHON_LIBRARY)
145
 
146
# START FREETYPE
147
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
148
FIND_PACKAGE(FREETYPE REQUIRED)
149
IF (FREETYPE_FOUND)
150
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 151
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
152
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 153
ENDIF(FREETYPE_FOUND)
154
#FIXME: if cflags empty add, otherwise replace as now
155
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
156
# END FREETYPE
157
 
158
# START LIBART_LGPL
5159 cbradney 159
SET(RENDER_LIB "")
5142 cbradney 160
IF (WANT_LIBART OR NOT WANT_CAIRO)
161
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
162
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
163
  SET(USE_LIBART 1)
164
  IF(LIBART_LGPL_FOUND)
5159 cbradney 165
    SET(RENDER_LIB "LIBART")
5142 cbradney 166
    MESSAGE("Libart_LGPL Library Found OK")
167
  ENDIF(LIBART_LGPL_FOUND)
168
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
169
  # START CAIRO
5157 cbradney 170
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
171
  FIND_PACKAGE(CAIRO)
5142 cbradney 172
  IF(CAIRO_FOUND)
173
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 174
    SET(HAVE_CAIRO 1)
5159 cbradney 175
    SET(RENDER_LIB "CAIRO")
5142 cbradney 176
  ELSE(CAIRO_FOUND)
177
    SET(USE_LIBART 0)
178
  ENDIF(CAIRO_FOUND)
179
  # END CAIRO
180
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
181
# END LIBART_LGPL
182
 
5159 cbradney 183
IF(NOT RENDER_LIB)
5170 cbradney 184
  MESSAGE(FATAL_ERROR "ERROR: Neither LibArt_LGPL nor cairo have been selected or found, please correct and restart cmake")
5159 cbradney 185
ENDIF(NOT RENDER_LIB)
186
 
187
 
5142 cbradney 188
# START CUPS
189
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
190
FIND_PACKAGE(CUPS REQUIRED)
191
IF(CUPS_FOUND)
192
  SET(HAVE_CUPS 1)
193
  MESSAGE("CUPS Library Found OK")
194
ENDIF(CUPS_FOUND)
195
# END CUPS
196
 
197
# START LIBXML2
198
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
199
FIND_PACKAGE(LIBXML2 REQUIRED)
200
IF(LIBXML2_FOUND)
201
  SET(HAVE_XML 1)
202
  MESSAGE("LIBXML2 Library Found OK")
203
ENDIF(LIBXML2_FOUND)
204
# END LIBXML2
205
 
206
# START LCMS
207
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
208
FIND_PACKAGE(LCMS REQUIRED)
209
IF(LCMS_FOUND)
210
  SET(HAVE_CMS 1)
211
  SET(CMS_INC "lcms.h")
212
ENDIF(LCMS_FOUND)
213
# END LCMS
214
 
215
# START FONTCONFIG
216
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
217
FIND_PACKAGE(FONTCONFIG)
218
IF(FONTCONFIG_FOUND)
219
	MESSAGE("FontConfig Found OK")
220
	SET(HAVE_FONTCONFIG 1)
221
ENDIF(FONTCONFIG_FOUND)
222
# END FONTCONFIG
223
 
224
ADD_DEFINITIONS(${QT_DEFINITIONS})
225
 
226
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
227
IF(HAVE_DLFCN_H)
228
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
229
ENDIF(HAVE_DLFCN_H)
230
 
231
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
232
IF(HAVE_UNISTD_H)
233
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
234
ENDIF(HAVE_UNISTD_H)
235
 
236
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
237
# IF(HAVE_SYS_TYPES_H)
238
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
239
# ENDIF(HAVE_SYS_TYPES_H)
240
 
241
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
242
# IF(HAVE_SYS_STAT_H)
243
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
244
# ENDIF(HAVE_SYS_STAT_H)
245
 
246
 
5150 cbradney 247
#Create configure files.. config.h and uninstall
248
#config.h
5142 cbradney 249
INCLUDE (ConfigureChecks.cmake)
250
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
251
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 252
#uninstall
253
CONFIGURE_FILE(
254
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
255
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
256
  IMMEDIATE @ONLY)
5142 cbradney 257
 
5150 cbradney 258
ADD_CUSTOM_TARGET(uninstall
259
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
260
 
5157 cbradney 261
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 262
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
263
FIND_PACKAGE(SCRIBUSQT)
264
 
5157 cbradney 265
#Set up include dirs with all found packages
5142 cbradney 266
INCLUDE_DIRECTORIES(
5203 cbradney 267
${CMAKE_BINARY_DIR}
5205 cbradney 268
${CMAKE_BINARY_DIR}/scribus
5142 cbradney 269
${QT_INCLUDE_DIR}
270
${QT_INCLUDE_PATH}
271
${CUPS_INCLUDE_DIR}
272
${FREETYPE_INCLUDE_DIR}
273
${FONTCONFIG_INCLUDE_DIR}
274
${LCMS_INCLUDE_DIR}
275
${LIBXML2_INCLUDE_DIR}
276
${PYTHON_INCLUDE_PATH}
277
${TIFF_INCLUDE_DIR}
278
${ZLIB_INCLUDE_DIR}
279
)
280
 
5157 cbradney 281
#Set up libraries to link with all found packages
5758 cbradney 282
 
283
#Select Libart_LGPL or Cairo
284
IF(RENDER_LIB STREQUAL "LIBART")
285
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
286
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
287
ENDIF(RENDER_LIB STREQUAL "LIBART")
288
IF(RENDER_LIB STREQUAL "CAIRO")
289
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
290
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
291
  LINK_DIRECTORIES(${PREFIX_CAIRO_LIB})
292
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${PREFIX_CAIRO_LIB}")
293
ENDIF(RENDER_LIB STREQUAL "CAIRO")
294
 
295
MESSAGE("RPATH: ${CMAKE_INSTALL_RPATH}")
296
 
5142 cbradney 297
LINK_LIBRARIES (
298
${QT_QT_LIBRARY}
299
${CUPS_LIBRARIES}
300
${FREETYPE_LIBRARIES}
301
${FONTCONFIG_LIBRARIES}
302
${LCMS_LIBRARIES}
303
${LIBXML2_LIBRARIES}
304
${PYTHON_LIBRARIES}
305
${TIFF_LIBRARIES}
5463 avox 306
${JPEG_LIBRARIES}
5142 cbradney 307
${ZLIB_LIBRARIES}
308
)
309
 
310
IF(WIN32)
311
  LINK_LIBRARIES(
312
    ${QT_QTMAIN_LIBRARY}
313
  )
314
ENDIF(WIN32)
315
 
316
IF(WIN32)
317
  ADD_DEFINITIONS(-DQT_DLL)
318
ENDIF(WIN32)
319
 
5558 avox 320
IF(APPLE)
321
  LINK_LIBRARIES( "-undefined dynamic_lookup" )
5468 avox 322
  LINK_LIBRARIES( "-framework CoreFoundation" )
5558 avox 323
ENDIF(APPLE)
5468 avox 324
 
5157 cbradney 325
#Add our source subdirs
5142 cbradney 326
ADD_SUBDIRECTORY(scribus)
327
 
5157 cbradney 328
#Install our READMEs etc.
5142 cbradney 329
INSTALL(FILES
330
AUTHORS
331
BUILDING
332
ChangeLog
333
ChangeLogCVS
334
COPYING
335
INSTALL
336
NEWS
337
PACKAGING
338
README
339
README.MacOSX
340
TODO
341
scribus.xml
342
  DESTINATION ${DOCDIR}
343
)
5396 cbradney 344
 
345
# If the cmake version includes cpack, use it
346
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
347
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
348
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
349
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
350
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
351
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
352
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
353
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 354
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 355
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
356
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus${TAG_VERSION}")
5407 cbradney 357
  SET(CPACK_SOURCE_GENERATOR TBZ2)
5396 cbradney 358
 
359
  INCLUDE(CPack)
5463 avox 360
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")