-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeson.build
82 lines (71 loc) · 1.83 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
project('anvilock', 'c',
version : '0.1',
default_options : [
'warning_level=3',
'c_std=c11'
]
)
cc = meson.get_compiler('c')
# Dependencies
freetype_dep = dependency('freetype2')
wayland_client_dep = dependency('wayland-client')
wayland_server_dep = dependency('wayland-server')
wayland_egl_dep = dependency('wayland-egl')
egl_dep = dependency('egl')
gles_dep = dependency('glesv2')
pam_dep = dependency('pam')
xkbcommon_dep = dependency('xkbcommon')
maths_dep = cc.find_library('m', required: true)
# Source files
src_files = [
'main.c',
'toml/toml.c'
]
# Compiler flags
add_project_arguments(
'-g',
'-Wpedantic',
language: 'c'
)
# Create executable
executable('anvilock',
sources: src_files,
dependencies: [
freetype_dep,
wayland_client_dep,
wayland_server_dep,
wayland_egl_dep,
egl_dep,
gles_dep,
pam_dep,
xkbcommon_dep,
maths_dep
],
include_directories: include_directories('toml')
)
# Custom target for config file generation
config_dir = '$HOME/.config/anvilock'
config_file = config_dir / 'config.toml'
run_command = find_program('sh')
run_target('config',
command: [
run_command, '-c',
'''
CONFIG_DIR="$HOME/.config/anvilock"
CONFIG_FILE="$CONFIG_DIR/config.toml"
# Exit if config file already exists
if [ -f "$CONFIG_FILE" ]; then
exit 0
fi
mkdir -p "$CONFIG_DIR"
echo "[font]" > "$CONFIG_FILE"
echo "name = \\"# your font name goes here\\"" >> "$CONFIG_FILE"
echo "path = \\"# your font path goes here\\"" >> "$CONFIG_FILE"
echo "\\n" >> "$CONFIG_FILE"
echo "[bg]" >> "$CONFIG_FILE"
echo "name = \\"# your background name goes here\\"" >> "$CONFIG_FILE"
echo "path = \\"# your background path goes here\\"" >> "$CONFIG_FILE"
echo "Created config.toml with placeholder values in $CONFIG_DIR"
'''
]
)