-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
149 lines (130 loc) · 3.44 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
# meson.build
###########
# Project #
###########
project(
'trollauncher',
'cpp',
version : '0.8.0',
license : 'MIT',
default_options : [
'cpp_std=c++17',
'buildtype=debugoptimized',
'warning_level=3',
'werror=true'
]
)
version = meson.project_version()
version_array = version.split('.')
major_version = version_array[0].to_int()
minor_version = version_array[1].to_int()
patch_version = version_array[2].to_int()
#################
# Linux Options #
#################
lnx_extra_deps = []
if build_machine.system() == 'linux'
lnx_extra_deps = [meson.get_compiler('cpp').find_library('libprocps')]
endif
###################
# Windows Options #
###################
# Use static linking on Windows
msw_extra_src = []
msw_extra_deps = []
wxwidgets_mods = []
main_link_args = []
static_boost = false
if build_machine.system() == 'windows'
windows = import('windows')
trollauncher_rc = configure_file(
input : 'resource/trollauncher.rc.in',
output : 'trollauncher.rc',
configuration : {
'MAJOR_VERSION' : major_version,
'MINOR_VERSION' : minor_version,
'PATCH_VERSION' : patch_version
}
)
msw_extra_src = [
windows.compile_resources(
trollauncher_rc,
# Unfortunately, this is hardcoded to MSYS2, and you may need to edit it
include_directories : include_directories('resource', 'C:/msys64/mingw64/include/wx-3.0')
)
]
msw_extra_deps = [
meson.get_compiler('cpp').find_library('ws2_32'),
meson.get_compiler('cpp').find_library('ole32'),
meson.get_compiler('cpp').find_library('wbemuuid')
]
wxwidgets_mods = ['--static']
main_link_args = ['-static']
static_boost = true
endif
################
# Dependencies #
################
fs_dep = meson.get_compiler('cpp').find_library('stdc++fs')
boost_dep = dependency(
'boost',
version : '>=1.65.0',
modules : ['system', 'filesystem', 'program_options'],
include_type : 'system',
# This seems only required for boost
static : static_boost
)
libzippp_dep = dependency(
'libzippp',
fallback : ['libzippp', 'libzippp_dep'],
include_type : 'system'
)
# Using "as_system('system')" as a work-around for Meson weirdness, where it
# doesn't seem to respect the "include_type : 'system'" option.
#
# See also: https://github.com/mesonbuild/meson/issues/7503
nlohmann_json_dep = dependency(
'nlohmann_json',
fallback : ['nlohmann_json', 'nlohmann_json_dep'],
include_type : 'system'
).as_system('system')
date_dep = dependency(
'date',
fallback : ['date', 'date_dep'],
include_type : 'system'
).as_system('system')
wxwidgets_dep = dependency(
'wxwidgets',
version : '>=3.0.0',
modules : wxwidgets_mods,
include_type : 'system'
)
###############
# Application #
###############
trollauncher_srcs = [
'trollauncher/cli.cpp',
'trollauncher/error_codes.cpp',
'trollauncher/forge_installer.cpp',
'trollauncher/gui.cpp',
'trollauncher/java_detector.cpp',
'trollauncher/keeplist_processor.cpp',
'trollauncher/launcher_profiles_editor.cpp',
'trollauncher/main.cpp',
'trollauncher/mc_process_detector.cpp',
'trollauncher/modpack_installer.cpp',
'trollauncher/utils.cpp'
]
trollauncher_deps = [
fs_dep, boost_dep,
libzippp_dep,
nlohmann_json_dep,
date_dep,
wxwidgets_dep
]
executable(
'trollauncher', trollauncher_srcs + msw_extra_src,
include_directories : [],
dependencies : trollauncher_deps + lnx_extra_deps + msw_extra_deps,
link_args : main_link_args
)