-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
117 lines (100 loc) · 3.81 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
project('gpg-gui', 'vala', 'c', meson_version: '>=0.50')
valac = meson.get_compiler('vala')
# Application names in different styles
reverse_dns = 'com.github.ansgarklein.gpggui'
application_name = 'GPG-Gui'
if get_option('GPG_GUI_RDNS_NAMING')
binary_name = reverse_dns
else
binary_name = meson.project_name()
endif
# Source files for binary (will be defined later)
sources = []
# Extra directories for header files
include_dirs = []
# Dependencies of the main binary
dependencies = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
valac.find_library('posix'),
]
# Compile with specified version of gtk library
if get_option('GPG_GUI_GTK_VERSION_MAJOR') == 4
dependencies += dependency('gtk4')
elif get_option('GPG_GUI_GTK_VERSION_MAJOR') == 3
dependencies += dependency('gtk+-3.0')
endif
# Pass used major version of gtk library to compiler
if get_option('GPG_GUI_GTK_VERSION_MAJOR') == 4
add_project_arguments(['-D', 'GPG_GUI_GTK_VERSION_MAJOR_FOUR'], language: 'vala')
elif get_option('GPG_GUI_GTK_VERSION_MAJOR') == 3
add_project_arguments(['-D', 'GPG_GUI_GTK_VERSION_MAJOR_THREE'], language: 'vala')
endif
gettext_package = reverse_dns
add_project_arguments('-DGETTEXT_PACKAGE=' + gettext_package, language: 'c')
# Enable client-side decorations if desired
if get_option('GPG_GUI_CSD')
add_project_arguments(['-D', 'GPG_GUI_CSD'], language: 'vala')
endif
subdir('src')
subdir('data')
subdir('scripts')
subdir('include')
subdir('vapi')
# Print summary of build configuration
if meson.version().version_compare('>=0.53')
summary({
'prefix': get_option('prefix'),
'datadir': get_option('datadir'),
'bindir': get_option('bindir'),
}, section: 'Directories'
)
summary({
'buildtype': get_option('buildtype'),
'debug': get_option('debug'),
'optimization': get_option('optimization'),
'unity': get_option('unity'),
}, section: 'Build configuration'
)
summary({
'GPG_GUI_CSD': get_option('GPG_GUI_CSD'),
'GPG_GUI_RDNS_NAMING': get_option('GPG_GUI_CSD'),
'application verson': gpg_gui_version,
}, section: 'Application configuration'
)
else
message('Directories')
message('prefix: @0@'.format(get_option('prefix')))
message('datadir: @0@'.format(get_option('datadir')))
message('bindir: @0@'.format(get_option('bindir')))
message('')
message('Build configuration')
message('buildtype: @0@'.format(get_option('buildtype')))
message('debug: @0@'.format(get_option('debug')))
message('optimization: @0@'.format(get_option('optimization')))
message('unity: @0@'.format(get_option('unity')))
message('')
message('Application configuration')
message('GPG_GUI_CSD: @0@'.format(get_option('GPG_GUI_CSD')))
message('GPG_GUI_RDNS_NAMING: @0@'.format(get_option('GPG_GUI_RDNS_NAMING')))
message('application version: @0@'.format(gpg_gui_version))
endif
# Meson versions "0.52< version <0.56" will print warnings when using features
# that were introduced in Meson versions older than the projects required Meson
# version (specified in project() function) EVEN IF those features were wrapped
# in a version comparison conditional and would not be used unless the installed
# Meson version supported them. This is Meson bug #7590.
# Remove this block once Meson 0.56 is a hard requirement (-> project()).
if meson.version().version_compare('>0.53') and meson.version().version_compare('<0.56')
warning('Please ignore warnings about using features introduced in newer versions than this project is targeting.')
warning('Those messages are because of Meson bug #7590, which is fixed in Meson 0.56.')
warning('You can get rid of this message by using a newer version of Meson.')
endif
# Main target
executable(
binary_name,
sources,
dependencies: dependencies,
include_directories: include_dirs,
install: true,
)