This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
95 lines (85 loc) · 2.14 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
project('Tomb3Main', ['c'],
default_options: [
'c_std=c11',
],
)
warning_level = 3
version = meson.project_version()
version_pretty = 'v' + version
git = find_program('git', required: true)
if git.found()
gitdesc = run_command(git, 'describe', '--abbrev=7', '--tags', check: false)
if gitdesc.returncode() == 0
version_pretty = gitdesc.stdout().strip()
else
gitdesc = run_command(git, 'describe', '--always', '--abbrev=7', '--tags', check: false)
if gitdesc.returncode() == 0
version_pretty = '0.0-g' + gitdesc.stdout().strip()
endif
endif
endif
c_compiler = meson.get_compiler('c')
is_mingw = c_compiler.get_id() == 'gcc' and host_machine.system() == 'windows'
if is_mingw
add_project_link_arguments([], language: 'c')
endif
build_opts = [
'-Wno-unused',
'-D_GNU_SOURCE',
'-DVERSION="T3M ' + version_pretty + '"'
]
c_opts = []
add_project_arguments(build_opts + c_opts, language: 'c')
dep_shlwapi = c_compiler.find_library('shlwapi')
# autogenerated files
resources = []
python3 = find_program('python3', required: true)
custom_target(
'fake_init',
output: ['fake_init'],
command: [python3, meson.source_root() + '/tools/generate_init'],
build_by_default: true
)
version_rc = custom_target(
'fake_version',
output: ['version.rc'],
command: [python3, meson.source_root() + '/tools/generate_version', '--version', version_pretty, '--output', '@OUTPUT0@'],
build_always: true
)
if host_machine.system() == 'windows'
windows = import('windows')
resources = [
windows.compile_resources(version_rc),
]
endif
sources = [
'src/filesystem.c',
'src/filesystem_win.c',
'src/game/lara/lara_col.c',
'src/game/lara/lara_control.c',
'src/game/lara/lara_hands.c',
'src/game/lara/lara_look.c',
'src/game/lara/lara_misc.c',
'src/game/lara/lara_state.c',
'src/game/matrix.c',
'src/game/random.c',
'src/game/text.c',
'src/init.c',
'src/inject.c',
'src/inject_util.c',
'src/log.c',
'src/main.c',
'src/memory.c',
resources,
]
dependencies = [
dep_shlwapi,
]
shared_library(
'Tomb3Main',
sources,
name_prefix: '',
include_directories: ['src/'],
dependencies: dependencies,
link_args: ['-static'],
)