-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
384 lines (358 loc) · 12.3 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
cmake_minimum_required(VERSION 2.8.12)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
option(HARFBUZZ_BUILD_ICU "Enable building of ICU" OFF)
if (APPLE)
option(HB_HAVE_CORETEXT "Enable CoreText shaper backend on macOS" ON)
endif ()
set(SKIP_INSTALL_ALL ON)
## Freetype2 ##
###############
# Stop Freetype from trying to link BZip2. For unclear reasons, BZip2 causes linker errors when targeting iOS simulator.
set(CMAKE_DISABLE_FIND_PACKAGE_BZip2 TRUE)
# Stop Freetype from trying to link Harfbuzz, since we will link our own version.
set(CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz TRUE)
if (IOS)
# Freetype relies on check_include_file() to detect Unix headers, but some versions of CMake fail to find these files on iOS.
# We know these files exist on iOS, so just force the variables to be set.
set(HAVE_UNISTD_H 1 CACHE INTERNAL "Have include unistd.h" FORCE)
set(HAVE_FCNTL_H 1 CACHE INTERNAL "Have include fcntl.h" FORCE)
set(HAVE_STDINT_H 1 CACHE INTERNAL "Have include stdint.h" FORCE)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/freetype)
## ICU-common ##
################
if (HARFBUZZ_BUILD_ICU)
add_library(icucommon
icu/common/appendable.cpp
icu/common/bmpset.cpp
icu/common/brkeng.cpp
icu/common/brkiter.cpp
icu/common/bytesinkutil.cpp
icu/common/bytestream.cpp
icu/common/bytestrie.cpp
icu/common/bytestriebuilder.cpp
icu/common/bytestrieiterator.cpp
icu/common/caniter.cpp
icu/common/characterproperties.cpp
icu/common/chariter.cpp
icu/common/charstr.cpp
icu/common/cmemory.cpp
icu/common/cstring.cpp
icu/common/cwchar.cpp
icu/common/dictbe.cpp
icu/common/dictionarydata.cpp
icu/common/dtintrv.cpp
icu/common/edits.cpp
icu/common/errorcode.cpp
icu/common/filteredbrk.cpp
icu/common/filterednormalizer2.cpp
icu/common/icudataver.cpp
icu/common/icuplug.cpp
icu/common/loadednormalizer2impl.cpp
icu/common/localebuilder.cpp
icu/common/localematcher.cpp
icu/common/localeprioritylist.cpp
icu/common/locavailable.cpp
icu/common/locbased.cpp
icu/common/locdispnames.cpp
icu/common/locdistance.cpp
icu/common/locdspnm.cpp
icu/common/locid.cpp
icu/common/loclikely.cpp
icu/common/loclikelysubtags.cpp
icu/common/locmap.cpp
icu/common/locresdata.cpp
icu/common/locutil.cpp
icu/common/lsr.cpp
icu/common/messagepattern.cpp
icu/common/normalizer2.cpp
icu/common/normalizer2impl.cpp
icu/common/normlzr.cpp
icu/common/parsepos.cpp
icu/common/patternprops.cpp
icu/common/pluralmap.cpp
icu/common/propname.cpp
icu/common/propsvec.cpp
icu/common/punycode.cpp
icu/common/putil.cpp
icu/common/rbbi.cpp
icu/common/rbbi_cache.cpp
icu/common/rbbidata.cpp
icu/common/rbbinode.cpp
icu/common/rbbirb.cpp
icu/common/rbbiscan.cpp
icu/common/rbbisetb.cpp
icu/common/rbbistbl.cpp
icu/common/rbbitblb.cpp
icu/common/resbund.cpp
icu/common/resbund_cnv.cpp
icu/common/resource.cpp
icu/common/restrace.cpp
icu/common/ruleiter.cpp
icu/common/schriter.cpp
icu/common/serv.cpp
icu/common/servlk.cpp
icu/common/servlkf.cpp
icu/common/servls.cpp
icu/common/servnotf.cpp
icu/common/servrbf.cpp
icu/common/servslkf.cpp
icu/common/sharedobject.cpp
icu/common/simpleformatter.cpp
icu/common/static_unicode_sets.cpp
icu/common/stringpiece.cpp
icu/common/stringtriebuilder.cpp
icu/common/uarrsort.cpp
icu/common/ubidi.cpp
icu/common/ubidi_props.cpp
icu/common/ubidiln.cpp
icu/common/ubiditransform.cpp
icu/common/ubidiwrt.cpp
icu/common/ubrk.cpp
icu/common/ucase.cpp
icu/common/ucasemap.cpp
icu/common/ucasemap_titlecase_brkiter.cpp
icu/common/ucat.cpp
icu/common/uchar.cpp
icu/common/ucharstrie.cpp
icu/common/ucharstriebuilder.cpp
icu/common/ucharstrieiterator.cpp
icu/common/uchriter.cpp
icu/common/ucln_cmn.cpp
icu/common/ucmndata.cpp
icu/common/ucnv.cpp
icu/common/ucnv2022.cpp
icu/common/ucnv_bld.cpp
icu/common/ucnv_cb.cpp
icu/common/ucnv_cnv.cpp
icu/common/ucnv_ct.cpp
icu/common/ucnv_err.cpp
icu/common/ucnv_ext.cpp
icu/common/ucnv_io.cpp
icu/common/ucnv_lmb.cpp
icu/common/ucnv_set.cpp
icu/common/ucnv_u16.cpp
icu/common/ucnv_u32.cpp
icu/common/ucnv_u7.cpp
icu/common/ucnv_u8.cpp
icu/common/ucnvbocu.cpp
icu/common/ucnvdisp.cpp
icu/common/ucnvhz.cpp
icu/common/ucnvisci.cpp
icu/common/ucnvlat1.cpp
icu/common/ucnvmbcs.cpp
icu/common/ucnvscsu.cpp
icu/common/ucnvsel.cpp
icu/common/ucol_swp.cpp
icu/common/ucptrie.cpp
icu/common/ucurr.cpp
icu/common/udata.cpp
icu/common/udatamem.cpp
icu/common/udataswp.cpp
icu/common/uenum.cpp
icu/common/uhash.cpp
icu/common/uhash_us.cpp
icu/common/uidna.cpp
icu/common/uinit.cpp
icu/common/uinvchar.cpp
icu/common/uiter.cpp
icu/common/ulist.cpp
icu/common/uloc.cpp
icu/common/uloc_keytype.cpp
icu/common/uloc_tag.cpp
icu/common/umapfile.cpp
icu/common/umath.cpp
icu/common/umutablecptrie.cpp
icu/common/umutex.cpp
icu/common/unames.cpp
icu/common/unifiedcache.cpp
icu/common/unifilt.cpp
icu/common/unifunct.cpp
icu/common/uniset.cpp
icu/common/uniset_closure.cpp
icu/common/uniset_props.cpp
icu/common/unisetspan.cpp
icu/common/unistr.cpp
icu/common/unistr_case.cpp
icu/common/unistr_case_locale.cpp
icu/common/unistr_cnv.cpp
icu/common/unistr_props.cpp
icu/common/unistr_titlecase_brkiter.cpp
icu/common/unorm.cpp
icu/common/unormcmp.cpp
icu/common/uobject.cpp
icu/common/uprops.cpp
icu/common/ures_cnv.cpp
icu/common/uresbund.cpp
icu/common/uresdata.cpp
icu/common/usc_impl.cpp
icu/common/uscript.cpp
icu/common/uscript_props.cpp
icu/common/uset.cpp
icu/common/uset_props.cpp
icu/common/usetiter.cpp
icu/common/ushape.cpp
icu/common/usprep.cpp
icu/common/ustack.cpp
icu/common/ustr_cnv.cpp
icu/common/ustr_titlecase_brkiter.cpp
icu/common/ustr_wcs.cpp
icu/common/ustrcase.cpp
icu/common/ustrcase_locale.cpp
icu/common/ustrenum.cpp
icu/common/ustrfmt.cpp
icu/common/ustring.cpp
icu/common/ustrtrns.cpp
icu/common/utext.cpp
icu/common/utf_impl.cpp
icu/common/util.cpp
icu/common/util_props.cpp
icu/common/utrace.cpp
icu/common/utrie.cpp
icu/common/utrie2.cpp
icu/common/utrie2_builder.cpp
icu/common/utrie_swap.cpp
icu/common/uts46.cpp
icu/common/utypes.cpp
icu/common/uvector.cpp
icu/common/uvectr32.cpp
icu/common/uvectr64.cpp
icu/common/wintz.cpp
icu/stubdata/stubdata.cpp
)
target_include_directories(icucommon PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/icu/common
${CMAKE_CURRENT_SOURCE_DIR}/icu/stubdata
${CMAKE_CURRENT_SOURCE_DIR}/icu/common/unicode)
target_compile_definitions(icucommon PUBLIC
-DU_STATIC_IMPLEMENTATION=1
#-DICU_DATA_DIR_PREFIX_ENV_VAR="ANDROID_ROOT"
-DPIC
-DU_COMMON_IMPLEMENTATION)
#-DU_HAVE_NL_LANGINFO_CODESET=0
#-DU_TIMEZONE=0
#-DUCONFIG_NO_TRANSLITERATION=1)
# icucommon has noexcept usages that are illegal in c++17, so build as c++14 instead.
set_target_properties(icucommon PROPERTIES CXX_STANDARD 14)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(icucommon
PRIVATE
-wd4267
-wd4244)
endif()
endif()
## Harfbuzz ##
##############
add_library(harfbuzz
harfbuzz/src/hb-aat-layout.cc
harfbuzz/src/hb-aat-map.cc
harfbuzz/src/hb-blob.cc
harfbuzz/src/hb-buffer-serialize.cc
harfbuzz/src/hb-buffer.cc
harfbuzz/src/hb-common.cc
harfbuzz/src/hb-draw.cc
harfbuzz/src/hb-face.cc
harfbuzz/src/hb-fallback-shape.cc
harfbuzz/src/hb-font.cc
harfbuzz/src/hb-map.cc
harfbuzz/src/hb-number.cc
harfbuzz/src/hb-ot-cff1-table.cc
harfbuzz/src/hb-ot-cff2-table.cc
harfbuzz/src/hb-ot-color.cc
harfbuzz/src/hb-ot-face.cc
harfbuzz/src/hb-ot-font.cc
harfbuzz/src/hb-ot-layout.cc
harfbuzz/src/hb-ot-map.cc
harfbuzz/src/hb-ot-math.cc
harfbuzz/src/hb-ot-meta.cc
harfbuzz/src/hb-ot-metrics.cc
harfbuzz/src/hb-ot-name.cc
harfbuzz/src/hb-ot-shape-complex-arabic.cc
harfbuzz/src/hb-ot-shape-complex-default.cc
harfbuzz/src/hb-ot-shape-complex-hangul.cc
harfbuzz/src/hb-ot-shape-complex-hebrew.cc
harfbuzz/src/hb-ot-shape-complex-indic-table.cc
harfbuzz/src/hb-ot-shape-complex-indic.cc
harfbuzz/src/hb-ot-shape-complex-khmer.cc
harfbuzz/src/hb-ot-shape-complex-myanmar.cc
harfbuzz/src/hb-ot-shape-complex-thai.cc
harfbuzz/src/hb-ot-shape-complex-use-table.cc
harfbuzz/src/hb-ot-shape-complex-use.cc
harfbuzz/src/hb-ot-shape-complex-vowel-constraints.cc
harfbuzz/src/hb-ot-shape-fallback.cc
harfbuzz/src/hb-ot-shape-normalize.cc
harfbuzz/src/hb-ot-shape.cc
harfbuzz/src/hb-ot-tag.cc
harfbuzz/src/hb-ot-var.cc
harfbuzz/src/hb-set.cc
harfbuzz/src/hb-shape-plan.cc
harfbuzz/src/hb-shape.cc
harfbuzz/src/hb-shaper.cc
harfbuzz/src/hb-static.cc
harfbuzz/src/hb-style.cc
harfbuzz/src/hb-ucd.cc
harfbuzz/src/hb-unicode.cc
)
# FreeType integration
target_sources(harfbuzz PRIVATE harfbuzz/src/hb-ft.cc)
target_include_directories(harfbuzz PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/freetype/include)
target_compile_definitions(harfbuzz PRIVATE -DHAVE_FREETYPE)
# ICU integration
if (HARFBUZZ_BUILD_ICU)
target_sources(harfbuzz PRIVATE harfbuzz/src/hb-icu.cc)
target_include_directories(harfbuzz PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/icu/common)
target_link_libraries(harfbuzz PRIVATE icucommon)
target_compile_definitions(harfbuzz PRIVATE -DHAVE_ICU -DHAVE_ICU_BUILTIN)
set(HARFBUZZ_UNICODE_LIB icucommon)
endif()
# CoreText integration
if(APPLE AND HB_HAVE_CORETEXT)
target_compile_definitions(harfbuzz PRIVATE -DHAVE_CORETEXT)
target_sources(harfbuzz PRIVATE harfbuzz/src/hb-coretext.cc)
if (IOS)
# CoreText and CoreGraphics needed for ios
target_link_libraries(harfbuzz PRIVATE
"-framework CoreText"
"-framework CoreGraphics")
else(IOS)
# ApplicationServices needed for osx
target_link_libraries(harfbuzz PRIVATE
"-framework ApplicationServices")
endif(IOS)
endif()
# Provide own config file
target_sources(harfbuzz PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config.h")
target_compile_definitions(harfbuzz PRIVATE -DHAVE_CONFIG_H)
target_include_directories(harfbuzz
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/harfbuzz/src
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/)
option(USE_INTEL_ATOMIC_PRIMITIVES "Platform needs to define HAVE_INTEL_ATOMIC_PRIMITIVES" FALSE)
if(USE_INTEL_ATOMIC_PRIMITIVES)
add_definitions(-DHAVE_INTEL_ATOMIC_PRIMITIVES)
endif()
set(HARFBUZZ_LIBRARIES
freetype
${HARFBUZZ_UNICODE_LIB}
CACHE INTERNAL "Harfbuzz libraries" FORCE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(harfbuzz PRIVATE -utf-8 -wd4996 -wd4267 -wd4244)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Apply compiler flags from Harfbuzz CMake config.
target_compile_options(harfbuzz
PRIVATE
-fno-rtti
-fno-exceptions
-fno-threadsafe-statics
)
endif()
target_compile_definitions(harfbuzz PUBLIC
PRIVATE
-DHAVE_OT # Include the default "ot" shaper
-DHB_NO_MT # Exclude multi-threading support
)
set_target_properties(harfbuzz PROPERTIES CXX_STANDARD 11)