forked from fontmatrix/fontmatrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
292 lines (242 loc) · 7.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# Fontmatrix ./CMakeLists.txt v1
PROJECT(fontmatrix) # the name of your project
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
SET (VERSION_MAJOR "0")
SET (VERSION_MINOR "9")
SET (VERSION_PATCH "99")
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
ADD_DEFINITIONS(-DFONTMATRIX_VERSION_MAJOR=${VERSION_MAJOR} -DFONTMATRIX_VERSION_MINOR=${VERSION_MINOR} -DFONTMATRIX_VERSION_PATCH=${VERSION_PATCH})
MESSAGE(STATUS "Building Fontmatrix ${VERSION}")
IF(UNIX AND NOT APPLE)
SET (CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation path")
SET (FONTMATRIX_BIN bin )
SET (FONTMATRIX_QMDIR "share/fontmatrix/qm" )
ENDIF(UNIX AND NOT APPLE)
IF(APPLE)
# SET (CMAKE_INSTALL_PREFIX /Applications CACHE PATH "Installation path")
# SET (FONTMATRIX_BIN bin "")
set( CMAKE_OSX_ARCHITECTURES i386 )
ENDIF(APPLE)
IF(WIN32)
SET (CMAKE_INSTALL_PREFIX c:/fontmatrix CACHE PATH "Installation path")
SET (FONTMATRIX_BIN "")
SET (FONTMATRIX_QMDIR "qm" )
ENDIF(WIN32)
ADD_DEFINITIONS(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "Fontmatrix will be installed under ${CMAKE_INSTALL_PREFIX}")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# Very generic definition, mainly to sort out bugs reported by mrdocs
IF(APPLE)
ADD_DEFINITIONS( -DPLATFORM_APPLE )
ENDIF(APPLE)
#<< harfbuzz (shaper)
IF(WANT_HARFBUZZ)
# Since Harfbuzz source code is included into
# FM source tree, it’s just a matter of activation
# and « cohérence »
ADD_DEFINITIONS( -DHAVE_HARFBUZZ )
SET(HARFBUZZSHAPER 1)
MESSAGE(STATUS "Build Harbuzz shaper support")
ENDIF(WANT_HARFBUZZ)
#>> harfbuzz (shaper)
#<< ICU
IF(WANT_ICU)
# SET(ICU_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(ICU)
if(ICU_FOUND)
MESSAGE(STATUS "ICU Found OK")
ADD_DEFINITIONS( -DHAVE_ICU )
SET(ICUSHAPER 1)
MESSAGE(STATUS "Build ICU shaper support")
ELSE(ICU_FOUND)
MESSAGE(FATAL_ERROR "ICU Not Found ARGH")
ENDIF(ICU_FOUND)
ENDIF(WANT_ICU)
#>> ICU
#<< m17n
IF(WANT_M17N)
# SET(M17N_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(M17N)
if(M17N_FOUND)
MESSAGE(STATUS "M17N Found OK")
ADD_DEFINITIONS( -DHAVE_M17N )
SET(M17NSHAPER 1)
MESSAGE(STATUS "Build m17n shaper support")
ELSE(M17N_FOUND)
MESSAGE(FATAL_ERROR "M17N Not Found ARGH")
ENDIF(M17N_FOUND)
ENDIF(WANT_M17N)
#>> m17n
IF(WANT_PODOFO)
# SET(LIBPODOFO_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(LIBPODOFO)
IF(LIBPODOFO_FOUND)
MESSAGE(STATUS "PoDoFo Library Found OK")
ADD_DEFINITIONS(-DHAVE_PODOFO)
SET(PODOFO 1)
ENDIF(LIBPODOFO_FOUND)
ENDIF(WANT_PODOFO)
# I can’t remember what it does :|
ADD_DEFINITIONS( -DHIGH_PERF )
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(STATUS "Debug build")
ADD_DEFINITIONS(-DBUILD_TYPE_DEBUG)
ELSE(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS(-DQT_NO_DEBUG_OUTPUT)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
# A lot from Scribus
#<< Qt
SET (QT_MIN_VERSION "4.4.0")
FIND_PACKAGE(Qt4 REQUIRED)
SET (QT_MT_REQUIRED TRUE)
SET (QT_USE_QTXML TRUE )
SET (QT_USE_QTSVG TRUE )
SET (QT_USE_QTSQL TRUE )
SET (QT_USE_QTNETWORK TRUE )
SET (QT_USE_QTWEBKIT TRUE )
SET (QT_USE_QTOPENGL TRUE )
INCLUDE( ${QT_USE_FILE} )
IF (QT_FOUND)
IF(QT_QTWEBKIT_FOUND)
MESSAGE(STATUS "Qt4 Found OK")
# Webkit needs it at least with OpenSuse package
# INCLUDE_DIRECTORIES( QT_QT_INCLUDE_DIR )
ELSE(QT_QTWEBKIT_FOUND)
MESSAGE(FATAL_ERROR "QtWebKit not found")
ENDIF(QT_QTWEBKIT_FOUND)
ELSE(QT_FOUND)
MESSAGE(FATAL_ERROR "No Qt4 found")
ENDIF(QT_FOUND)
#>> Qt
IF(QT_QTOPENGL_FOUND)
ADD_DEFINITIONS(-DHAVE_QTOPENGL )
ENDIF(QT_QTOPENGL_FOUND)
SET(HARFBUZZ_DIR harfbuzz/src)
ADD_SUBDIRECTORY(${HARFBUZZ_DIR})
MESSAGE(STATUS "Adding "${CMAKE_SOURCE_DIR}/${HARFBUZZ_DIR})
SET(HARFBUZZ_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${HARFBUZZ_DIR})
# SET(PUZZLE_DIR libpuzzle/src)
# ADD_SUBDIRECTORY(${PUZZLE_DIR})
# MESSAGE(STATUS "Adding "${CMAKE_SOURCE_DIR}/${PUZZLE_DIR})
# SET(PUZZLE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${PUZZLE_DIR})
#<< FreeType2
# We give a try to the built-in cmake Freetype.cmake
FIND_PACKAGE(Freetype REQUIRED)
IF (FREETYPE_FOUND)
MESSAGE(STATUS "FreeType2 Library Found OK")
ELSE (FREETYPE_FOUND)
MESSAGE(FATAL_ERROR "No Freetype found")
ENDIF(FREETYPE_FOUND)
#>> FreeType2
IF(WANT_PYTHONQT)
FIND_PACKAGE(PythonLibs REQUIRED)
if(PYTHONLIBS_FOUND)
MESSAGE(STATUS "Python Library Found OK")
else(PYTHONLIBS_FOUND)
MESSAGE(FATAL_ERROR "No Python Library found")
endif(PYTHONLIBS_FOUND)
SET(PYTHONQT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/pythonqt/src)
ADD_SUBDIRECTORY(${PYTHONQT_INCLUDE_DIRS})
ADD_DEFINITIONS(-DHAVE_PYTHONQT)
ENDIF(WANT_PYTHONQT)
IF(UNIX AND NOT APPLE)
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(FONTCONFIG)
IF(FONTCONFIG_FOUND)
MESSAGE(STATUS "FontConfig Found OK")
ADD_DEFINITIONS( -DHAVE_FONTCONFIG )
ENDIF(FONTCONFIG_FOUND)
ENDIF(UNIX AND NOT APPLE)
SET(FM_TEMPLATES_FILES
${CMAKE_SOURCE_DIR}/src/graphic-resources/template_oneline.xml
${CMAKE_SOURCE_DIR}/src/graphic-resources/template_oneline.png
${CMAKE_SOURCE_DIR}/src/graphic-resources/template_default.xml
${CMAKE_SOURCE_DIR}/src/graphic-resources/template_default.png
)
SET(FM_STYLE_FILES
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/info.css
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/fontmatrix.js
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/img/css-info-propertyname.png
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/img/css-info-property.png
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/img/css-shadow.png
${CMAKE_SOURCE_DIR}/src/graphic-resources/html-css/img/css-tech-info.png
)
SET(FM_WELCOME_FILES
${CMAKE_SOURCE_DIR}/src/messages/welcome_cs.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_da.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_de.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_en.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_fi.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_fr.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_hi.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_nb.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_nl.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_no.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_ru.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_sr.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_sv.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_uk.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_zh_CN.html
${CMAKE_SOURCE_DIR}/src/messages/welcome_zh_TW.html
)
# tell cmake to process CMakeLists.txt in that subdirectory
SET(HYPHENATE_DIR src/hyphenate)
ADD_SUBDIRECTORY(${HYPHENATE_DIR})
SET(HYPHENATE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${HYPHENATE_DIR})
ADD_SUBDIRECTORY(src)
# dodict
# ADD_SUBDIRECTORY(src/langs)
######## Installation ##################
IF(UNIX AND NOT APPLE)
SET(DESKTOPDIR "share/applications/")
SET(MANDIR "share/man/")
SET(ICONDIR "share/icons/hicolor/48x48/apps/")
SET(RESOURCESDIR "share/fontmatrix/resources/")
SET(HELPDIR "share/fontmatrix/help/")
INSTALL(FILES
fontmatrix.desktop
DESTINATION ${DESKTOPDIR}
)
INSTALL(FILES
fontmatrix.png
DESTINATION ${ICONDIR}
)
INSTALL(FILES
fontmatrix.1
DESTINATION "${MANDIR}man1"
)
INSTALL(FILES
${FM_TEMPLATES_FILES}
${FM_STYLE_FILES}
${FM_WELCOME_FILES}
DESTINATION "${RESOURCESDIR}"
)
INSTALL(FILES
${FM_HELP_FILES}
DESTINATION "${HELPDIR}"
)
ENDIF(UNIX AND NOT APPLE)
IF(APPLE)
# we do not "install" on apple’s OS
ENDIF(APPLE)
IF(WIN32)
SET(RESOURCESDIR "share/resources/")
SET(HELPDIR "help/")
INSTALL(FILES
${FM_TEMPLATES_FILES}
${FM_STYLE_FILES}
${FM_WELCOME_FILES}
${FM_HELP_FILES}
DESTINATION "${RESOURCESDIR}"
)
INSTALL(FILES
${UNICODE_RESOURCES}
DESTINATION "${RESOURCESDIR}/Unicode/"
)
ENDIF(WIN32)
ADD_SUBDIRECTORY(help)
ADD_SUBDIRECTORY(samples)
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
INCLUDE(CPack)