Edit meson scripts to compile for Android

This commit is contained in:
ItzVladik
2026-04-05 08:18:29 +00:00
parent 91923d445a
commit 1ea1801271
5 changed files with 86 additions and 10 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ platform_sources = run_command(
).stdout().strip().split('\n')
# linux-specific files
if host_machine.system() == 'linux'
if host_machine.system() == 'linux' or host_machine.system() == 'android'
platform_sources += run_command(
'sh',
'-c', 'find "'
+9 -1
View File
@@ -64,8 +64,16 @@ lib_minecraft = static_library('minecraft',
cpp_args : global_cpp_args + global_cpp_defs,
)
_inc_dir = '../../' / inc_dir
zlib_dep = dependency('zlib')
crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux
if host_machine.system() == 'android'
crypto_dep = declare_dependency(
dependencies: cc.find_library('crypto', dirs: lib_dir, required: true ),
include_directories: _inc_dir)
else
crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux
endif
minecraft_dep = declare_dependency(
link_with : lib_minecraft,
+28 -4
View File
@@ -1,4 +1,5 @@
platform_inc = include_directories('.')
_inc_dir = '../../' / inc_dir
_threads = dependency('threads')
lib_platform_core = static_library('platform_core',
@@ -14,16 +15,39 @@ platform_dep = declare_dependency(
)
# SDL2-based platform implementations (formerly 4J.* modules)
_sdl2 = dependency('sdl2')
if host_machine.system() == 'android'
_sdl2 = declare_dependency(
dependencies: cc.find_library('SDL2', dirs: lib_dir, required: true ),
include_directories: _inc_dir)
else
_sdl2 = dependency('sdl2')
endif
_defs = []
if get_option('renderer') == 'gles'
_gl = dependency('glesv2', required: true)
if host_machine.system() == 'android'
_gl = cc.find_library('GLESv3', required: true )
_egl = cc.find_library('EGL', required: true )
else
_gl = dependency('glesv2', required: true)
endif
_defs += ['-DGLES']
else
_gl = dependency('gl', required: true)
endif
deps = [
_sdl2,
_gl,
_threads,
glm_dep,
stb_dep,
]
if host_machine.system() == 'android'
deps += _egl
endif
sdl2_sources = files(
'sdl2/Input.cpp',
'sdl2/Profile.cpp',
@@ -35,7 +59,7 @@ sdl2_sources = files(
lib_platform_sdl2 = static_library('platform_sdl2',
sdl2_sources,
include_directories: [platform_inc, include_directories('sdl2')],
dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep],
dependencies: deps,
cpp_args: _defs + global_cpp_args + global_cpp_defs,
)
@@ -44,7 +68,7 @@ lib_platform_sdl2 = static_library('platform_sdl2',
render_dep = declare_dependency(
link_with: lib_platform_sdl2,
include_directories: [platform_inc, include_directories('sdl2')],
dependencies: [_sdl2, _gl, _threads, glm_dep],
dependencies: deps,
)
input_dep = render_dep
profile_dep = render_dep