diff options
| author | 2026-01-16 18:57:56 -0600 | |
|---|---|---|
| committer | 2026-01-16 18:57:56 -0600 | |
| commit | a887fd3a4ef9bcf673b286398802aa88ecb1592a (patch) | |
| tree | 568019b692e5b2b38a149bbf94c55dbe78237c7a /meson.build | |
| parent | move include directory (diff) | |
endian functions
Diffstat (limited to 'meson.build')
| -rw-r--r-- | meson.build | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/meson.build b/meson.build index f86511c..d34bf7d 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,90 @@ -project('vaclaunch', 'c') +project('vaclaunch', 'c', meson_version : '>=1.1') jansson_dep = dependency('jansson', required : true) curl_dep = dependency('libcurl', required : true) -proj_inc = include_directories('include') +proj_inc = include_directories('include', '.') + +platform_enum_names = { + 'windows': 'PLATFORM_WINDOWS', + 'osx': 'PLATFORM_OSX', + 'linux': 'PLATFORM_LINUX', + 'unknown': 'PLATFORM_UNKNOWN' +} + +plat_os = get_option('launcher_os') +if plat_os == 'detect' + if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + plat_os = 'windows' + elif host_machine.system() == 'osx' + plat_os = 'osx' + elif host_machine.system() == 'linux' + plat_os = 'linux' + else + plat_os = 'unknown' + endif + + message('Auto-detected launcher OS:', plat_os) +else + message('Using launcher OS:', plat_os) +endif + +plat_arch = get_option('launcher_arch') +if plat_arch == '' + plat_arch = host_machine.cpu_family() + if plat_arch == 'x86_64' + # squash faulty arch regexes like 'x86' for detecting 32-bit systems + plat_arch = 'amd64' + endif + + message('Auto-detected launcher architecture:', plat_arch) +else + message('Using launcher architecture:', plat_arch) +endif + +plat_jre_arch = get_option('launcher_jre_arch') +if plat_jre_arch == '' + plat_jre_arch = 'gamecore' + + if plat_os == 'windows' + if plat_arch == 'amd64' + plat_jre_arch = 'windows-x64' + elif plat_arch == 'x86' + plat_jre_arch = 'windows-x86' + elif plat_arch == 'aarch64' + plat_jre_arch = 'windows-arm64' + endif + elif plat_os == 'linux' + if plat_arch == 'amd64' + plat_jre_arch = 'linux' + elif plat_arch == 'x86' + plat_jre_arch = 'i386' + endif + elif plat_os == 'osx' + if plat_arch == 'amd64' + plat_jre_arch = 'mac-os' + elif plat_arch == 'aarch64' + plat_jre_arch = 'mac-os-arm64' + endif + endif + + message('Auto-detected launcher JRE architecture:', plat_jre_arch) +else + message('Using launcher JRE architecture:', plat_jre_arch) +endif + +platform_config = configuration_data() +platform_config.set_quoted('VL_OS_NAME', plat_os) +platform_config.set('VL_OS', platform_enum_names[plat_os]) +platform_config.set_quoted('VL_ARCH_NAME', plat_arch) +platform_config.set_quoted('VL_JRE_ARCH', plat_jre_arch) +platform_config.set10('VL_ENDIAN_LITTLE', host_machine.endian() == 'little') +platform_config.set10('VL_ENDIAN_BIG', host_machine.endian() == 'big') + +configure_file( + configuration : platform_config, + input : 'config.h.in', + output : 'config.h') subdir('lib') |
