aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build83
1 files changed, 80 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 5689d96..0b18d02 100644
--- a/meson.build
+++ b/meson.build
@@ -1,9 +1,9 @@
project('l2su', 'c', default_options : {'b_ndebug': 'if-release'})
-add_global_arguments('-D_XOPEN_SOURCE=700', language : 'c')
+add_global_arguments('-D_XOPEN_SOURCE=700', '-DPCRE2_CODE_UNIT_WIDTH=8', language : 'c')
curl_dep = dependency('libcurl')
jansson_dep = dependency('jansson')
-pcre_dep = dependency('libpcre2-8')
+pcre2_dep = dependency('libpcre2-8')
config_data = configuration_data()
@@ -18,5 +18,82 @@ else
error('Middle endian is unsupported')
endif
+launcher_os = get_option('launcher_os')
+launcher_arch_bits = get_option('launcher_arch_bits')
+launcher_arch = get_option('launcher_arch')
+launcher_jre_arch = get_option('launcher_jre_arch')
+
+if launcher_os == 'auto'
+ if host_machine.system() == 'linux'
+ launcher_os = 'linux'
+ elif host_machine.system() == 'darwin'
+ launcher_os = 'osx'
+ elif host_machine.system() == 'windows'
+ launcher_os = 'windows'
+ else
+ error('Unable to determine OS. Please use the launcher_os build option.')
+ endif
+endif
+
+if launcher_arch_bits == 'auto'
+ if host_machine.cpu_family() == 'x86'
+ launcher_arch_bits = '32'
+ elif host_machine.cpu_family() == 'x86_64' or host_machine.cpu_family() == 'arm64'
+ launcher_arch_bits = '64'
+ else
+ error('Unable to determine launcher arch bits. Please use the launcher_arch_bits option.')
+ endif
+endif
+
+if launcher_arch == ''
+ launcher_arch = host_machine.cpu_family()
+endif
+
+if launcher_jre_arch == 'auto'
+ if host_machine.system() == 'linux'
+ if host_machine.cpu_family() == 'x86'
+ launcher_jre_arch = 'linux-i386'
+ elif host_machine.cpu_family() == 'x86_64'
+ launcher_jre_arch = 'linux'
+ else
+ launcher_jre_arch = 'gamecore'
+ endif
+ elif host_machine.system() == 'darwin'
+ if host_machine.cpu_family() == 'aarch64'
+ launcher_jre_arch = 'mac-os-arm64'
+ else
+ launcher_jre_arch = 'mac-os'
+ endif
+ elif host_machine.system() == 'windows'
+ if host_machine.cpu_family() == 'x86'
+ launcher_jre_arch = 'windows-x86'
+ elif host_machine.cpu_family() == 'x86_64'
+ launcher_jre_arch = 'windows-x64'
+ elif host_machine.cpu_family() == 'aarch64'
+ launcher_jre_arch = 'windows-arm64'
+ else
+ launcher_jre_arch = 'gamecore'
+ endif
+ else
+ launcher_jre_arch = 'gamecore'
+ endif
+endif
+
+message('Using launcher OS', launcher_os)
+config_data.set_quoted('L2SU_LAUNCHER_OS', launcher_os)
+
+message('Using launcher arch bits', launcher_arch_bits)
+config_data.set_quoted('L2SU_LAUNCHER_ARCH_BITS', launcher_arch_bits)
+
+message('Using launcher arch', launcher_arch)
+config_data.set_quoted('L2SU_LAUNCHER_ARCH', launcher_arch)
+
+message('Using launcher JRE arch', launcher_jre_arch)
+config_data.set_quoted('L2SU_JRE_ARCH', launcher_jre_arch)
+
+if launcher_jre_arch == 'gamecore'
+ message('(launcher_jre_arch == gamecore, so JREs will most likely not be downloaded.)')
+endif
+
subdir('src')
-executable('l2su', launcher_srcs, dependencies : [curl_dep, jansson_dep], include_directories : [config_include_dir], override_options : {'c_std': 'c99'})
+executable('l2su', launcher_srcs, dependencies : [curl_dep, jansson_dep, pcre2_dep], include_directories : [config_include_dir], override_options : {'c_std': 'c99'})