Subversion Repositories Scribus

Rev

Rev 5758 | Rev 6084 | 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
MESSAGE("Please use CMake 2.4.3cvs if you can, until CMake 2.4.3 is released")
7
 
5142 cbradney 8
SET(CMAKE_COLOR_MAKEFILE ON)
9
SET(CMAKE_VERBOSE_MAKEFILE ON)
10
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
5758 cbradney 11
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
5790 cbradney 12
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
5758 cbradney 13
#SET(CMAKE_SKIP_RPATH:BOOL NO)
5144 cbradney 14
SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
15
 
5142 cbradney 16
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
17
# SET(CMAKE_SHARED_MODULE_LINK_FLAGS "${CMAKE_SHARED_MODULE_LINK_FLAGS} -export-dynamic")
18
# SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS} -export-dynamic")
19
# SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -export-dynamic")
20
# SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -export-dynamic")
21
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_FLAGS})
22
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS})
23
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
24
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
25
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_MODULE})
26
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
27
 
28
#IMPORT FROM COMMANDLINE
29
# SET with cmake -DWANT_CAIRO=1, etc
30
# MESSAGE(STATUS ${WANT_CAIRO})
31
# MESSAGE(STATUS ${WANT_LIBART})
32
# MESSAGE(STATUS ${WANT_DEBUG})
5157 cbradney 33
 
34
# SET(WANT_CAIRO 0)
35
# SET(WANT_LIBART 1)
36
 
5142 cbradney 37
#PROJECT SETUP
38
PROJECT(scribus)
5396 cbradney 39
SET (VERSION_MAJOR "1")
40
SET (VERSION_MINOR "3")
41
SET (VERSION_PATCH "4")
42
SET (VERSION_SUFFIX "cvs")
5407 cbradney 43
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
44
MESSAGE(STATUS "Scribus ${VERSION} will be built to install into ${CMAKE_INSTALL_PREFIX}")
5142 cbradney 45
 
46
SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
47
 
5379 cbradney 48
SET(MAIN_DIR_NAME "scribus")
49
IF (WANT_VERSIONING)
5396 cbradney 50
  IF (NOT CUSTOM_VERSIONTAG)
51
    SET(TAG_VERSION "-${VERSION}")
52
  ELSE (NOT CUSTOM_VERSIONTAG)
53
    SET(TAG_VERSION ${CUSTOM_VERSIONTAG})
54
  ENDIF (NOT CUSTOM_VERSIONTAG)
5379 cbradney 55
ENDIF (WANT_VERSIONING)
56
 
5142 cbradney 57
SET(MANDIR "man/")
58
SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
59
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
5379 cbradney 60
SET(DOCDIR "share/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 61
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
5379 cbradney 62
SET(ICONDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
5142 cbradney 63
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
5379 cbradney 64
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
5142 cbradney 65
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
5379 cbradney 66
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
5142 cbradney 67
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
5379 cbradney 68
SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
5142 cbradney 69
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
5379 cbradney 70
SET(LIBDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 71
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
5379 cbradney 72
SET(PLUGINDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
5142 cbradney 73
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
74
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
75
 
76
#BUILD SETUP
77
#None, Debug, Release, .. or custom ones
78
SET(WANT_DEBUG 1)
79
IF(WANT_DEBUG)
80
  SET(CMAKE_BUILD_TYPE Debug)
81
ELSE(WANT_DEBUG)
82
  SET(CMAKE_BUILD_TYPE RELEASE)
83
ENDIF(WANT_DEBUG)
84
 
5468 avox 85
IF(APPLE)
86
  SET( ENV{MACOSX_DEPLOYMENT_TARGET} 10.3 )
87
  SET( ENV{LD_PREBIND} 1 )
88
  SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
89
  SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
90
  SET(CMAKE_C_FLAGS_DEBUG "-O2 -g3 -fno-inline-functions -Wall")
5558 avox 91
  SET(BUILD_MAC_BUNDLE 1)
5468 avox 92
ELSE(APPLE)
93
  SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall")
94
  SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall")
95
ENDIF(APPLE)
5271 mrdocs 96
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
97
SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
5142 cbradney 98
 
5466 cbradney 99
 
100
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
5467 avox 101
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
5466 cbradney 102
 
5142 cbradney 103
#FIND DEPENDENCIES
104
# START QT
105
SET (QT_MT_REQUIRED true)
5382 cbradney 106
SET (QT_MIN_VERSION "3.3.4")
5142 cbradney 107
FIND_PACKAGE(Qt3 REQUIRED)
108
IF (QT_FOUND)
5382 cbradney 109
  MESSAGE("Qt3 Found OK (${qt_version_str})")
5474 cbradney 110
#   MESSAGE("$ENV{QTDIR}")
111
#   MESSAGE("${QT_MOC_EXECUTABLE}")
112
#   MESSAGE("${QT_UIC_EXECUTABLE}")
113
#   MESSAGE("${QT_QT_LIBRARY}")
114
#   MESSAGE("${QT_INCLUDE_DIR}")
115
#   MESSAGE("${qt_version_str}")
5382 cbradney 116
#   MESSAGE(${qt_version_str_lib})
5142 cbradney 117
ELSE(QT_FOUND)
118
  MESSAGE(FATAL_ERROR "No Qt3")
119
ENDIF(QT_FOUND)
120
# END QT
121
# START PNG, JPEG, TIFF
122
FIND_PACKAGE(PNG REQUIRED)
123
IF (PNG_FOUND)
124
  MESSAGE("PNG Library Found OK")
125
ENDIF(PNG_FOUND)
126
FIND_PACKAGE(JPEG REQUIRED)
127
IF (JPEG_FOUND)
128
  MESSAGE("JPEG Library Found OK")
129
ENDIF(JPEG_FOUND)
130
FIND_PACKAGE(TIFF REQUIRED)
131
IF (TIFF_FOUND)
132
  MESSAGE("TIFF Library Found OK")
133
  SET(HAVE_TIFF 1)
134
ENDIF(TIFF_FOUND)
135
FIND_PACKAGE(ZLIB REQUIRED)
136
IF (ZLIB_FOUND)
137
  MESSAGE("ZLIB Library Found OK")
138
  SET(HAVE_LIBZ 1)
139
ENDIF(ZLIB_FOUND)
140
FIND_PACKAGE(PythonLibs REQUIRED)
141
IF (PYTHON_LIBRARY)
142
  MESSAGE("Python Library Found OK")
143
  SET(HAVE_PYTHON 1)
144
  SET(COMPILE_PYTHON 1)
145
ENDIF(PYTHON_LIBRARY)
146
 
147
# START FREETYPE
148
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
149
FIND_PACKAGE(FREETYPE REQUIRED)
150
IF (FREETYPE_FOUND)
151
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 152
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
153
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 154
ENDIF(FREETYPE_FOUND)
155
#FIXME: if cflags empty add, otherwise replace as now
156
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
157
# END FREETYPE
158
 
159
# START LIBART_LGPL
5159 cbradney 160
SET(RENDER_LIB "")
5142 cbradney 161
IF (WANT_LIBART OR NOT WANT_CAIRO)
162
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
163
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
164
  SET(USE_LIBART 1)
165
  IF(LIBART_LGPL_FOUND)
5159 cbradney 166
    SET(RENDER_LIB "LIBART")
5142 cbradney 167
    MESSAGE("Libart_LGPL Library Found OK")
168
  ENDIF(LIBART_LGPL_FOUND)
169
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
170
  # START CAIRO
5157 cbradney 171
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
172
  FIND_PACKAGE(CAIRO)
5142 cbradney 173
  IF(CAIRO_FOUND)
174
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 175
    SET(HAVE_CAIRO 1)
5159 cbradney 176
    SET(RENDER_LIB "CAIRO")
5142 cbradney 177
  ELSE(CAIRO_FOUND)
178
    SET(USE_LIBART 0)
179
  ENDIF(CAIRO_FOUND)
180
  # END CAIRO
181
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
182
# END LIBART_LGPL
183
 
5159 cbradney 184
IF(NOT RENDER_LIB)
5170 cbradney 185
  MESSAGE(FATAL_ERROR "ERROR: Neither LibArt_LGPL nor cairo have been selected or found, please correct and restart cmake")
5159 cbradney 186
ENDIF(NOT RENDER_LIB)
187
 
188
 
5142 cbradney 189
# START CUPS
190
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
191
FIND_PACKAGE(CUPS REQUIRED)
192
IF(CUPS_FOUND)
193
  SET(HAVE_CUPS 1)
194
  MESSAGE("CUPS Library Found OK")
195
ENDIF(CUPS_FOUND)
196
# END CUPS
197
 
198
# START LIBXML2
199
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
200
FIND_PACKAGE(LIBXML2 REQUIRED)
201
IF(LIBXML2_FOUND)
202
  SET(HAVE_XML 1)
203
  MESSAGE("LIBXML2 Library Found OK")
204
ENDIF(LIBXML2_FOUND)
205
# END LIBXML2
206
 
207
# START LCMS
208
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
209
FIND_PACKAGE(LCMS REQUIRED)
210
IF(LCMS_FOUND)
211
  SET(HAVE_CMS 1)
212
  SET(CMS_INC "lcms.h")
213
  MESSAGE("LittleCMS Library Found OK")
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")