forked from alba4k/albafetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
119 lines (105 loc) · 2.57 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
project(
'albafetch',
'c',
version : '4.2.1',
default_options : ['warning_level=3'],
license : 'MIT',
meson_version: '>=1.3.0'
)
src = [
'src/utils/queue.c',
'src/utils/utils.c',
'src/optdeps/libpci.c',
'src/optdeps/glib.c',
'src/config/config.c',
'src/config/parsing.c',
'src/info/battery.c',
'src/info/bios.c',
'src/info/colors.c',
'src/info/cpu.c',
'src/info/date.c',
'src/info/desktop.c',
'src/info/gpu.c',
'src/info/gtk_theme.c',
'src/info/icon_theme.c',
'src/info/cursor_theme.c',
'src/info/host.c',
'src/info/hostname.c',
'src/info/info.h',
'src/info/kernel.c',
'src/info/light_colors.c',
'src/info/local_ip.c',
'src/info/login_shell.c',
'src/info/memory.c',
'src/info/os.c',
'src/info/packages.c',
'src/info/public_ip.c',
'src/info/pwd.c',
'src/info/shell.c',
'src/info/term.c',
'src/info/uptime.c',
'src/info/user.c',
]
build_args = [
'-Wall',
'-Wextra',
'-O3',
'-ffast-math',
'-std=gnu99',
]
# DEPENDENCY HANDLING
project_dependencies = []
glib = dependency('glib-2.0', required: false)
if glib.found()
build_args += '-DGLIB_EXISTS'
project_dependencies += glib
endif
if host_machine.system() == 'linux'
project_dependencies += dependency('sqlite3', required: true)
libpci = dependency('libpci', required: false)
if libpci.found()
build_args += '-DLIBPCI_EXISTS'
project_dependencies += libpci
endif
elif host_machine.system() == 'darwin'
project_dependencies += dependency('appleframeworks', modules : ['Foundation', 'IOKit'], required: true)
add_languages('objc')
src += [
'src/macos/macos_infos.c',
'src/macos/bsdwrap.c',
'src/macos/macos_gpu_string.m',
]
endif
# MAKE THE VERSION PRINTED BY albafetch -h DYNAMIC
git = find_program('git', required : false)
commit = '{unknown}'
if git.found()
commit_cmd = run_command(git, 'rev-parse', '--short', 'HEAD', check: false)
if commit_cmd.returncode() == 0
commit = commit_cmd.stdout().strip()
endif
endif
config = configuration_data()
config.set('VERSION', '"'+meson.project_version()+'"')
config.set('COMMIT', '"'+commit+'"')
configure_file(configuration: config, output: 'version.h')
# BUILD
src_debug = src + ['src/debug.c']
src += 'src/main.c'
debug_args = build_args + ['-g']
executable(
meson.project_name(),
src,
dependencies : project_dependencies,
install : true,
c_args : build_args,
include_directories: include_directories('.')
)
executable(
'debug',
src_debug,
dependencies : project_dependencies,
install : false,
c_args : debug_args,
include_directories: include_directories('.')
)