-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
152 lines (137 loc) · 3.17 KB
/
meson.build
File metadata and controls
152 lines (137 loc) · 3.17 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
project(
'handmadehero',
'c',
version: '0.1-dev',
default_options: [
'c_std=c99',
'warning_level=2',
'werror=true',
],
)
is_build_debug = get_option('buildtype').startswith('debug')
cc = meson.get_compiler('c')
add_project_arguments(
[
'-DCOMPILER_GCC=' + (cc.get_id() == 'gcc').to_int().to_string(),
'-DCOMPILER_CLANG=' + (cc.get_id() == 'clang').to_int().to_string(),
],
language: 'c',
)
add_project_arguments(
cc.get_supported_arguments([
#'-O3',
'-march=x86-64-v3',
'-funroll-loops',
'-fomit-frame-pointer',
'-Wconversion',
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wno-missing-braces',
]),
language: 'c',
)
if is_build_debug
add_project_arguments(
cc.get_supported_arguments([
'-DHANDMADEHERO_DEBUG=1',
'-DHANDMADEHERO_INTERNAL=1',
'-Wno-unused-but-set-variable',
'-Wno-unused-function',
'-Wno-unused-variable',
]),
language : 'c'
)
endif
libm = cc.find_library('m')
# used in both library and platform code
common_src = [
'src/handmadehero_memory_arena.c'
]
if is_build_debug
common_src += [
'src/handmadehero_debug.c',
]
endif
# debug builds have handmadehero as dynamic library
# and does not need to link with because of hot reload logic
handmadehero_sources = [
'src/handmadehero_random.c',
'src/handmadehero_asset.c',
'src/handmadehero_audio.c',
'src/handmadehero_entity.c',
'src/handmadehero_render_group.c',
'src/handmadehero_sim_region.c',
'src/handmadehero_world.c',
'src/handmadehero.c',
]
if is_build_debug
handmadeheroLib = library(
'handmadehero',
sources: common_src + handmadehero_sources,
include_directories: 'include',
dependencies: [
libm,
]
)
else
common_src += handmadehero_sources
endif
platform_src = []
platform_inc_dirs = []
platform_libs = []
if host_machine.system() == 'windows'
#################################################################
# TODO: publish on windows platform
# WINDOWS BUILD
# _.-;;-._
# '-..-'| || |
# '-..-'|_.-;;-._|
# '-..-'| || |
# '-..-'|_.-''-._|
#################################################################
elif host_machine.system() == 'linux'
#################################################################
# LINUX BUILD
# .--.
# |o_o |
# |:_/ |
# // \ \
# (| | )
# /'\_ _/`\
# \___)=(___/
#################################################################
wayland_client = dependency('wayland-client')
xkbcommon = dependency('xkbcommon')
libevdev = dependency('libevdev')
liburing = dependency('liburing')
libpthread = cc.find_library('pthread')
libpipewire = dependency('libpipewire-0.3')
subdir('protocol')
platform_src += [
'src/handmadehero_linux.c',
]
platform_src += wl_protocols_src
platform_inc_dirs += [
'protocol',
]
platform_libs += [
wayland_client,
xkbcommon,
libevdev,
liburing,
libm,
libpthread,
libpipewire,
]
endif
subdir('tool')
subdir('test')
executable(
'handmadehero',
sources: common_src + platform_src,
include_directories: [
'include',
platform_inc_dirs,
],
dependencies: platform_libs,
)