forked from behdad/glyphy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
112 lines (95 loc) · 3.71 KB
/
meson.build
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
project('glyphy', 'c', 'cpp',
meson_version: '>= 0.55.0',
version: '0.2.0',
default_options: [
'cpp_rtti=false',
'cpp_std=c++11',
'wrap_mode=nofallback'
],
)
pkgmod = import('pkgconfig')
cpp = meson.get_compiler('cpp')
is_msvc = cpp.get_id() == 'msvc'
is_msvc_like = is_msvc or cpp.get_argument_syntax() == 'msvc'
if is_msvc
# Ignore several spurious warnings for things HarfBuzz does very commonly.
# If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
# If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
# NOTE: Only add warnings here if you are sure they're spurious
msvc_args = [
'/wd4018', # implicit signed/unsigned conversion
'/wd4146', # unary minus on unsigned (beware INT_MIN)
'/wd4244', # lossy type conversion (e.g. double -> int)
'/wd4305', # truncating type conversion (e.g. double -> float)
cpp.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
]
add_project_arguments(msvc_args, language: ['c', 'cpp'])
# Disable SAFESEH with MSVC for libs that use external deps that are built with MinGW
# noseh_link_args = ['/SAFESEH:NO']
# disable exception handling
add_project_arguments(['/EHs-', '/EHc-'], language: 'cpp')
else
add_project_link_arguments(cpp.get_supported_link_arguments([
'-Bsymbolic-functions'
]), language: 'c')
add_project_arguments(cpp.get_supported_arguments([
'-fno-exceptions',
'-fno-rtti',
'-fno-threadsafe-statics',
'-fvisibility-inlines-hidden',
]), language: 'cpp')
endif
if host_machine.system() == 'windows'
add_project_arguments([
'-D_USE_MATH_DEFINES', # For using _M_SQRT* etc with MSVC headers
'-DNOMINMAX', # We don't want min/max in windows.h to get in the way
], language: ['c', 'cpp'])
endif
glyphy_conf = configuration_data()
freetype_dep = dependency('freetype2', method: 'pkg-config', required: not is_msvc_like)
# Merge into above line when we require Meson 0.60.0 or later
if not freetype_dep.found()
freetype_dep = dependency('Freetype', method: 'cmake', required: true)
endif
harfbuzz_dep = dependency('harfbuzz', version: '>= 4.0.0', required: true)
gl_dep = dependency('gl', required: true)
glew_dep = dependency('glew', required: false)
glut_dep = dependency('GLUT', required: get_option('demo').enabled())
prefix = get_option('prefix')
libdir = join_paths(prefix, get_option('libdir'))
includedir = join_paths(prefix, get_option('includedir'))
datadir = join_paths(prefix, get_option('datadir'))
pkgdatadir = join_paths(datadir, meson.project_name())
if freetype_dep.found()
glyphy_conf.set('HAVE_FREETYPE2', 1)
endif
if harfbuzz_dep.found()
glyphy_conf.set('HAVE_HARFBUZZ', 1)
endif
if gl_dep.found()
glyphy_conf.set('HAVE_GL', 1)
endif
if glew_dep.found()
glyphy_conf.set('HAVE_GLEW', 1)
endif
if glut_dep.found()
glyphy_conf.set('HAVE_GLUT', 1)
endif
glyphy_conf.set_quoted('PKGDATADIR', pkgdatadir)
configure_file(output: 'config.h', configuration: glyphy_conf)
confinc = include_directories('.', 'src')
subdir('src')
if get_option('demo').enabled()
subdir('demo')
endif
summary('Demo', get_option('demo').enabled(), section: 'Features')
summary('Freetype', freetype_dep.found(), section: 'Features')
summary('Harfbuzz', harfbuzz_dep.found(), section: 'Features')
summary('Compiler', cpp.get_id(), section: 'Toolchain')
summary('Linker', cpp.get_linker_id(), section: 'Toolchain')
summary('Debugging', get_option('debug'), section: 'Build')
summary('Optimization', get_option('optimization'), section: 'Build')
summary('prefix', prefix, section: 'Directories')
summary('includedir', includedir, section: 'Directories')
summary('libdir', libdir, section: 'Directories')
summary('datadir', datadir, section: 'Directories')