-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
101 lines (86 loc) · 3.12 KB
/
meson.build
File metadata and controls
101 lines (86 loc) · 3.12 KB
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
# Meson build file for the "Lightning-Fast Password Check" project
# Project call
project('lfpch', 'c',
version : '0.0.2',
license : 'GPL-3.0-only',
license_files : 'COPYING.md',
default_options : ['buildtype=release', 'c_std=gnu17', 'c_args=-mrdseed']
)
# Only build if the target CPU is x86
is_x86 = host_machine.cpu_family().startswith('x86')
if not is_x86
error('This application currently only supports x86 architecture.')
endif
# Dependencies
glib_dep = dependency('glib-2.0')
gtk4_dep = dependency('gtk4')
libcrypto_dep = dependency('libcrypto')
libcurl_dep = dependency('libcurl')
deps = [glib_dep, gtk4_dep, libcrypto_dep, libcurl_dep]
# Project directories
subdir('src')
subdir('resources')
inc = include_directories('include')
# Install directories
if host_machine.system() == 'windows'
bin_dir = get_option('prefix') / 'Tools' / 'lfpch'
data_dir = bin_dir / 'resources'
license_dir = bin_dir / 'license'
icon_dir = data_dir
desktop_dir = data_dir
else
bin_dir = '/usr' / 'bin'
share_dir = '/usr' / 'share'
data_dir = share_dir / 'lfpch'
license_dir = share_dir / 'doc' / 'lfpch'
icon_dir = share_dir / 'icons'
desktop_dir = share_dir / 'applications'
endif
# Windows-only steps
if host_machine.system() == 'windows'
# Resource file compilation
windows = import('windows')
src += windows.compile_resources('resources/lfpch.rc')
# Set up Powershell script for shortcut creation
install_script = files('resources/create_shortcut.ps1')
install_path = bin_dir
meson.add_install_script('powershell', '-ExecutionPolicy', 'Bypass', '-File',
install_script, install_path)
endif
if host_machine.system() == 'windows'
endif
# Executable
executable('lfpch',
sources : src,
include_directories: inc,
link_args : ['-s'],
dependencies : deps,
win_subsystem : 'windows',
install : true,
install_dir: bin_dir
)
# Install
install_data('resources/styles.css', install_dir : data_dir)
install_data('COPYING.md', install_dir : license_dir)
if host_machine.system() == 'windows'
install_data('resources/icons/ico/lfpch.ico', install_dir : icon_dir)
else
install_data('resources/lfpch.desktop', install_dir : desktop_dir)
install_subdir('resources/icons/hicolor', install_dir : icon_dir)
endif
# Tests
test('connection', executable('conn_test',
sources: ['tests/conn_test.c', 'src/request.c'],
include_directories: inc,
dependencies : deps
))
test('DRNG', executable('drng_test',
sources: ['tests/drng_test.c'],
include_directories: inc,
dependencies : deps
))
test('generator', executable('gen_test',
sources: ['tests/gen_test.c', 'src/checker.c', 'src/generator.c', 'src/hashing.c', 'src/request.c'],
include_directories: inc,
dependencies : deps
))