-
Notifications
You must be signed in to change notification settings - Fork 86
/
meson.build
132 lines (115 loc) · 3.67 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
project(
'pycairo', 'c',
version: '1.27.1',
meson_version: '>= 0.64.0',
license: 'LGPL-2.1-only OR MPL-1.1',
default_options: [
'warning_level=1',
'buildtype=debugoptimized',
],
)
cair_version_req = '>=1.15.10'
python_version_req = '>=3.9'
pymod = import('python')
python = pymod.find_installation(get_option('python'), pure: false)
pyver = python.language_version()
if not pyver.version_compare(python_version_req)
error('Requires Python @0@'.format(python_version_req))
endif
for_wheel = get_option('wheel')
fs = import('fs')
cc = meson.get_compiler('c')
main_c_args = []
if cc.get_id() == 'msvc'
# Adapted from msvc_recommended_pragmas.h, since we don't depend on GLib here
# Warnings that we want to look out for
main_c_args += [
'-we4002', # too many actual parameters for macro
'-we4003', # not enough actual parameters for macro
'-w14010', # single-line comment contains line-continuation character
'-we4013', # 'function' undefined; assuming extern returning int
'-w14016', # no function return type; using int as default
'-we4020', # too many actual parameters
'-we4021', # too few actual parameters
'-we4027', # function declared without formal parameter list
'-we4029', # declared formal parameter list different from definition
'-we4033', # 'function' must return a value
'-we4035', # 'function' : no return value
'-we4045', # array bounds overflow
'-we4047', # different levels of indirection
'-we4049', # terminating line number emission
'-we4053', # An expression of type void was used as an operand
'-we4071', # no function prototype given
'-we4150',
'-we4819', # The file contains a character that cannot be represented in the current code page
]
# Silence warnings for stuff that should not really raise concern
main_c_args += [
'-wd4101', # unreferenced local variable
'-wd4244', # No possible loss of data warnings
'-wd4305', # No truncation from int to char warnings
]
# Silence warnings for using non-MS CRT stuff
main_c_args += [
'-D_CRT_SECURE_NO_WARNINGS',
'-D_CRT_NONSTDC_NO_WARNINGS'
]
else
main_c_args += [
'-Wall',
'-Warray-bounds',
'-Wcast-align',
'-Wconversion',
'-Wextra',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wmissing-format-attribute',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wold-style-definition',
'-Wpacked',
'-Wpointer-arith',
'-Wreturn-type',
'-Wshadow',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wundef',
'-Wunused-but-set-variable',
'-Wswitch-default',
]
main_c_args += [
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
]
main_c_args += [
'-fno-strict-aliasing',
'-fvisibility=hidden',
]
endif
main_c_args = cc.get_supported_arguments(main_c_args)
pycairo_version = meson.project_version()
version_arr = pycairo_version.split('.')
pycairo_version_major = version_arr[0].to_int()
pycairo_version_minor = version_arr[1].to_int()
pycairo_version_micro = version_arr[2].to_int()
pyext_c_args = [
'-DPYCAIRO_VERSION_MAJOR=@0@'.format(pycairo_version_major),
'-DPYCAIRO_VERSION_MINOR=@0@'.format(pycairo_version_minor),
'-DPYCAIRO_VERSION_MICRO=@0@'.format(pycairo_version_micro),
]
if not for_wheel
pkginfo_conf = configuration_data()
pkginfo_conf.set('VERSION', pycairo_version)
configure_file(input : 'METADATA.in',
output : 'METADATA',
configuration : pkginfo_conf,
install_dir : python.get_install_dir() / 'pycairo-@[email protected]'.format(pycairo_version))
endif
subdir('cairo')
if get_option('tests')
subdir('tests')
endif