From 1254a990f1c6a71bcfac175e935b019b38d6988b Mon Sep 17 00:00:00 2001 From: Mergul Date: Sat, 13 Mar 2021 15:04:42 +0100 Subject: [PATCH] -added compilation for multithreaded and singlethreaded code -fixed problem with assets loading --- demos/meson.build | 11 +++++++++-- meson.build | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/demos/meson.build b/demos/meson.build index 0d9df2a..7cc6383 100644 --- a/demos/meson.build +++ b/demos/meson.build @@ -9,7 +9,7 @@ external_inc = include_directories('external/sources/') # Argumesnts not_wasm = host_machine.cpu_family() != 'wasm32' -versions = ['BindSDL_Image','SDL_208', 'BindBC_Static', 'BindSDL_Static'] +versions = ['BindSDL_Image','SDL_209', 'BindBC_Static', 'BindSDL_Static', 'MM_USE_POSIX_THREADS', 'ECSEmscripten'] # Dependencies bindbc_loader_dep = dependency('bindbc-loader') @@ -60,7 +60,14 @@ else wasm_web = custom_target('decs-demos-wasm-web', command: [emcc, args_wasm, '--pre-js', packed_assets, '-o', '@OUTPUT@', '@INPUT@'], input: [sdl2_lib, ecs_lib, decs_demos_lib, ecs_utils_lib, cimgui_lib], - output: ['game.html'], + output: ['ecs_demo.html'], + build_by_default: true, + ) + + wasm_web_mt = custom_target('decs-demos-wasm-web-mt', + command: [emcc, args_wasm, '-s', 'USE_PTHREADS=1', '--pre-js', packed_assets, '-o', '@OUTPUT@', '@INPUT@'], + input: [sdl2_lib, ecs_lib, decs_demos_lib, ecs_utils_lib, cimgui_lib], + output: ['ecs_demo_mt.js'], build_by_default: true, ) summary('decs-demoswasm-index', wasm_web.full_path()) diff --git a/meson.build b/meson.build index 279bbb6..28f2458 100644 --- a/meson.build +++ b/meson.build @@ -53,7 +53,7 @@ add_global_link_arguments(link_args, language : 'd') if host_machine.cpu_family() == 'wasm32' add_global_arguments('--output-bc', language : 'd') # Adding it in cross files breaks linker detection emcc = find_program('emcc') - args_wasm = ['-s', 'FORCE_FILESYSTEM=1','-s', 'USE_PTHREADS=1', '-s', 'USE_SDL=2', '-s', 'ALLOW_MEMORY_GROWTH=1', '-s', 'WASM_MEM_MAX=1024MB', '-s', 'MALLOC=dlmalloc', '-s', 'WASM=1'] + args_wasm = ['-O3', '-s', 'FORCE_FILESYSTEM=1', '-s', 'USE_SDL=2', '-s', 'USE_SDL_IMAGE=2', '-s', 'SDL2_IMAGE_FORMATS=["png"]', '-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0', '-s', 'ALLOW_MEMORY_GROWTH=1', '-s', 'WASM_MEM_MAX=1024MB', '-s', 'MALLOC=dlmalloc', '-s', 'WASM=1', '--shell-file', '../demos/emscripten_multi_shell.html', '-s', 'DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1'] endif