This repository has been archived by the owner on May 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
meson.build
121 lines (105 loc) · 2.9 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
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
project('s7-imgui', 'cpp', 'c',
default_options: ['default_library=static',
'cpp_std=c++17',
],
)
extra_args = []
system = host_machine.system()
compiler_id = meson.get_compiler('cpp').get_id()
if compiler_id == 'msvc'
message('visual studio')
# these flags are copied from an example project, don't know what's what
# should comment later on what's what
extra_args += ['/wd"4996"', '/wd"4250"', '/wd"4018"', '/wd"4267"', '/wd"4068"', '-D_DEBUG']
endif
if system == 'windows' and compiler_id != 'msvc'
error('Building on windows requires the MSVC compiler. Other compilers are not supported at the moment.')
endif
link_args = []
# host or build machine?
# --- dependencies
s7_proj = subproject('s7')
s7_dep = s7_proj.get_variable('s7_dep')
sdl2_proj = subproject('sdl2')
sdl2_dep = sdl2_proj.get_variable('sdl2_dep')
sdl2main_dep = sdl2_proj.get_variable('sdl2main_dep')
# imgui looks for sdl
# https://mesonbuild.com/Reference-manual.html#dependency
meson.override_dependency('sdl', sdl2_dep)
imgui = subproject('imgui',
default_options: ['sdl=enabled',
'opengl2=enabled',
])
imgui_dep = imgui.get_variable('imgui_dep')
sdl_net_proj = subproject('sdl_net')
sdl_net_dep = sdl_net_proj.get_variable('sdl_net_dep')
nfd_proj = subproject('nfd')
nfd_dep = nfd_proj.get_variable('nfd_dep')
# --- application
meson.override_dependency('s7', s7_dep)
meson.override_dependency('imgui', imgui_dep)
subdir('src')
if not meson.is_subproject()
# hm probably remove the app
app = executable(
's7-imgui',
dependencies : [
sdl2_dep, # the core library
sdl2main_dep, # abstracts out the main thing: windows needs WinMain
sdl_net_dep,
imgui_dep,
s7_dep,
app_dep,
],
link_args: link_args,
cpp_args: extra_args,
gui_app: true, # needed on windows (int __cdecl invoke_main) : in VS /SUBSYSTEM windows
install: true,
)
gui_repl = executable(
'gui_repl',
sources: files(
'src/gui_repl.cpp',
),
dependencies : [
sdl2_dep, # the core library
sdl2main_dep, # abstracts out the main thing: windows needs WinMain
sdl_net_dep,
imgui_dep,
s7_dep,
aod_dep,
],
link_args: link_args,
cpp_args: extra_args,
gui_app: true, # needed on windows (int __cdecl invoke_main) : in VS /SUBSYSTEM windows
install: true,
)
repl = executable(
'repl',
sources: files('src/repl.cpp'),
dependencies : [
sdl2_dep, # the core library
sdl_net_dep,
imgui_dep,
s7_dep,
aod_dep,
],
link_args: link_args,
cpp_args: extra_args,
install: true,
)
# TODO switch building the examples with a definition option
subdir('examples')
# TODO not build test if building for release
subdir('test')
else
s7_imgui_dep = declare_dependency(
dependencies: [
sdl2_dep,
sdl_net_dep,
imgui_dep,
s7_dep,
aod_dep,
]
)
endif