Subversion Repositories Scribus

Rev

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