Subversion Repositories Scribus

Rev

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