Subversion Repositories Scribus

Rev

Rev 5379 | Rev 5396 | 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)
32
SET (VERSION 1.3.4cvs)
33
MESSAGE(STATUS "Scribus will be built to install into ${CMAKE_INSTALL_PREFIX}")
34
 
35
SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
36
 
5379 cbradney 37
SET(MAIN_DIR_NAME "scribus")
38
IF (WANT_VERSIONING)
39
	SET(TAG_VERSION "-${VERSION}")
40
ENDIF (WANT_VERSIONING)
41
 
5142 cbradney 42
SET(MANDIR "man/")
43
SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
44
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
5379 cbradney 45
SET(DOCDIR "share/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 46
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
5379 cbradney 47
SET(ICONDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
5142 cbradney 48
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
5379 cbradney 49
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
5142 cbradney 50
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
5379 cbradney 51
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
5142 cbradney 52
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
5379 cbradney 53
SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
5142 cbradney 54
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
5379 cbradney 55
SET(LIBDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/")
5142 cbradney 56
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
5379 cbradney 57
SET(PLUGINDIR "lib/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
5142 cbradney 58
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
59
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
60
 
61
#BUILD SETUP
62
#None, Debug, Release, .. or custom ones
63
SET(WANT_DEBUG 1)
64
IF(WANT_DEBUG)
65
  SET(CMAKE_BUILD_TYPE Debug)
66
ELSE(WANT_DEBUG)
67
  SET(CMAKE_BUILD_TYPE RELEASE)
68
ENDIF(WANT_DEBUG)
69
 
5271 mrdocs 70
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall")
5272 mrdocs 71
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall")
5271 mrdocs 72
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall")
73
SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall")
5142 cbradney 74
 
75
#FIND DEPENDENCIES
76
# START QT
77
SET (QT_MT_REQUIRED true)
5382 cbradney 78
SET (QT_MIN_VERSION "3.3.4")
5142 cbradney 79
FIND_PACKAGE(Qt3 REQUIRED)
80
IF (QT_FOUND)
5382 cbradney 81
  MESSAGE("Qt3 Found OK (${qt_version_str})")
82
#   MESSAGE($ENV{QTDIR})
83
#   MESSAGE(${QT_MOC_EXECUTABLE})
84
#   MESSAGE(${QT_UIC_EXECUTABLE})
85
#   MESSAGE(${QT_QT_LIBRARY})
86
#   MESSAGE(${QT_INCLUDE_DIR})
87
#   MESSAGE(${qt_version_str})
88
#   MESSAGE(${qt_version_str_lib})
5142 cbradney 89
ELSE(QT_FOUND)
90
  MESSAGE(FATAL_ERROR "No Qt3")
91
ENDIF(QT_FOUND)
92
# END QT
93
# START PNG, JPEG, TIFF
94
FIND_PACKAGE(PNG REQUIRED)
95
IF (PNG_FOUND)
96
  MESSAGE("PNG Library Found OK")
97
ENDIF(PNG_FOUND)
98
FIND_PACKAGE(JPEG REQUIRED)
99
IF (JPEG_FOUND)
100
  MESSAGE("JPEG Library Found OK")
101
ENDIF(JPEG_FOUND)
102
FIND_PACKAGE(TIFF REQUIRED)
103
IF (TIFF_FOUND)
104
  MESSAGE("TIFF Library Found OK")
105
  SET(HAVE_TIFF 1)
106
ENDIF(TIFF_FOUND)
107
FIND_PACKAGE(ZLIB REQUIRED)
108
IF (ZLIB_FOUND)
109
  MESSAGE("ZLIB Library Found OK")
110
  SET(HAVE_LIBZ 1)
111
ENDIF(ZLIB_FOUND)
112
FIND_PACKAGE(PythonLibs REQUIRED)
113
IF (PYTHON_LIBRARY)
114
  MESSAGE("Python Library Found OK")
115
  SET(HAVE_PYTHON 1)
116
  SET(COMPILE_PYTHON 1)
117
ENDIF(PYTHON_LIBRARY)
118
 
119
# START FREETYPE
120
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
121
FIND_PACKAGE(FREETYPE REQUIRED)
122
IF (FREETYPE_FOUND)
123
  MESSAGE("FreeType2 Library Found OK")
5170 cbradney 124
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
125
  CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
5142 cbradney 126
ENDIF(FREETYPE_FOUND)
127
#FIXME: if cflags empty add, otherwise replace as now
128
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
129
# END FREETYPE
130
 
131
# START LIBART_LGPL
5159 cbradney 132
SET(RENDER_LIB "")
5142 cbradney 133
IF (WANT_LIBART OR NOT WANT_CAIRO)
134
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
135
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
136
  SET(USE_LIBART 1)
137
  IF(LIBART_LGPL_FOUND)
5159 cbradney 138
    SET(RENDER_LIB "LIBART")
5142 cbradney 139
    MESSAGE("Libart_LGPL Library Found OK")
140
  ENDIF(LIBART_LGPL_FOUND)
141
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
142
  # START CAIRO
5157 cbradney 143
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
144
  FIND_PACKAGE(CAIRO)
5142 cbradney 145
  IF(CAIRO_FOUND)
146
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 147
    SET(HAVE_CAIRO 1)
5159 cbradney 148
    SET(RENDER_LIB "CAIRO")
5142 cbradney 149
  ELSE(CAIRO_FOUND)
150
    SET(USE_LIBART 0)
151
  ENDIF(CAIRO_FOUND)
152
  # END CAIRO
153
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
154
# END LIBART_LGPL
155
 
5159 cbradney 156
IF(NOT RENDER_LIB)
5170 cbradney 157
  MESSAGE(FATAL_ERROR "ERROR: Neither LibArt_LGPL nor cairo have been selected or found, please correct and restart cmake")
5159 cbradney 158
ENDIF(NOT RENDER_LIB)
159
 
160
 
5142 cbradney 161
# START CUPS
162
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
163
FIND_PACKAGE(CUPS REQUIRED)
164
IF(CUPS_FOUND)
165
  SET(HAVE_CUPS 1)
166
  MESSAGE("CUPS Library Found OK")
167
ENDIF(CUPS_FOUND)
168
# END CUPS
169
 
170
# START LIBXML2
171
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
172
FIND_PACKAGE(LIBXML2 REQUIRED)
173
IF(LIBXML2_FOUND)
174
  SET(HAVE_XML 1)
175
  MESSAGE("LIBXML2 Library Found OK")
176
ENDIF(LIBXML2_FOUND)
177
# END LIBXML2
178
 
179
# START LCMS
180
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
181
FIND_PACKAGE(LCMS REQUIRED)
182
IF(LCMS_FOUND)
183
  SET(HAVE_CMS 1)
184
  SET(CMS_INC "lcms.h")
185
  MESSAGE("LittleCMS Library Found OK")
186
ENDIF(LCMS_FOUND)
187
# END LCMS
188
 
189
# START FONTCONFIG
190
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
191
FIND_PACKAGE(FONTCONFIG)
192
IF(FONTCONFIG_FOUND)
193
	MESSAGE("FontConfig Found OK")
194
	SET(HAVE_FONTCONFIG 1)
195
ENDIF(FONTCONFIG_FOUND)
196
# END FONTCONFIG
197
 
198
ADD_DEFINITIONS(${QT_DEFINITIONS})
199
 
200
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
201
IF(HAVE_DLFCN_H)
202
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
203
ENDIF(HAVE_DLFCN_H)
204
 
205
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
206
IF(HAVE_UNISTD_H)
207
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
208
ENDIF(HAVE_UNISTD_H)
209
 
210
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
211
# IF(HAVE_SYS_TYPES_H)
212
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
213
# ENDIF(HAVE_SYS_TYPES_H)
214
 
215
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
216
# IF(HAVE_SYS_STAT_H)
217
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
218
# ENDIF(HAVE_SYS_STAT_H)
219
 
220
 
5150 cbradney 221
#Create configure files.. config.h and uninstall
222
#config.h
5142 cbradney 223
INCLUDE (ConfigureChecks.cmake)
224
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
225
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 226
#uninstall
227
CONFIGURE_FILE(
228
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
229
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
230
  IMMEDIATE @ONLY)
5142 cbradney 231
 
5150 cbradney 232
ADD_CUSTOM_TARGET(uninstall
233
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
234
 
5157 cbradney 235
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 236
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
237
FIND_PACKAGE(SCRIBUSQT)
238
 
5157 cbradney 239
#Set up include dirs with all found packages
5142 cbradney 240
INCLUDE_DIRECTORIES(
5203 cbradney 241
${CMAKE_BINARY_DIR}
5205 cbradney 242
${CMAKE_BINARY_DIR}/scribus
5142 cbradney 243
${QT_INCLUDE_DIR}
244
${QT_INCLUDE_PATH}
245
${CUPS_INCLUDE_DIR}
246
${FREETYPE_INCLUDE_DIR}
247
${FONTCONFIG_INCLUDE_DIR}
248
${LCMS_INCLUDE_DIR}
249
${LIBXML2_INCLUDE_DIR}
250
${PYTHON_INCLUDE_PATH}
251
${TIFF_INCLUDE_DIR}
252
${ZLIB_INCLUDE_DIR}
253
)
254
 
5157 cbradney 255
#Set up libraries to link with all found packages
5142 cbradney 256
LINK_LIBRARIES (
257
${QT_QT_LIBRARY}
258
${CUPS_LIBRARIES}
259
${FREETYPE_LIBRARIES}
260
${FONTCONFIG_LIBRARIES}
261
${LCMS_LIBRARIES}
262
${LIBXML2_LIBRARIES}
263
${PYTHON_LIBRARIES}
264
${TIFF_LIBRARIES}
265
${ZLIB_LIBRARIES}
266
)
267
 
5157 cbradney 268
#Select Libart_LGPL or Cairo
5174 cbradney 269
IF(RENDER_LIB STREQUAL "LIBART")
5157 cbradney 270
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
271
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
5174 cbradney 272
ENDIF(RENDER_LIB STREQUAL "LIBART")
273
IF(RENDER_LIB STREQUAL "CAIRO")
5157 cbradney 274
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
275
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
5174 cbradney 276
ENDIF(RENDER_LIB STREQUAL "CAIRO")
5157 cbradney 277
 
5142 cbradney 278
IF(WIN32)
279
  LINK_LIBRARIES(
280
    ${QT_QTMAIN_LIBRARY}
281
  )
282
ENDIF(WIN32)
283
 
284
IF(WIN32)
285
  ADD_DEFINITIONS(-DQT_DLL)
286
ENDIF(WIN32)
287
 
5157 cbradney 288
#Add our source subdirs
5142 cbradney 289
ADD_SUBDIRECTORY(scribus)
290
 
5157 cbradney 291
#Install our READMEs etc.
5142 cbradney 292
INSTALL(FILES
293
AUTHORS
294
BUILDING
295
ChangeLog
296
ChangeLogCVS
297
COPYING
298
INSTALL
299
NEWS
300
PACKAGING
301
README
302
README.MacOSX
303
TODO
304
scribus.xml
305
  DESTINATION ${DOCDIR}
306
)