-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmeson.build
169 lines (144 loc) · 3.95 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
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
project('gnofract4d', 'cpp',
license: 'BSD',
default_options: ['cpp_std=c++17',
'buildtype=release',
'warning_level=3',
'b_ndebug=if-release',
'b_lto=true',
'strip=true',
],
meson_version: '>= 0.56',
version: '4.3',
)
project_datadir = get_option('datadir') / meson.project_name()
if get_option('docdir') != ''
project_docdir = get_option('docdir')
else
project_docdir = get_option('datadir') / 'doc/gnofract4d'
endif
pymod = import('python')
py = pymod.find_installation()
py_version = py.language_version()
if py_version.version_compare('< 3.9')
error('Sorry, you need Python 3.9 or higher to run Gnofract 4D.'
+ ' You have version ' + py_version + '. Please upgrade.')
endif
py_dep = py.dependency(required: true)
# Generate lextab.py and parsetab.py
run_command(
py.full_path(), '-B', '-c',
'from fract4d_compiler import fractparser',
env: {'PYTHONPATH': meson.project_source_root()},
check: true,
)
gnome = import('gnome')
gresource = gnome.compile_resources('gnofract4d', 'fract4dgui/gnofract4d.gresource.xml',
source_dir: 'fract4dgui',
gresource_bundle: true,
install: true,
install_dir: project_datadir,
)
install_data('gnofract4d',
install_dir: get_option('bindir'),
)
subdir('fract4d/c')
packages = ['fract4d', 'fract4d_compiler', 'fract4dgui']
foreach p: packages
install_subdir(p,
install_dir: py.get_install_dir(),
install_mode: 'rw-r--r--',
exclude_directories: ['tests', 'builder', 'c', 'fract4d_new'],
exclude_files: ['gnofract4d.css', 'gnofract4d.gresource.xml', 'parser.out'],
)
endforeach
conf_data = configuration_data()
conf_data.set('app_datadir', get_option('prefix') / project_datadir)
conf_data.set('version', meson.project_version())
conf_file = configure_file(input: '_conf_data.py.in',
output: '_conf_data.py',
configuration: conf_data,
install: true,
install_dir: py.get_install_dir() / 'fract4d',
)
# Application Data
install_data(['LICENSE', 'README.md'],
install_dir: project_docdir,
)
install_subdir('help',
exclude_directories: 'svg',
exclude_files: ['favicon.svg', 'flexsearch.min.js', 'index.xml',
'manifest.json', 'mermaid.min.js', 'sitemap.xml'],
install_dir: project_datadir / 'help',
strip_directory: true,
)
install_subdir('formulas',
install_dir: project_datadir,
)
install_subdir('maps',
install_dir: project_datadir,
)
# Desktop Environment Data
install_data('pixmaps/logo/48x48/gnofract4d.png',
install_dir: 'share/pixmaps',
)
icon_sizes = [16, 32, 48, 64, 128, 256]
icon_template = 'pixmaps/logo/@0@x@0@/gnofract4d.png'
icon_dir_template = '@0@x@0@/apps/gnofract4d.png'
icons = []
icon_dirs = []
foreach s: icon_sizes
icons += icon_template.format(s)
icon_dirs += icon_dir_template.format(s)
endforeach
install_data(icons,
rename: icon_dirs,
install_dir: 'share/icons/hicolor',
)
install_data('io.github.fract4d.desktop',
install_dir: 'share/applications',
)
install_data('gnofract4d-mime.xml',
install_dir: 'share/mime/packages',
)
# Test
cp = find_program('cp')
custom_target('cp_so',
command: [cp,
fract4dc.full_path(),
meson.project_source_root() / 'fract4d/',
],
output: 'none1',
build_by_default: true,
depends: fract4dc,
)
custom_target('cp_gresource',
command: [cp,
gresource,
meson.project_source_root(),
],
output: 'none2',
build_by_default: true,
depends: gresource,
)
custom_target('cp_confdata',
command: [cp,
conf_file,
meson.project_source_root() / 'fract4d/',
],
output: 'none3',
build_by_default: true,
)
pytest = find_program('pytest', required: false)
if pytest.found()
test('testing',
pytest,
args: [
'fract4d',
'fract4dgui',
'fract4d_compiler',
'test.py',
],
timeout: 60,
workdir: meson.project_source_root(),
)
endif