-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmeson.build
More file actions
175 lines (152 loc) · 4.8 KB
/
Copy pathmeson.build
File metadata and controls
175 lines (152 loc) · 4.8 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
################################################################################
##
## This file is part of the Hades GBA Emulator, and is made available under
## the terms of the GNU General Public License version 2.
##
## Copyright (C) 2021-2026 - The Hades Authors
##
################################################################################
project(
'Hades',
'c',
'cpp',
version: '1.1.1',
license: 'GPL-2.0-only',
default_options: ['c_std=gnu17', 'cpp_std=c++11', 'buildtype=release'],
)
cc = meson.get_compiler('c')
incdir = include_directories('include', 'source')
cflags = [
'-fms-extensions',
'-Wno-microsoft-anon-tag',
'-DHADES_VERSION="@0@"'.format(meson.project_version()),
# '-fsanitize=undefined',
]
ldflags = [
# '-fsanitize=undefined',
]
# Somewhat required for the Windows CI to link properly.
# Otherwise it complains about a missing `WinMain()` function that SDL3 is, afaik, supposed to provide.
if host_machine.system() == 'windows' and cc.has_define('__MINGW32__')
ldflags += [
'-lmingw32',
]
endif
static_dependencies = get_option('static_executable') or get_option('static_dependencies')
if get_option('static_executable')
cflags += ['-static']
ldflags += ['-static']
endif
if get_option('with_wayland')
cflags += ['-DWITH_WAYLAND']
ldflags += ['-DWITH_WAYLAND']
endif
debugger_cflags = ['-DWITH_DEBUGGER']
debugger_ldflags = ['-DWITH_DEBUGGER']
cc = meson.get_compiler('c')
###############################
## External Dependencies ##
###############################
subdir('external')
###############################
## GBA Emulator Core Library ##
###############################
subdir('source/gba')
###############################
## Application ##
###############################
subdir('source/app')
if host_machine.system() == 'windows'
winrc = import('windows').compile_resources('./resource/windows/hades.rc')
hades = executable(
'Hades',
'source/log.c',
winrc,
win_subsystem: 'windows',
link_with: [libapp],
include_directories: [incdir, imgui_inc],
c_args: cflags,
link_args: ldflags,
install: true,
)
if get_option('with_debugger')
hades = executable(
'Hades Debugger',
'source/log.c',
winrc,
win_subsystem: 'windows',
link_with: [libapp_dbg],
include_directories: [incdir, imgui_inc],
c_args: cflags + debugger_cflags,
link_args: ldflags + debuffer_ldflags,
install: true,
)
endif
elif host_machine.system() == 'darwin'
hades = executable(
'hades',
'source/log.c',
link_with: [libapp],
include_directories: [incdir, imgui_inc],
c_args: cflags,
link_args: ldflags,
install: true,
)
if get_option('with_debugger')
hades_dbg = executable(
'hades-dbg',
'source/log.c',
link_with: [libapp_dbg],
include_directories: [incdir, imgui_inc],
c_args: cflags + debugger_cflags,
link_args: ldflags + debugger_ldflags,
install: true,
)
endif
install_data('./resource/macos/Info.plist', install_dir: 'Contents')
install_data('./resource/macos/hades.icns', install_dir: 'Contents/Resources')
elif host_machine.system() == 'linux' # Linux
hades = executable(
'hades',
'source/log.c',
link_with: [libapp],
include_directories: [incdir, imgui_inc],
c_args: cflags,
link_args: ldflags,
install: true,
)
if get_option('with_debugger')
hades_dbg = executable(
'hades-dbg',
'source/log.c',
link_with: [libapp_dbg],
include_directories: [incdir, imgui_inc],
c_args: cflags + debugger_cflags,
link_args: ldflags + debugger_ldflags,
install: true,
)
endif
install_data('./resource/linux/hades.desktop', install_dir: 'share/applications')
install_data('./resource/linux/hades.png', install_dir: 'share/icons/hicolor/256x256/apps')
else # Not supported officially, but there's no reason not to try and build them anyway
hades = executable(
'hades',
'source/log.c',
link_with: [libapp],
include_directories: [incdir, imgui_inc],
c_args: cflags,
link_args: ldflags,
install: true,
)
if get_option('with_debugger')
hades_dbg = executable(
'hades-dbg',
'source/log.c',
link_with: [libapp_dbg],
include_directories: [incdir, imgui_inc],
c_args: cflags + debugger_cflags,
link_args: ldflags + debugger_ldflags,
install: true,
)
endif
endif