forked from LAK132/SourceExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
142 lines (121 loc) · 2.71 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
project(
'source-explorer',
['c', 'cpp'],
default_options: [
'warning_level=3',
'werror=true',
'b_vscrt=static_from_buildtype',
# 'b_sanitize=address',
],
)
cxx = meson.get_compiler('cpp')
if cxx.get_id() == 'msvc'
version = 'c++latest'
c_cpp_args = [
'-DUNICODE',
'-DWIN32_LEAN_AND_MEAN',
'-DNOMINMAX',
'-wd4315',
'-wd4366',
'-Wv:18',
]
cpp_args = [
'-Zc:__cplusplus',
'-Zc:rvalueCast',
'-Zc:wchar_t',
'-Zc:ternary',
'-Zc:preprocessor',
]
c_args = []
macro_test_args = c_cpp_args + cpp_args + ['-std:' + version]
else
version = 'c++20'
c_cpp_args = [
'-Wno-gnu-zero-variadic-macro-arguments',
'-Wno-language-extension-token',
'-Wno-dangling-else',
'-Wno-microsoft-cast',
'-Wno-pragma-pack',
'-Wno-deprecated-declarations',
'-Wno-unused-private-field',
'-Wfatal-errors',
# '-mavx',
]
cpp_args = []
c_args = []
macro_test_args = c_cpp_args + cpp_args + ['-std=' + version]
endif
c_cpp_args += [
'-D_CRT_SECURE_NO_WARNINGS',
'-DSDL_MAIN_HANDLED',
]
if get_option('buildtype') != 'debug'
c_cpp_args += [ '-DNDEBUG' ]
endif
if get_option('lak_backend') == 'sdl'
c_cpp_args += [ '-DLAK_USE_SDL' ]
elif get_option('lak_backend') == 'win32'
c_cpp_args += [ '-DLAK_USE_WINAPI' ]
endif
add_project_arguments(c_cpp_args + cpp_args, language: ['cpp'])
add_project_arguments(c_cpp_args + c_args, language: ['c'])
if host_machine.system() == 'windows'
git_header = custom_target(
'generate_git_file',
output: 'git.hpp',
command: ['generate_git_file.bat', '@OUTPUT@'] ,
build_by_default: true,
)
else
git_header = custom_target(
'generate_git_file',
output: 'git.hpp',
command: ['./generate_git_file.sh', '@OUTPUT@'] ,
build_by_default: true,
)
endif
cplusplus = cxx.get_define('__cplusplus', args: macro_test_args)
if cxx.compute_int(cplusplus) < 202002
error('C++ version insufficient, expected 202002L got ' + cplusplus)
endif
install_directory = host_machine.cpu_family()
subdir('include')
subdir('src')
if host_machine.system() == 'windows'
sdl2_dll = configure_file(
copy: true,
input: sdl2_dll,
output: 'SDL2.dll',
install: true,
install_dir: install_directory,
)
endif
executable(
'srcexp',
srcexp + [git_header],
install: true,
install_dir: install_directory,
override_options: 'cpp_std=' + version,
include_directories: include_directories([
'include',
'include/glm',
'include/imgui',
'include/imgui/misc/cpp',
'include/lak/inc',
'include/lisk/inc',
]),
link_with: [
lak,
lakopengl,
lakwindowing,
lisk,
stb,
imgui,
],
link_whole: [
laktest,
],
dependencies: [
sdl2,
],
)