Subversion Repositories Scribus

Rev

Rev 5396 | Rev 5463 | 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
 
5271 mrdocs 78
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall")
5272 mrdocs 79
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall")
5271 mrdocs 80
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
81
SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
5142 cbradney 82
 
83
#FIND DEPENDENCIES
84
# START QT
85
SET (QT_MT_REQUIRED true)
5382 cbradney 86
SET (QT_MIN_VERSION "3.3.4")
5142 cbradney 87
FIND_PACKAGE(Qt3 REQUIRED)
88
IF (QT_FOUND)
5382 cbradney 89
  MESSAGE("Qt3 Found OK (${qt_version_str})")
90
#   MESSAGE($ENV{QTDIR})
91
#   MESSAGE(${QT_MOC_EXECUTABLE})
92
#   MESSAGE(${QT_UIC_EXECUTABLE})
93
#   MESSAGE(${QT_QT_LIBRARY})
94
#   MESSAGE(${QT_INCLUDE_DIR})
95
#   MESSAGE(${qt_version_str})
96
#   MESSAGE(${qt_version_str_lib})
5142 cbradney 97
ELSE(QT_FOUND)
98
  MESSAGE(FATAL_ERROR "No Qt3")
99
ENDIF(QT_FOUND)
100
# END QT
101
# START PNG, JPEG, TIFF
102
FIND_PACKAGE(PNG REQUIRED)
103
IF (PNG_FOUND)
104
  MESSAGE("PNG Library Found OK")
105
ENDIF(PNG_FOUND)
106
FIND_PACKAGE(JPEG REQUIRED)
107
IF (JPEG_FOUND)
108
  MESSAGE("JPEG Library Found OK")
109
ENDIF(JPEG_FOUND)
110
FIND_PACKAGE(TIFF REQUIRED)
111
IF (TIFF_FOUND)
112
  MESSAGE("TIFF Library Found OK")
113
  SET(HAVE_TIFF 1)
114
ENDIF(TIFF_FOUND)
115
FIND_PACKAGE(ZLIB REQUIRED)
116
IF (ZLIB_FOUND)
117
  MESSAGE("ZLIB Library Found OK")
118
  SET(HAVE_LIBZ 1)
119
ENDIF(ZLIB_FOUND)
120
FIND_PACKAGE(PythonLibs REQUIRED)
121
IF (PYTHON_LIBRARY)
122
  MESSAGE("Python Library Found OK")
123
  SET(HAVE_PYTHON 1)
124
  SET(COMPILE_PYTHON 1)
125
ENDIF(PYTHON_LIBRARY)
126
 
127
# START FREETYPE
128
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
129
FIND_PACKAGE(FREETYPE REQUIRED)
130
IF (FREETYPE_FOUND)
131
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 132
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
133
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 134
ENDIF(FREETYPE_FOUND)
135
#FIXME: if cflags empty add, otherwise replace as now
136
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
137
# END FREETYPE
138
 
139
# START LIBART_LGPL
5159 cbradney 140
SET(RENDER_LIB "")
5142 cbradney 141
IF (WANT_LIBART OR NOT WANT_CAIRO)
142
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
143
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
144
  SET(USE_LIBART 1)
145
  IF(LIBART_LGPL_FOUND)
5159 cbradney 146
    SET(RENDER_LIB "LIBART")
5142 cbradney 147
    MESSAGE("Libart_LGPL Library Found OK")
148
  ENDIF(LIBART_LGPL_FOUND)
149
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
150
  # START CAIRO
5157 cbradney 151
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
152
  FIND_PACKAGE(CAIRO)
5142 cbradney 153
  IF(CAIRO_FOUND)
154
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 155
    SET(HAVE_CAIRO 1)
5159 cbradney 156
    SET(RENDER_LIB "CAIRO")
5142 cbradney 157
  ELSE(CAIRO_FOUND)
158
    SET(USE_LIBART 0)
159
  ENDIF(CAIRO_FOUND)
160
  # END CAIRO
161
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
162
# END LIBART_LGPL
163
 
5159 cbradney 164
IF(NOT RENDER_LIB)
5170 cbradney 165
  MESSAGE(FATAL_ERROR "ERROR: Neither LibArt_LGPL nor cairo have been selected or found, please correct and restart cmake")
5159 cbradney 166
ENDIF(NOT RENDER_LIB)
167
 
168
 
5142 cbradney 169
# START CUPS
170
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
171
FIND_PACKAGE(CUPS REQUIRED)
172
IF(CUPS_FOUND)
173
  SET(HAVE_CUPS 1)
174
  MESSAGE("CUPS Library Found OK")
175
ENDIF(CUPS_FOUND)
176
# END CUPS
177
 
178
# START LIBXML2
179
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
180
FIND_PACKAGE(LIBXML2 REQUIRED)
181
IF(LIBXML2_FOUND)
182
  SET(HAVE_XML 1)
183
  MESSAGE("LIBXML2 Library Found OK")
184
ENDIF(LIBXML2_FOUND)
185
# END LIBXML2
186
 
187
# START LCMS
188
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
189
FIND_PACKAGE(LCMS REQUIRED)
190
IF(LCMS_FOUND)
191
  SET(HAVE_CMS 1)
192
  SET(CMS_INC "lcms.h")
193
  MESSAGE("LittleCMS Library Found OK")
194
ENDIF(LCMS_FOUND)
195
# END LCMS
196
 
197
# START FONTCONFIG
198
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
199
FIND_PACKAGE(FONTCONFIG)
200
IF(FONTCONFIG_FOUND)
201
	MESSAGE("FontConfig Found OK")
202
	SET(HAVE_FONTCONFIG 1)
203
ENDIF(FONTCONFIG_FOUND)
204
# END FONTCONFIG
205
 
206
ADD_DEFINITIONS(${QT_DEFINITIONS})
207
 
208
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
209
IF(HAVE_DLFCN_H)
210
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
211
ENDIF(HAVE_DLFCN_H)
212
 
213
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
214
IF(HAVE_UNISTD_H)
215
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
216
ENDIF(HAVE_UNISTD_H)
217
 
218
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
219
# IF(HAVE_SYS_TYPES_H)
220
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
221
# ENDIF(HAVE_SYS_TYPES_H)
222
 
223
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
224
# IF(HAVE_SYS_STAT_H)
225
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
226
# ENDIF(HAVE_SYS_STAT_H)
227
 
228
 
5150 cbradney 229
#Create configure files.. config.h and uninstall
230
#config.h
5142 cbradney 231
INCLUDE (ConfigureChecks.cmake)
232
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
233
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 234
#uninstall
235
CONFIGURE_FILE(
236
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
237
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
238
  IMMEDIATE @ONLY)
5142 cbradney 239
 
5150 cbradney 240
ADD_CUSTOM_TARGET(uninstall
241
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
242
 
5157 cbradney 243
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 244
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
245
FIND_PACKAGE(SCRIBUSQT)
246
 
5157 cbradney 247
#Set up include dirs with all found packages
5142 cbradney 248
INCLUDE_DIRECTORIES(
5203 cbradney 249
${CMAKE_BINARY_DIR}
5205 cbradney 250
${CMAKE_BINARY_DIR}/scribus
5142 cbradney 251
${QT_INCLUDE_DIR}
252
${QT_INCLUDE_PATH}
253
${CUPS_INCLUDE_DIR}
254
${FREETYPE_INCLUDE_DIR}
255
${FONTCONFIG_INCLUDE_DIR}
256
${LCMS_INCLUDE_DIR}
257
${LIBXML2_INCLUDE_DIR}
258
${PYTHON_INCLUDE_PATH}
259
${TIFF_INCLUDE_DIR}
260
${ZLIB_INCLUDE_DIR}
261
)
262
 
5157 cbradney 263
#Set up libraries to link with all found packages
5142 cbradney 264
LINK_LIBRARIES (
265
${QT_QT_LIBRARY}
266
${CUPS_LIBRARIES}
267
${FREETYPE_LIBRARIES}
268
${FONTCONFIG_LIBRARIES}
269
${LCMS_LIBRARIES}
270
${LIBXML2_LIBRARIES}
271
${PYTHON_LIBRARIES}
272
${TIFF_LIBRARIES}
273
${ZLIB_LIBRARIES}
274
)
275
 
5157 cbradney 276
#Select Libart_LGPL or Cairo
5174 cbradney 277
IF(RENDER_LIB STREQUAL "LIBART")
5157 cbradney 278
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
279
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
5174 cbradney 280
ENDIF(RENDER_LIB STREQUAL "LIBART")
281
IF(RENDER_LIB STREQUAL "CAIRO")
5157 cbradney 282
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
283
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
5174 cbradney 284
ENDIF(RENDER_LIB STREQUAL "CAIRO")
5157 cbradney 285
 
5142 cbradney 286
IF(WIN32)
287
  LINK_LIBRARIES(
288
    ${QT_QTMAIN_LIBRARY}
289
  )
290
ENDIF(WIN32)
291
 
292
IF(WIN32)
293
  ADD_DEFINITIONS(-DQT_DLL)
294
ENDIF(WIN32)
295
 
5157 cbradney 296
#Add our source subdirs
5142 cbradney 297
ADD_SUBDIRECTORY(scribus)
298
 
5157 cbradney 299
#Install our READMEs etc.
5142 cbradney 300
INSTALL(FILES
301
AUTHORS
302
BUILDING
303
ChangeLog
304
ChangeLogCVS
305
COPYING
306
INSTALL
307
NEWS
308
PACKAGING
309
README
310
README.MacOSX
311
TODO
312
scribus.xml
313
  DESTINATION ${DOCDIR}
314
)
5396 cbradney 315
 
316
# If the cmake version includes cpack, use it
317
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
318
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
319
  SET(CPACK_PACKAGE_VENDOR "Scribus Team")
320
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
321
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
322
  SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
323
  SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
324
  SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
5407 cbradney 325
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
5396 cbradney 326
  SET(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
327
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus${TAG_VERSION}")
5407 cbradney 328
  SET(CPACK_SOURCE_GENERATOR TBZ2)
5396 cbradney 329
 
330
  INCLUDE(CPack)
331
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")