Subversion Repositories Scribus

Rev

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