Debian Codegraph @

fontforge/CMakeLists.txt

raw
1 # Distributed under the original FontForge BSD 3-clause license
2
3 set(FONTFORGE_NOINST_HEADERS
4 asmfpst.h
5 autohint.h
6 autosave.h
7 autotrace.h
8 autowidth.h
9 autowidth2.h
10 bitmapchar.h
11 bitmapcontrol.h
12 bvedit.h
13 clipnoui.h
14 crctab.h
15 cvexport.h
16 cvimages.h
17 cvundoes.h
18 dumpbdf.h
19 dumppfa.h
20 effects.h
21 encoding.h
22 featurefile.h
23 fontforgeui.h
24 fvcomposite.h
25 fvfonts.h
26 fvimportbdf.h
27 ikarus.h
28 langfreq.h
29 macbinary.h
30 macenc.h
31 mathconstants.h
32 multidialog.h
33 namelist.h
34 othersubrs.h
35 palmfonts.h
36 parsepdf.h
37 parsepfa.h
38 parsettf.h
39 parsettfatt.h
40 parsettfbmf.h
41 parsettfvar.h
42 plugin.h
43 psread.h
44 pua.h
45 savefont.h
46 scstyles.h
47 sfd.h
48 spiro.h
49 splinefill.h
50 splinefit.h
51 splineorder2.h
52 splineoverlap.h
53 splinerefigure.h
54 splinesave.h
55 splinesaveafm.h
56 splinestroke.h
57 splineutil.h
58 splineutil2.h
59 start.h
60 std_maps.hpp
61 svg.h
62 tottf.h
63 tottfaat.h
64 tottfgpos.h
65 tottfvar.h
66 ttfspecial.h
67 utanvec.h
68 winfonts.h
69 woff.h
70 zapfnomen.h
71 )
72
73 set(FONTFORGE_INST_HEADERS
74 autowidth.h
75 autowidth2.h
76 baseviews.h
77 bezctx_ff.h
78 bitmapcontrol.h
79 delta.h
80 edgelist.h
81 edgelist2.h
82 encoding.h
83 fffreetype.h
84 ffpython.h
85 flaglist.h
86 fontforge.h
87 fontforgevw.h
88 fvmetrics.h
89 getline.h
90 glif_name_hash.h
91 glyphcomp.h
92 groups.h
93 lookups.h
94 mem.h
95 mm.h
96 namehash.h
97 nonlineartrans.h
98 ofl.h
99 PfEd.h
100 print.h
101 psfont.h
102 savefont.h
103 scriptfuncs.h
104 scripting.h
105 sd.h
106 search.h
107 sfd1.h
108 sflayoutP.h
109 splinefont.h
110 stemdb.h
111 ttf.h
112 ttfinstrs.h
113 uiinterface.h
114 unicoderange.h
115 views.h
116 )
117
118 add_library(fontforge
119 ${FONTFORGE_NOINST_HEADERS}
120 ${FONTFORGE_INST_HEADERS}
121 activeinui.c
122 ffglib_compat.cpp
123 asmfpst.c
124 autohint.c
125 autosave.c
126 autotrace.c
127 autowidth.c
128 autowidth2.c
129 bezctx_ff.c
130 bitmapchar.c
131 bitmapcontrol.c
132 bvedit.c
133 clipnoui.c
134 crctab.cpp
135 cvexport.c
136 cvimages.c
137 cvundoes.c
138 dumpbdf.c
139 dumppfa.c
140 effects.c
141 encoding.c
142 featurefile.c
143 ffprocess.c
144 flaglist.c
145 fontviewbase.c
146 freetype.c
147 ftdelta.c
148 fvcomposite.c
149 fvfonts.c
150 fvimportbdf.c
151 fvmetrics.c
152 getline.c
153 glif_name_hash.cpp
154 glyphcomp.c
155 groups.c
156 ikarus.c
157 langfreq.c
158 lookups.c
159 macbinary.c
160 macenc.c
161 mathconstants.c
162 mem.c
163 mm.c
164 multimastersubrs.c
165 namelist.c
166 nonlineartrans.c
167 noprefs.c
168 nouiutil.c
169 nowakowskittfinstr.c
170 ofl.c
171 othersubrs.c
172 palmfonts.c
173 parsepdf.c
174 parsepfa.c
175 parsettf.c
176 parsettfatt.c
177 parsettfbmf.c
178 parsettfvar.c
179 plugin.cpp
180 print.cpp
181 psread.c
182 pua.c
183 python.cpp
184 savefont.c
185 scripting.cpp
186 scstyles.c
187 search.c
188 sfd.cpp
189 sfd1.c
190 sflayout.cpp
191 spiro.c
192 splinechar.c
193 splinefill.c
194 splinefit.c
195 splinefont.c
196 splineorder2.c
197 splineoverlap.c
198 splinerefigure.c
199 splinesave.c
200 splinesaveafm.c
201 splinestroke.c
202 splineutil.c
203 splineutil2.c
204 start.c
205 stemdb.c
206 std_maps.cpp
207 svg.c
208 tottf.c
209 tottfaat.c
210 tottfgpos.c
211 tottfvar.c
212 ttfinstrs.c
213 ttfspecial.c
214 ufo.c
215 unicoderange.c
216 utanvec.c
217 winfonts.c
218 woff.c
219 zapfnomen.c
220 )
221
222 add_subdirectory(shapers)
223
224 if(ENABLE_WOFF2_RESULT)
225 target_sources(fontforge PRIVATE woff2.cc)
226 endif()
227
228 # Turn up warnings on a few source files
229 set_property(SOURCE splineoverlap.c APPEND PROPERTY COMPILE_OPTIONS ${FONTFORGE_EXTRA_CFLAGS})
230
231 set_property(TARGET fontforge PROPERTY VERSION 4)
232 if(BUILD_SHARED_LIBS)
233 if(WIN32 OR CYGWIN)
234 # Both fontforge.exe and *.pyd Python modules look for libfontforge.dll in
235 # their directory, so we need to produce a second copy.
236 add_custom_command(TARGET fontforge POST_BUILD
237 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:fontforge> ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
238 )
239 target_link_options(fontforge PRIVATE -Wl,--export-all-symbols) # FIXME
240 endif()
241 endif()
242
243 # This is pretty bad...
244 target_include_directories(fontforge PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
245
246 # Export all symbols from the DLL on Windows (mimics MinGW's --export-all-symbols)
247 set_target_properties(fontforge PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
248
249 target_link_libraries(fontforge
250 PUBLIC
251 fontforge_common_headers
252 shapers
253 Freetype::Freetype
254 LibXml2::LibXml2
255 $<$<BOOL:${Intl_FOUND}>:Intl::Intl>
256 PRIVATE
257 MathLib::MathLib
258 Iconv::Iconv
259 ZLIB::ZLIB
260 mINI
261 )
262
263 if(APPLE)
264 target_link_libraries(fontforge
265 PRIVATE
266 "-framework CoreServices"
267 )
268 endif()
269
270 if(ENABLE_FREETYPE_DEBUGGER)
271 target_link_libraries(fontforge PUBLIC FreeTypeSource::FreeTypeSource)
272 endif()
273 if(ENABLE_LIBSPIRO_RESULT)
274 target_link_libraries(fontforge PUBLIC Libspiro::Libspiro)
275 endif()
276 if(ENABLE_LIBREADLINE_RESULT)
277 target_link_libraries(fontforge PUBLIC Readline::Readline)
278 endif()
279 if(ENABLE_PYTHON_SCRIPTING_RESULT)
280 if(APPLE)
281 # On macOS, don't link libfontforge directly to Python library.
282 # The Python symbols should be resolved at runtime from the interpreter
283 # that loads the extension module. Use -undefined dynamic_lookup to allow
284 # undefined symbols that will be resolved when the extension is loaded.
285 target_include_directories(fontforge PRIVATE ${Python3_INCLUDE_DIRS})
286 target_link_options(fontforge PRIVATE -undefined dynamic_lookup)
287 else()
288 if(TARGET Python3::Python)
289 target_link_libraries(fontforge PRIVATE Python3::Python)
290 elseif(TARGET Python3::Module)
291 target_link_libraries(fontforge PRIVATE Python3::Module)
292 else()
293 message(FATAL_ERROR "Python3 imported target not found")
294 endif()
295 endif()
296 endif()
297 if(ENABLE_WOFF2_RESULT)
298 target_link_libraries(fontforge PRIVATE WOFF2::WOFF2)
299 endif()
300 if(ENABLE_LIBUNIBREAK_RESULT)
301 target_link_libraries(fontforge PRIVATE Libunibreak::Libunibreak)
302 endif()
303
304 if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
305 target_link_libraries(fontforge PRIVATE gunicode_interface gutils_interface)
306 else()
307 target_link_libraries(fontforge PRIVATE gunicode gutils)
308 endif()
309
310 # No dev package -> no need to install if static
311 if(BUILD_SHARED_LIBS)
312 if(BUILDING_WHEEL)
313 # Wheel: install alongside Python modules for bundling
314 install(TARGETS fontforge
315 RUNTIME DESTINATION "."
316 LIBRARY DESTINATION "."
317 )
318 elseif(WIN32 OR CYGWIN)
319 install(TARGETS fontforge RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
320 else()
321 install(TARGETS fontforge RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
322 endif()
323 endif()