redoing everything

This commit is contained in:
Mohamed Ashraf 2026-03-25 09:14:52 +04:00
parent c90d9e11ef
commit b04b2d70fc
6 changed files with 71 additions and 10 deletions

Binary file not shown.

View file

@ -46,7 +46,7 @@ platform_sources += run_command(
).stdout().strip().split('\n')
# linux-specific files (everything in Platform/Linux)
if host_machine.system() == 'linux'
if host_machine.system() == 'linux' or host_machine.system() == 'emscripten'
platform_sources += run_command(
'sh', '-c',
'find "'
@ -56,6 +56,13 @@ if host_machine.system() == 'linux'
).stdout().strip().split('\n')
endif
is_emscripten = host_machine.system() == 'emscripten'
emcc_link_args = []
if is_emscripten
emcc_link_args += ['--preload-file', meson.global_source_root() + '/build/Minecraft.Client/Common@Common']
endif
client_dependencies = [
render_dep,
input_dep,
@ -67,7 +74,7 @@ client_dependencies = [
glu_dep,
thread_dep,
thread_dep,
dependency('zlib'),
zlib_dep,
miniaudio_dep
]
@ -101,6 +108,7 @@ client = executable('Minecraft.Client',
'-DUNICODE', '-D_UNICODE',
'-include', meson.current_source_dir() / 'Platform/stdafx.h',
],
link_args: emcc_link_args,
c_args : global_cpp_defs + ['-DUNICODE', '-D_UNICODE'],
install : true,
install_dir : ''

@ -0,0 +1 @@
Subproject commit d8e299482a9f7f08151c893a25274c7beb1735aa

View file

@ -46,8 +46,12 @@ lib_world = static_library('Minecraft.World',
],
)
zlib_dep = dependency('zlib')
crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux
is_emscripten = host_machine.system() == 'emscripten'
if is_emscripten
crypto_dep = declare_dependency()
else
crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux
endif
world_dep = declare_dependency(
link_with : lib_world,

View file

@ -17,13 +17,26 @@ python = pymod.find_installation('python3', required: true)
cc = meson.get_compiler('cpp')
# system deps
gl_dep = dependency('gl')
glu_dep = dependency('glu')
sdl2_dep = dependency('sdl2') # Yes.. i know sdl3 is out, but there's not point upgrading right now except when
if host_machine.system() == 'emscripten'
# These are handled in Emscripten via -sUSE_<whatever>
gl_dep = declare_dependency()
glu_dep = declare_dependency()
sdl2_dep = declare_dependency()
thread_dep = declare_dependency()
zlib_dep = declare_dependency()
miniaudio_dep = declare_dependency()
else
gl_dep = dependency('gl')
glu_dep = dependency('glu')
sdl2_dep = dependency('sdl2') # Yes.. i know sdl3 is out, but there's not point upgrading right now except when
# someone is gonna ask me "Hey juicey can you make it SDL3?" and i'd be like fuck you and still do it.
thread_dep = dependency('threads')
miniaudio_dep = dependency('miniaudio')
thread_dep = dependency('threads')
zlib_dep = dependency('zlib')
miniaudio_dep = dependency('miniaudio')
endif
stb = subproject('stb').get_variable('stb_inc')
# compile flags (chagne ts juicey)
global_cpp_args = [
'-fpermissive',
@ -31,6 +44,25 @@ global_cpp_args = [
'-pipe', # use pipes instead of temp files between compiler stages
]
if host_machine.system() == 'emscripten'
add_project_arguments(
'-pthread',
language: 'cpp'
)
add_project_link_arguments(
'-sUSE_WEBGL2=1',
'-sLEGACY_GL_EMULATION=1',
'-sALLOW_MEMORY_GROWTH=1',
'-sPTHREAD_POOL_SIZE=4',
'-sERROR_ON_UNDEFINED_SYMBOLS=0',
'-sASSERTIONS=0',
'--use-port=zlib',
'--use-port=sdl2',
language: 'cpp'
)
endif
# global ccp defs type shi
global_cpp_defs = [
'-DSPLIT_SAVES',
@ -41,7 +73,8 @@ global_cpp_defs = [
'-DDEBUG',
]
if host_machine.system() == 'linux'
# DecalOverdose: yes i know it's bad to do this but I don't know a better way to do this.
if host_machine.system() == 'linux' or host_machine.system() == 'emscripten'
global_cpp_defs += [
'-Dlinux',
'-D__linux',

View file

@ -0,0 +1,15 @@
[binaries]
c = 'emcc'
cpp = 'em++'
ar = 'emar'
strip = 'emstrip'
[built-in options]
c_args = []
c_link_args = []
[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'