Subversion Repositories Scribus

Rev

Rev 5142 | Rev 5150 | 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})
27
#NO CAIRO SUPPORT YET
28
SET(MAIN_DIR_NAME "scribus")
29
SET(WANT_CAIRO 0)
30
SET(WANT_LIBART 1)
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")
118
ENDIF(FREETYPE_FOUND)
119
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)
120
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --libs OUTPUT_VARIABLE LIBFREETYPE_LIBS)
121
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --cflags OUTPUT_VARIABLE LIBFREETYPE_CFLAGS)
122
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
123
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
124
#FIXME: if cflags empty add, otherwise replace as now
125
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
126
# END FREETYPE
127
 
128
# START LIBART_LGPL
129
IF (WANT_LIBART OR NOT WANT_CAIRO)
130
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
131
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
132
  SET(USE_LIBART 1)
133
  IF(LIBART_LGPL_FOUND)
134
    MESSAGE("Libart_LGPL Library Found OK")
135
  ENDIF(LIBART_LGPL_FOUND)
136
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
137
  # START CAIRO
138
  IF(CAIRO_FOUND)
139
    MESSAGE("CAIRO Library Found OK")
140
  ELSE(CAIRO_FOUND)
141
    SET(USE_LIBART 0)
142
  ENDIF(CAIRO_FOUND)
143
  # END CAIRO
144
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
145
# END LIBART_LGPL
146
 
147
# START CUPS
148
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
149
FIND_PACKAGE(CUPS REQUIRED)
150
IF(CUPS_FOUND)
151
  SET(HAVE_CUPS 1)
152
  MESSAGE("CUPS Library Found OK")
153
#   MESSAGE(STATUS ${CUPS_INCLUDE_DIR})
154
#   MESSAGE(STATUS ${CUPS_LIBRARIES})
155
ENDIF(CUPS_FOUND)
156
# END CUPS
157
 
158
# START LIBXML2
159
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
160
FIND_PACKAGE(LIBXML2 REQUIRED)
161
IF(LIBXML2_FOUND)
162
  SET(HAVE_XML 1)
163
  MESSAGE("LIBXML2 Library Found OK")
164
ENDIF(LIBXML2_FOUND)
165
# END LIBXML2
166
 
167
# START LCMS
168
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
169
FIND_PACKAGE(LCMS REQUIRED)
170
IF(LCMS_FOUND)
171
  SET(HAVE_CMS 1)
172
  SET(CMS_INC "lcms.h")
173
  MESSAGE("LittleCMS Library Found OK")
174
ENDIF(LCMS_FOUND)
175
# END LCMS
176
 
177
# START FONTCONFIG
178
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
179
FIND_PACKAGE(FONTCONFIG)
180
IF(FONTCONFIG_FOUND)
181
	MESSAGE("FontConfig Found OK")
182
	SET(HAVE_FONTCONFIG 1)
183
ENDIF(FONTCONFIG_FOUND)
184
# END FONTCONFIG
185
 
186
ADD_DEFINITIONS(${QT_DEFINITIONS})
187
 
188
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
189
IF(HAVE_DLFCN_H)
190
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
191
ENDIF(HAVE_DLFCN_H)
192
 
193
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
194
IF(HAVE_UNISTD_H)
195
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
196
ENDIF(HAVE_UNISTD_H)
197
 
198
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
199
# IF(HAVE_SYS_TYPES_H)
200
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
201
# ENDIF(HAVE_SYS_TYPES_H)
202
 
203
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
204
# IF(HAVE_SYS_STAT_H)
205
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
206
# ENDIF(HAVE_SYS_STAT_H)
207
 
208
 
209
INCLUDE (ConfigureChecks.cmake)
210
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
211
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
212
 
213
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
214
FIND_PACKAGE(SCRIBUSQT)
215
 
216
INCLUDE_DIRECTORIES(
217
${QT_INCLUDE_DIR}
218
${QT_INCLUDE_PATH}
219
${CUPS_INCLUDE_DIR}
220
${FREETYPE_INCLUDE_DIR}
221
${FONTCONFIG_INCLUDE_DIR}
222
${LCMS_INCLUDE_DIR}
223
${LIBART_LGPL_INCLUDE_DIR}
224
${LIBXML2_INCLUDE_DIR}
225
${PYTHON_INCLUDE_PATH}
226
${TIFF_INCLUDE_DIR}
227
${ZLIB_INCLUDE_DIR}
228
)
229
 
230
LINK_LIBRARIES (
231
${QT_QT_LIBRARY}
232
${CUPS_LIBRARIES}
233
${FREETYPE_LIBRARIES}
234
${FONTCONFIG_LIBRARIES}
235
${LCMS_LIBRARIES}
236
${LIBART_LGPL_LIBRARIES}
237
${LIBXML2_LIBRARIES}
238
${PYTHON_LIBRARIES}
239
${TIFF_LIBRARIES}
240
${ZLIB_LIBRARIES}
241
)
242
 
243
IF(WIN32)
244
  LINK_LIBRARIES(
245
    ${QT_QTMAIN_LIBRARY}
246
  )
247
ENDIF(WIN32)
248
 
249
IF(WIN32)
250
  ADD_DEFINITIONS(-DQT_DLL)
251
ENDIF(WIN32)
252
 
253
ADD_SUBDIRECTORY(scribus)
254
 
255
INSTALL(FILES
256
AUTHORS
257
BUILDING
258
ChangeLog
259
ChangeLogCVS
260
COPYING
261
INSTALL
262
NEWS
263
PACKAGING
264
README
265
README.MacOSX
266
TODO
267
scribus.xml
268
  DESTINATION ${DOCDIR}
269
)