Subversion Repositories Scribus

Rev

Rev 5144 | Go to most recent revision | Details | 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)
7
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
8
# SET(CMAKE_SHARED_MODULE_LINK_FLAGS "${CMAKE_SHARED_MODULE_LINK_FLAGS} -export-dynamic")
9
# SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS} -export-dynamic")
10
# SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -export-dynamic")
11
# SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -export-dynamic")
12
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_FLAGS})
13
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS})
14
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
15
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
16
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_MODULE})
17
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
18
 
19
#IMPORT FROM COMMANDLINE
20
# SET with cmake -DWANT_CAIRO=1, etc
21
# MESSAGE(STATUS ${WANT_CAIRO})
22
# MESSAGE(STATUS ${WANT_LIBART})
23
# MESSAGE(STATUS ${WANT_LCMS})
24
# MESSAGE(STATUS ${WANT_DEBUG})
25
#NO CAIRO SUPPORT YET
26
SET(MAIN_DIR_NAME "scribus")
27
SET(WANT_CAIRO 0)
28
SET(WANT_LIBART 1)
29
 
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
 
37
SET(MANDIR "man/")
38
SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
39
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
40
SET(DOCDIR "share/${MAIN_DIR_NAME}/doc/")
41
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
42
SET(ICONDIR "share/${MAIN_DIR_NAME}/icons/")
43
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
44
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}/samples/")
45
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
46
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}/scripts/")
47
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
48
SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}/templates/")
49
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
50
SET(LIBDIR "lib/${MAIN_DIR_NAME}/")
51
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
52
SET(PLUGINDIR "lib/${MAIN_DIR_NAME}/plugins/")
53
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
54
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
55
 
56
#BUILD SETUP
57
#None, Debug, Release, .. or custom ones
58
SET(WANT_DEBUG 1)
59
IF(WANT_DEBUG)
60
  SET(CMAKE_BUILD_TYPE Debug)
61
ELSE(WANT_DEBUG)
62
  SET(CMAKE_BUILD_TYPE RELEASE)
63
ENDIF(WANT_DEBUG)
64
 
65
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
66
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
67
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
68
SET(CMAKE_C_FLAGS_RELEASE "-O2")
69
 
70
#FIND DEPENDENCIES
71
# START QT
72
SET (QT_MT_REQUIRED true)
73
FIND_PACKAGE(Qt3 REQUIRED)
74
IF (QT_FOUND)
75
  MESSAGE("Qt3 Found OK")
76
#  MESSAGE($ENV{QTDIR})
77
#  MESSAGE(${QT_MOC_EXECUTABLE})
78
#  MESSAGE(${QT_UIC_EXECUTABLE})
79
#  MESSAGE(${QT_QT_LIBRARY})
80
#  MESSAGE(${QT_INCLUDE_DIR})
81
ELSE(QT_FOUND)
82
  MESSAGE(FATAL_ERROR "No Qt3")
83
ENDIF(QT_FOUND)
84
# END QT
85
# START PNG, JPEG, TIFF
86
FIND_PACKAGE(PNG REQUIRED)
87
IF (PNG_FOUND)
88
  MESSAGE("PNG Library Found OK")
89
ENDIF(PNG_FOUND)
90
FIND_PACKAGE(JPEG REQUIRED)
91
IF (JPEG_FOUND)
92
  MESSAGE("JPEG Library Found OK")
93
ENDIF(JPEG_FOUND)
94
FIND_PACKAGE(TIFF REQUIRED)
95
IF (TIFF_FOUND)
96
  MESSAGE("TIFF Library Found OK")
97
  SET(HAVE_TIFF 1)
98
ENDIF(TIFF_FOUND)
99
FIND_PACKAGE(ZLIB REQUIRED)
100
IF (ZLIB_FOUND)
101
  MESSAGE("ZLIB Library Found OK")
102
  SET(HAVE_LIBZ 1)
103
ENDIF(ZLIB_FOUND)
104
FIND_PACKAGE(PythonLibs REQUIRED)
105
IF (PYTHON_LIBRARY)
106
  MESSAGE("Python Library Found OK")
107
  SET(HAVE_PYTHON 1)
108
  SET(COMPILE_PYTHON 1)
109
ENDIF(PYTHON_LIBRARY)
110
 
111
# START FREETYPE
112
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
113
FIND_PACKAGE(FREETYPE REQUIRED)
114
IF (FREETYPE_FOUND)
115
  MESSAGE("FreeType2 Library Found OK")
116
ENDIF(FREETYPE_FOUND)
117
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)
118
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --libs OUTPUT_VARIABLE LIBFREETYPE_LIBS)
119
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --cflags OUTPUT_VARIABLE LIBFREETYPE_CFLAGS)
120
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
121
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
122
#FIXME: if cflags empty add, otherwise replace as now
123
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
124
# END FREETYPE
125
 
126
# START LIBART_LGPL
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)
132
    MESSAGE("Libart_LGPL Library Found OK")
133
  ENDIF(LIBART_LGPL_FOUND)
134
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
135
  # START CAIRO
136
  IF(CAIRO_FOUND)
137
    MESSAGE("CAIRO Library Found OK")
138
  ELSE(CAIRO_FOUND)
139
    SET(USE_LIBART 0)
140
  ENDIF(CAIRO_FOUND)
141
  # END CAIRO
142
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
143
# END LIBART_LGPL
144
 
145
# START CUPS
146
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
147
FIND_PACKAGE(CUPS REQUIRED)
148
IF(CUPS_FOUND)
149
  SET(HAVE_CUPS 1)
150
  MESSAGE("CUPS Library Found OK")
151
#   MESSAGE(STATUS ${CUPS_INCLUDE_DIR})
152
#   MESSAGE(STATUS ${CUPS_LIBRARIES})
153
ENDIF(CUPS_FOUND)
154
# END CUPS
155
 
156
# START LIBXML2
157
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
158
FIND_PACKAGE(LIBXML2 REQUIRED)
159
IF(LIBXML2_FOUND)
160
  SET(HAVE_XML 1)
161
  MESSAGE("LIBXML2 Library Found OK")
162
ENDIF(LIBXML2_FOUND)
163
# END LIBXML2
164
 
165
# START LCMS
166
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
167
FIND_PACKAGE(LCMS REQUIRED)
168
IF(LCMS_FOUND)
169
  SET(HAVE_CMS 1)
170
  SET(CMS_INC "lcms.h")
171
  MESSAGE("LittleCMS Library Found OK")
172
ENDIF(LCMS_FOUND)
173
# END LCMS
174
 
175
# START FONTCONFIG
176
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
177
FIND_PACKAGE(FONTCONFIG)
178
IF(FONTCONFIG_FOUND)
179
	MESSAGE("FontConfig Found OK")
180
	SET(HAVE_FONTCONFIG 1)
181
ENDIF(FONTCONFIG_FOUND)
182
# END FONTCONFIG
183
 
184
ADD_DEFINITIONS(${QT_DEFINITIONS})
185
 
186
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
187
IF(HAVE_DLFCN_H)
188
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
189
ENDIF(HAVE_DLFCN_H)
190
 
191
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
192
IF(HAVE_UNISTD_H)
193
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
194
ENDIF(HAVE_UNISTD_H)
195
 
196
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
197
# IF(HAVE_SYS_TYPES_H)
198
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
199
# ENDIF(HAVE_SYS_TYPES_H)
200
 
201
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
202
# IF(HAVE_SYS_STAT_H)
203
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
204
# ENDIF(HAVE_SYS_STAT_H)
205
 
206
 
207
INCLUDE (ConfigureChecks.cmake)
208
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
209
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
210
 
211
SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
212
FIND_PACKAGE(SCRIBUSQT)
213
 
214
INCLUDE_DIRECTORIES(
215
${QT_INCLUDE_DIR}
216
${QT_INCLUDE_PATH}
217
${CUPS_INCLUDE_DIR}
218
${FREETYPE_INCLUDE_DIR}
219
${FONTCONFIG_INCLUDE_DIR}
220
${LCMS_INCLUDE_DIR}
221
${LIBART_LGPL_INCLUDE_DIR}
222
${LIBXML2_INCLUDE_DIR}
223
${PYTHON_INCLUDE_PATH}
224
${TIFF_INCLUDE_DIR}
225
${ZLIB_INCLUDE_DIR}
226
)
227
 
228
LINK_LIBRARIES (
229
${QT_QT_LIBRARY}
230
${CUPS_LIBRARIES}
231
${FREETYPE_LIBRARIES}
232
${FONTCONFIG_LIBRARIES}
233
${LCMS_LIBRARIES}
234
${LIBART_LGPL_LIBRARIES}
235
${LIBXML2_LIBRARIES}
236
${PYTHON_LIBRARIES}
237
${TIFF_LIBRARIES}
238
${ZLIB_LIBRARIES}
239
)
240
 
241
IF(WIN32)
242
  LINK_LIBRARIES(
243
    ${QT_QTMAIN_LIBRARY}
244
  )
245
ENDIF(WIN32)
246
 
247
IF(WIN32)
248
  ADD_DEFINITIONS(-DQT_DLL)
249
ENDIF(WIN32)
250
 
251
ADD_SUBDIRECTORY(scribus)
252
 
253
INSTALL(FILES
254
AUTHORS
255
BUILDING
256
ChangeLog
257
ChangeLogCVS
258
COPYING
259
INSTALL
260
NEWS
261
PACKAGING
262
README
263
README.MacOSX
264
TODO
265
scribus.xml
266
  DESTINATION ${DOCDIR}
267
)