Subversion Repositories Scribus

Rev

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