-cleaned Meson build files and added some comments

This commit is contained in:
Mergul 2021-03-13 20:28:06 +01:00
parent ef12bce88b
commit 3e0ab40977
3 changed files with 11 additions and 1 deletions

View file

@ -9,7 +9,7 @@ external_inc = include_directories('external/sources/')
# Argumesnts # Argumesnts
not_wasm = host_machine.cpu_family() != 'wasm32' not_wasm = host_machine.cpu_family() != 'wasm32'
versions = ['BindSDL_Image','SDL_209', 'BindBC_Static', 'BindSDL_Static', 'MM_USE_POSIX_THREADS', 'ECSEmscripten'] versions = ['BindSDL_Image','SDL_208', 'BindBC_Static', 'BindSDL_Static']
# Dependencies # Dependencies
bindbc_loader_dep = dependency('bindbc-loader') bindbc_loader_dep = dependency('bindbc-loader')
@ -40,6 +40,8 @@ if not_wasm
test('basic-tests', exe) test('basic-tests', exe)
else else
versions += ['MM_USE_POSIX_THREADS', 'ECSEmscripten']
decs_demos_lib = library('decs-demos', [demos_src, external_src], decs_demos_lib = library('decs-demos', [demos_src, external_src],
include_directories : [demos_inc, external_inc], include_directories : [demos_inc, external_inc],
d_module_versions : versions, d_module_versions : versions,
@ -57,6 +59,7 @@ else
build_by_default: true, build_by_default: true,
) )
# build single-threaded demos with HTML output
wasm_web = custom_target('decs-demos-wasm-web', wasm_web = custom_target('decs-demos-wasm-web',
command: [emcc, args_wasm, '--pre-js', packed_assets, '-o', '@OUTPUT@', '@INPUT@'], command: [emcc, args_wasm, '--pre-js', packed_assets, '-o', '@OUTPUT@', '@INPUT@'],
input: [sdl2_lib, ecs_lib, decs_demos_lib, ecs_utils_lib, cimgui_lib], input: [sdl2_lib, ecs_lib, decs_demos_lib, ecs_utils_lib, cimgui_lib],
@ -64,12 +67,14 @@ else
build_by_default: true, build_by_default: true,
) )
# build multi-threded demos with JS output. Custom shellfile detects if web browser threads are enabled and select proper JS and WASM.
wasm_web_mt = custom_target('decs-demos-wasm-web-mt', 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@'], 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], input: [sdl2_lib, ecs_lib, decs_demos_lib, ecs_utils_lib, cimgui_lib],
output: ['ecs_demo_mt.js'], output: ['ecs_demo_mt.js'],
build_by_default: true, build_by_default: true,
) )
summary('decs-demoswasm-index', wasm_web.full_path()) summary('decs-demoswasm-index', wasm_web.full_path())
endif endif

View file

@ -52,10 +52,13 @@ endif
add_global_arguments(args, language : 'd') add_global_arguments(args, language : 'd')
add_global_link_arguments(link_args, language : 'd') add_global_link_arguments(link_args, language : 'd')
versions = []
if host_machine.cpu_family() == 'wasm32' if host_machine.cpu_family() == 'wasm32'
add_global_arguments('--output-bc', language : 'd') # Adding it in cross files breaks linker detection add_global_arguments('--output-bc', language : 'd') # Adding it in cross files breaks linker detection
emcc = find_program('emcc') emcc = find_program('emcc')
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'] 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']
versions = ['ECSEmscripten']
endif endif
@ -64,6 +67,7 @@ threads_dep = dependency('threads')
ecs_lib = library('decs', src, ecs_lib = library('decs', src,
include_directories : [inc], include_directories : [inc],
d_module_versions : versions
) )
decs_dep = declare_dependency( decs_dep = declare_dependency(

View file

@ -20,6 +20,7 @@ if host_machine.cpu_family() != 'wasm32'
else else
tests_lib = library('decs-tests', tests_src, tests_lib = library('decs-tests', tests_src,
include_directories : [inc], include_directories : [inc],
d_module_versions : ['ECSEmscripten'],
) )
wasm_web = custom_target('wasm-web', wasm_web = custom_target('wasm-web',
command: [emcc, args_wasm, '-o', '@OUTPUT@', '@INPUT@'], command: [emcc, args_wasm, '-o', '@OUTPUT@', '@INPUT@'],