-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
162 lines (143 loc) · 6.23 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
# Copyright 2023-2025 MarcosHCK
# This file is part of virtualtm.
#
# virtualtm is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# virtualtm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with virtualtm. If not, see <http://www.gnu.org/licenses/>.
#
project ('VirtualTM', 'c', 'vala',
default_options : [ 'warning_level=3', ],
meson_version : '>= 1.2',
version : '@0@.@1@.@2@'.format (
run_command ('git', 'describe', check : true).stdout ().strip ().split ('-').get (0).split ('.').get (0).substring (1),
run_command ('git', 'describe', check : true).stdout ().strip ().split ('-').get (0).split ('.').get (1),
run_command ('git', 'describe', check : true).stdout ().strip ().split ('-').get (0).split ('.').get (2)))
cc = meson.get_compiler ('c')
########################
# Extract version info #
########################
git_version = run_command ('git', 'describe', check : true).stdout ().strip ()
git_version_list = git_version.split ('-')
git_version_list2 = git_version_list.get (0).split ('.')
git_version_stage = git_version_list.get (1)
git_version_major = git_version_list2.get (0).substring (1)
git_version_minor = git_version_list2.get (1)
git_version_micro = git_version_list2.get (2)
########################
# Dependencies #
########################
libgio_dep = dependency ('gio-2.0', required : true, version : '>=2.78')
libglib_dep = dependency ('glib-2.0', required : true, version : '>=2.78')
libgobject_dep = dependency ('gobject-2.0', required : true, version : '>=2.78')
libjson_dep = dependency ('json-glib-1.0', required : true, version : '>=1.8')
libsoup_dep = dependency ('libsoup-3.0', required : true, version : '>=3.4.3')
libsqlite_dep = dependency ('sqlite3', required : true, version : '>=3.43.1')
########################
# Include directories #
########################
configinc = include_directories ('.')
srcinc = include_directories ('src')
########################
# Configuration begins #
########################
configh = configuration_data ()
configh.set ('DEBUG', get_option ('debug').to_int ())
configh.set ('DEVELOPER', get_option ('developer').to_int ())
configh.set ('G_LOG_USE_STRUCTURED', 1)
configh.set ('PACKAGE_VERSION_MAJOR', git_version_major)
configh.set ('PACKAGE_VERSION_MICRO', git_version_micro)
configh.set ('PACKAGE_VERSION_MINOR', git_version_minor)
configh.set_quoted ('G_LOG_DOMAIN', 'VirtualTM')
configh.set_quoted ('PACKAGE_BUGREPORT', '[email protected]')
configh.set_quoted ('PACKAGE_NAME', meson.project_name ())
configh.set_quoted ('PACKAGE_STRING', '@0@ @1@'.format (meson.project_name (), git_version))
configh.set_quoted ('PACKAGE_TARNAME', meson.project_name ())
configh.set_quoted ('PACKAGE_URL', 'https://github.com/MarcosHCK/VirtualTM')
configh.set_quoted ('PACKAGE_VERSION_STAGE', git_version_stage)
configh.set_quoted ('PACKAGE_VERSION', git_version)
add_project_arguments ([ '--pkg', 'config', '--pkg', 'posix', ], language : 'vala')
add_project_arguments ([ '--vapidir', meson.current_source_dir () / 'src', ], language : 'vala')
add_project_arguments ([ '-D', 'DEBUG=@0@'.format (get_option ('debug')), ], language : 'vala')
add_project_arguments ([ '-D', 'DEVELOPER=@0@'.format (get_option ('developer')), ], language : 'vala')
add_project_arguments ([ '-D', 'G_LOG_DOMAIN=VirtualTM', ], language : 'vala')
add_project_arguments ([ '-D', 'G_LOG_USE_STRUCTURED=1', ], language : 'vala')
if cc.get_id () == 'gcc' or cc.get_id () == 'clang'
warning_c_args = [
'-Waggregate-return',
'-Warray-bounds',
'-Wduplicated-branches',
'-Werror=format=2',
'-Werror=implicit-function-declaration',
'-Werror=init-self',
'-Werror=missing-include-dirs',
'-Werror=missing-prototypes',
'-Werror=pointer-arith',
'-Werror=pointer-sign',
'-Werror=unused-result',
'-Wimplicit-fallthrough',
'-Wmisleading-indentation',
'-Wmissing-field-initializers',
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
# building with -Wbad-function-cast.
'-Wno-bad-function-cast',
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
# building with -Wbad-function-cast.
'-Wno-cast-function-type',
# A zero-length format string shouldn't be considered an issue.
'-Wno-format-zero-length',
# Due to function casts through (void*) we cannot support -Wpedantic:
# ./docs/toolchain-requirements.md#Function_pointer_conversions.
'-Wno-pedantic',
'-Wno-string-plus-int',
# Due to maintained deprecated code, we do not want to see unused parameters
'-Wno-unused-parameter',
# We explicitly require variadic macros
'-Wno-variadic-macros',
'-Wnonnull',
'-Wshadow',
'-Wstrict-prototypes',
'-Wunused',
'-Wunused-function',
'-Wunused-label',
'-Wunused-value',
]
warning_c_link_args = [
'-Wl,-z,nodelete',
]
else
error ('Unsupported compiler')
endif
add_project_arguments (cc.get_supported_arguments (warning_c_args), language : 'c')
add_project_link_arguments (cc.get_supported_link_arguments (warning_c_link_args), language : 'c')
configure_file (output : 'config.h', configuration : configh)
########################
# Subdirectories #
########################
subdir ('src')
########################
# Summaries #
########################
summary ({
'C Compiler' : cc.get_id (),
'debug build' : get_option ('debug') ? 'yes' : 'no',
'develop build' : get_option ('developer') ? 'yes' : 'no',
'host cpu' : host_machine.cpu_family (),
'host endian' : host_machine.endian (),
'host system' : host_machine.system (),
}, section: 'Build environment')
if build_machine.system () != host_machine.system ()
summary ({
'build cpu' : build_machine.cpu_family (),
'build endian' : build_machine.endian (),
'build system' : build_machine.system (),
}, section: 'Build environment')
endif