-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
176 lines (158 loc) · 6.1 KB
/
meson.build
File metadata and controls
176 lines (158 loc) · 6.1 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
176
project('Cortex-Command-Community-Project', ['cpp','c'], default_options:['cpp_std=c++17', 'buildtype=release'], version:'0.1.0-Pre-4.1', meson_version:'>=0.60')
#### Build environment Setup ####
deps=[]
if host_machine.system() in ['linux','osx']
deps = [
dependency('allegro', version:'<5.0'),
dependency('loadpng'),
dependency('flac'),
dependency('minizip', version:'<1.3', not_found_message:'The correct version (1.2.x) of minizip might be packaged as minizip-compat.'),
dependency('luajit'),
dependency('threads'),
dependency('liblz4'),
dependency('libpng'),
dependency('boost'), #needed for luabind
dependency(['lua52', 'lua5.2', 'lua-5.2']),
]
if host_machine.system() == 'linux'
deps += dependency('x11')
endif
endif
elfname = 'CortexCommand'
compiler = meson.get_compiler('cpp')
build_rpath = ''
link_args=[]
extra_args=[]
preprocessor_flags = []
suffix=''
if compiler.get_argument_syntax()== 'gcc' # used for gcc compatible compilers
# Build against system libraries on linux
message('gcc detected')
build_rpath = '$ORIGIN:$ORIGIN/../external/lib/linux/x86_64' # Set RUNPATH so that CCCP can find libfmod.so without needing to set LD_LIBRARY_PATH
#suffix = 'x86_64'
link_args += ['-Wl,--enable-new-dtags'] # Set RUNPATH instead of RPATH
# Set preprocessor flags and cpp arguments according to build options
buildtype_debug = get_option('debug')
if buildtype_debug
elfname += '_debug' # add _debug suffix for debug builds
extra_args += ['-Wno-unknown-pragmas', '-Wno-deprecated-declarations', '-Wno-misleading-indentation'] # Disable #pragma region complaints and luabind auto_ptr warning
if get_option('sane_warnings')
extra_args += ['-Wno-sign-compare', '-Wno-non-virtual-dtor', '-Wno-parentheses', '-Wno-overloaded-virtual', '-Wno-inconsistent-missing-override']
endif
debug_type = get_option('debug_type')
if debug_type == 'release'
preprocessor_flags += ['-DDEBUG_RELEASE_BUILD'] # enable minimal debug features
elif debug_type == 'minimal'
preprocessor_flags += ['-DDEBUGMODE'] # enable some debug features
elif debug_type == 'full'
preprocessor_flags += ['-DDEBUG_BUILD', '-DDEBUGMODE'] # enable all debug features; may slow down game
endif
else
extra_args = ['-w'] # Disable all warnings for release builds
preprocessor_flags += ['-DRELEASE_BUILD'] # disable all debug features
endif
if compiler.get_id() =='gcc' and compiler.version().version_compare('<9')
link_args += ['-lstdc++fs']
endif
elif compiler.get_argument_syntax()== 'msvc'
#TODO: add MSVC related arguments and stuff in here
message('cl detected')
elfname = 'Cortex Command'
extra_args += ['-permissive-', '-D_HAS_ITERATOR_DEBUGGING=0', '-D_HAS_AUTO_PTR_ETC=1']
add_project_link_arguments(['winmm.lib', 'ws2_32.lib', 'dinput8.lib', 'ddraw.lib', 'dxguid.lib', 'dsound.lib'], language:'cpp')
if host_machine.cpu_family() == 'x64'
elfname += ' x64'
endif
preprocessor_flags += ['-D_CRT_SECURE_NO_DEPRECATE', '-D_WINDOWS', '-DWIN32', '-DWIN32_LEAN_AND_MEAN']
link_args+=['-ignore:4099', '-ignore:4217']
buildtype_debug = get_option('debug')
if buildtype_debug
elfname+='.debug'
debug_type = get_option('debug_type')
if debug_type == 'release'
preprocessor_flags += ['-DDEBUG_RELEASE_BUILD'] # enable minimal debug features
elif debug_type == 'minimal'
elfname += '.minimal'
preprocessor_flags += ['-DDEBUGMODE'] # enable some debug features
elif debug_type == 'full'
elfname += '.full'
preprocessor_flags += ['-DDEBUG_BUILD', '-DDEBUGMODE'] # enable all debug features; may slow down game
endif
else
preprocessor_flags += ['-DRELEASE_BUILD', '-DNDEBUG']
endif
else
error('Using unknown compiler, please use gcc or msvc compatible compilers')
endif
#### Configuration ####
conf_data = configuration_data()
prefix = get_option('prefix')
conf_data.set_quoted('BASEDATAPATH', prefix/get_option('data_install_dir'))
if suffix==''
suffix=[]
conf_data.set('EXENAME', elfname)
else
conf_data.set('EXENAME', elfname + '.' + suffix)
endif
if get_option('install_runner')
conf_data.set('EXERUNNER', 'CortexCommand')
conf_data.set('EXEPATH', prefix/get_option('libdir')/'CortexCommand')
else
conf_data.set('EXERUNNER', conf_data.get('EXENAME'))
conf_data.set('EXEPATH', prefix/get_option('bindir'))
endif
#### Sources Setup ####
pch = 'System/StandardIncludes.h'
sources = []
source_inc_dirs = include_directories(
'Activities',
'Entities',
'GUI',
'Lua',
'Managers',
'Menus',
'Resources',
'System')
subdir('Activities')
subdir('Entities')
subdir('GUI')
subdir('Lua')
subdir('Managers')
subdir('Menus')
subdir('System')
subdir('Resources')
#### External Libraries ####
external_objects = []
external_libs = []
subdir('external')
install_rpath = prefix/get_option('fmod_dir')
#### Target Definitions ####
cccpelf = executable(
elfname, ['Main.cpp', sources], include_directories:[source_inc_dirs, external_inc_dirs], cpp_pch:pch, # Sources options
link_with:external_libs, objects:[external_objects], dependencies:deps, # Link options
cpp_args:[extra_args, preprocessor_flags], link_args:link_args, build_rpath:build_rpath, # Compiler setup
name_suffix:suffix, # Executable name options
build_by_default:true, # Meson options
install: true, install_rpath: install_rpath, install_dir: get_option('install_runner') ? get_option('libdir')/'CortexCommand' : get_option('bindir'),
win_subsystem:'windows' # Windows mark as GUI app
)
#### Installing #####
base_exclude_files = [
'Base.rte/Settings.ini',
'Launch Actor Editor.bat',
'Launch Area Editor.bat',
'Launch Assembly Editor.bat',
'Launch Gib Editor.bat',
'Launch Scene Editor.bat',
'LogConsole.txt',
'LogLoading.txt',
'LogLoadingWarning.txt',
'Start Dedicated Server.bat'
]
if get_option('install_data')
install_subdir(get_option('cccpdatadir'),
exclude_directories:['.git', '.github', 'Metagames.rte', 'Scenes.rte'],
exclude_files:base_exclude_files,
install_dir:get_option('data_install_dir'),
strip_directory:true)
endif