Subversion Repositories Scribus

Rev

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