Subversion Repositories Scribus

Rev

Rev 5150 | Rev 5159 | 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
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)
135
    MESSAGE("Libart_LGPL Library Found OK")
136
  ENDIF(LIBART_LGPL_FOUND)
137
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
138
  # START CAIRO
5157 cbradney 139
  SET(CAIRO_DIR ${CMAKE_MODULE_PATH})
140
  FIND_PACKAGE(CAIRO)
5142 cbradney 141
  IF(CAIRO_FOUND)
142
    MESSAGE("CAIRO Library Found OK")
5157 cbradney 143
    SET(HAVE_CAIRO 1)
5142 cbradney 144
  ELSE(CAIRO_FOUND)
145
    SET(USE_LIBART 0)
146
  ENDIF(CAIRO_FOUND)
147
  # END CAIRO
148
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
149
# END LIBART_LGPL
150
 
151
# START CUPS
152
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
153
FIND_PACKAGE(CUPS REQUIRED)
154
IF(CUPS_FOUND)
155
  SET(HAVE_CUPS 1)
156
  MESSAGE("CUPS Library Found OK")
157
ENDIF(CUPS_FOUND)
158
# END CUPS
159
 
160
# START LIBXML2
161
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
162
FIND_PACKAGE(LIBXML2 REQUIRED)
163
IF(LIBXML2_FOUND)
164
  SET(HAVE_XML 1)
165
  MESSAGE("LIBXML2 Library Found OK")
166
ENDIF(LIBXML2_FOUND)
167
# END LIBXML2
168
 
169
# START LCMS
170
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
171
FIND_PACKAGE(LCMS REQUIRED)
172
IF(LCMS_FOUND)
173
  SET(HAVE_CMS 1)
174
  SET(CMS_INC "lcms.h")
175
  MESSAGE("LittleCMS Library Found OK")
176
ENDIF(LCMS_FOUND)
177
# END LCMS
178
 
179
# START FONTCONFIG
180
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
181
FIND_PACKAGE(FONTCONFIG)
182
IF(FONTCONFIG_FOUND)
183
	MESSAGE("FontConfig Found OK")
184
	SET(HAVE_FONTCONFIG 1)
185
ENDIF(FONTCONFIG_FOUND)
186
# END FONTCONFIG
187
 
188
ADD_DEFINITIONS(${QT_DEFINITIONS})
189
 
190
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
191
IF(HAVE_DLFCN_H)
192
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
193
ENDIF(HAVE_DLFCN_H)
194
 
195
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
196
IF(HAVE_UNISTD_H)
197
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
198
ENDIF(HAVE_UNISTD_H)
199
 
200
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
201
# IF(HAVE_SYS_TYPES_H)
202
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
203
# ENDIF(HAVE_SYS_TYPES_H)
204
 
205
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
206
# IF(HAVE_SYS_STAT_H)
207
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
208
# ENDIF(HAVE_SYS_STAT_H)
209
 
210
 
5150 cbradney 211
#Create configure files.. config.h and uninstall
212
#config.h
5142 cbradney 213
INCLUDE (ConfigureChecks.cmake)
214
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
215
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
5150 cbradney 216
#uninstall
217
CONFIGURE_FILE(
218
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
219
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
220
  IMMEDIATE @ONLY)
5142 cbradney 221
 
5150 cbradney 222
ADD_CUSTOM_TARGET(uninstall
223
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
224
 
5157 cbradney 225
#Load our SCRIBUSQT package which gives us filename.moc instead of moc_filename.*
5142 cbradney 226
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
227
FIND_PACKAGE(SCRIBUSQT)
228
 
5157 cbradney 229
#Set up include dirs with all found packages
5142 cbradney 230
INCLUDE_DIRECTORIES(
231
${QT_INCLUDE_DIR}
232
${QT_INCLUDE_PATH}
233
${CUPS_INCLUDE_DIR}
234
${FREETYPE_INCLUDE_DIR}
235
${FONTCONFIG_INCLUDE_DIR}
236
${LCMS_INCLUDE_DIR}
237
${LIBXML2_INCLUDE_DIR}
238
${PYTHON_INCLUDE_PATH}
239
${TIFF_INCLUDE_DIR}
240
${ZLIB_INCLUDE_DIR}
241
)
242
 
5157 cbradney 243
#Set up libraries to link with all found packages
5142 cbradney 244
LINK_LIBRARIES (
245
${QT_QT_LIBRARY}
246
${CUPS_LIBRARIES}
247
${FREETYPE_LIBRARIES}
248
${FONTCONFIG_LIBRARIES}
249
${LCMS_LIBRARIES}
250
${LIBXML2_LIBRARIES}
251
${PYTHON_LIBRARIES}
252
${TIFF_LIBRARIES}
253
${ZLIB_LIBRARIES}
254
)
255
 
5157 cbradney 256
#Select Libart_LGPL or Cairo
257
IF(WANT_LIBART AND LIBART_LGPL_FOUND)
258
  INCLUDE_DIRECTORIES(${LIBART_LGPL_INCLUDE_DIR})
259
  LINK_LIBRARIES(${LIBART_LGPL_LIBRARIES})
260
ENDIF(WANT_LIBART AND LIBART_LGPL_FOUND)
261
IF(WANT_CAIRO AND CAIRO_FOUND)
262
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
263
  LINK_LIBRARIES(${CAIRO_LIBRARIES})
264
ENDIF(WANT_CAIRO AND CAIRO_FOUND)
265
 
5142 cbradney 266
IF(WIN32)
267
  LINK_LIBRARIES(
268
    ${QT_QTMAIN_LIBRARY}
269
  )
270
ENDIF(WIN32)
271
 
272
IF(WIN32)
273
  ADD_DEFINITIONS(-DQT_DLL)
274
ENDIF(WIN32)
275
 
5157 cbradney 276
#Add our source subdirs
5142 cbradney 277
ADD_SUBDIRECTORY(scribus)
278
 
5157 cbradney 279
#Install our READMEs etc.
5142 cbradney 280
INSTALL(FILES
281
AUTHORS
282
BUILDING
283
ChangeLog
284
ChangeLogCVS
285
COPYING
286
INSTALL
287
NEWS
288
PACKAGING
289
README
290
README.MacOSX
291
TODO
292
scribus.xml
293
  DESTINATION ${DOCDIR}
294
)