-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmeson.build
70 lines (61 loc) · 1.76 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
project('pomelo','cpp','c',
default_options : ['cpp_std=c++2a'])
subproject('nanosvg')
subproject('tinygltf')
subproject('nlohmann_json')
subproject('spdlog')
gnome = import('gnome')
name='pomelo'
name_cap = 'Pomelo'
version = '0.0.7'
r = run_command('git', 'rev-parse', 'HEAD', check: true)
if r.returncode() != 0
# it failed
endif
sha1 = r.stdout().strip()
# meson version 0.56 will have substr()
sha1_short = sha1[0]+sha1[1]+sha1[2]+sha1[3]+sha1[4]+sha1[5]
r = run_command('git', 'log', '--pretty=%ci', '-n1', check: true)
if r.returncode() != 0
# it failed
endif
commit_time=r.stdout().strip()
cpp_args = ['-DCOMMIT_ID="'+sha1+'"',
'-DCOMMIT_TIME="'+commit_time+'"',
'-DVERSION="'+version+'"',
'-DSPDLOG_FMT_EXTERNAL',
'-DFMT_HEADER_ONLY'
]
subdir('src')
fs = import('fs')
builddir = fs.name(meson.current_build_dir())
buildroot = fs.name(meson.current_source_dir())
if host_machine.system() == 'windows'
arch = 'x86_64-w64-mingw32'
host = 'w64'
nsis_cmd = [
find_program('makensis'),
'-DOUTDIR='+builddir,
'-DICON_DIR=.',
'-DCOMMITID_SHORT='+sha1_short,
'-DCOMMIT_TIME='+commit_time,
'-DSHA1='+sha1,
'-DNAME='+name,
'-DNAME_CAP='+name_cap,
'-DICON_NAME='+name + '_logo',
'-DARCH='+arch,
'-DSYSROOT=/usr/' + arch + '/sys-root/mingw',
'-DHOST='+host,
'-DVERSION='+'v'+ version,
'-DLIBGCCDLL=libgcc_s_seh-1.dll',
'@INPUT@',
]
nsis = custom_target('nsis',
output: 'install-pomelo.exe',
input: files('pomelo.nsi'),
build_always_stale: true,
command: nsis_cmd,
depends: [exe]
)
alias_target('installer', nsis)
endif