-
Notifications
You must be signed in to change notification settings - Fork 14
/
meson.build
155 lines (131 loc) · 3.4 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
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
project(
'CyberEther',
['cpp'],
version: '1.0.0-alpha4',
default_options: [
'cpp_std=c++20',
'buildtype=release',
'b_ndebug=if-release',
'warning_level=3',
]
)
#
# Global Variables
#
jst_build_optimize = get_option('optimization')
jst_build_debug = get_option('debug')
jst_is_static = get_option('default_library') == 'static'
jst_is_release = not jst_build_debug
jst_is_crossbuild = meson.is_cross_build()
jst_is_linux = target_machine.system().startswith('linux') or \
target_machine.system().startswith('freebsd')
jst_is_macos = target_machine.system().startswith('darwin')
jst_is_ios = target_machine.system().startswith('ios')
jst_is_android = target_machine.system().startswith('android')
jst_is_browser = target_machine.system().startswith('emscripten')
jst_is_windows = target_machine.system().startswith('windows')
if not jst_is_linux and \
not jst_is_macos and \
not jst_is_ios and \
not jst_is_android and \
not jst_is_browser and \
not jst_is_windows
error('Cannot determine target system. If your system is supported, file a bug report.')
endif
#
# Handle Options
#
if get_option('native')
add_project_arguments('-march=native', language: 'cpp')
endif
cfg_lst = configuration_data()
src_lst = []
dep_lst = [
dependency('threads'),
]
inc_lst = [
include_directories('include'),
include_directories('.'),
include_directories('include/jetstream/backend/devices/metal'),
include_directories('include/jetstream/render/tools'),
]
#
# Handle Configuration Data
#
cfg_lst.set('version', meson.project_version())
cfg_lst.set('buildtype', get_option('buildtype'))
cfg_lst.set('optimization', get_option('optimization'))
cfg_lst.set('debug', get_option('debug'))
cfg_lst.set('native', get_option('native'))
cfg_lst.set('JST_IS_STATIC', jst_is_static)
cfg_lst.set('JST_IS_SHARED', not jst_is_static)
cfg_lst.set('JST_DEBUG_MODE', not jst_is_release)
cfg_lst.set('JST_RELEASE_MODE', jst_is_release)
cfg_lst.set('JST_OS_LINUX', jst_is_linux)
cfg_lst.set('JST_OS_MAC', jst_is_macos)
cfg_lst.set('JST_OS_IOS', jst_is_ios)
cfg_lst.set('JST_OS_ANDROID', jst_is_android)
cfg_lst.set('JST_OS_BROWSER', jst_is_browser)
cfg_lst.set('JST_OS_WINDOWS', jst_is_windows)
#
# Call Subdirectories
#
subdir('meson')
subdir('resources')
subdir('flowgraphs')
subdir('shaders')
subdir('src')
subdir('include')
#
# Declare Library
#
libjetstream = library(
'jetstream',
src_lst,
include_directories: inc_lst,
dependencies: dep_lst,
install: true
)
libjetstream_dep = declare_dependency(
include_directories: inc_lst,
dependencies: dep_lst,
link_with: libjetstream
)
if not jst_is_static
pkg = import('pkgconfig')
pkg.generate(
libjetstream,
libraries: dep_lst,
)
endif
if not jst_is_ios and \
not jst_is_android
executable(
'cyberether',
'main.cc',
dependencies: libjetstream_dep,
install: true,
)
endif
#
# Optionals
#
if not jst_is_browser and \
not jst_is_android and \
not jst_is_ios
subdir('tests')
endif
if not jst_is_browser and \
not jst_is_android and \
not jst_is_ios
subdir('examples')
endif
#
# Print Summary
#
summary({
'cpp_std': get_option('cpp_std'),
'prefix': get_option('prefix'),
'buildtype': get_option('buildtype'),
'crossbuild': jst_is_crossbuild,
}, section: 'General', bool_yn: true)