Meson wasm #14
6 changed files with 74 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -9,6 +9,8 @@
|
|||
!skeleton.html
|
||||
!**/meson.build
|
||||
!**/*.wrap
|
||||
!**/*.ini
|
||||
!**/*.sh
|
||||
!meson_options.txt
|
||||
!compile_wasm.py
|
||||
!compile_android.py
|
||||
24
emscripten.ini
Normal file
24
emscripten.ini
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[constants]
|
||||
emscripten_path = '/home/pc/prog/ecs/emsdk/upstream/emscripten'
|
||||
ldc_path = '/home/pc/dlang/ldc-1.25.0/bin'
|
||||
|
||||
[binaries]
|
||||
emcc = emscripten_path / 'emcc'
|
||||
c = emscripten_path / 'emcc'
|
||||
cpp = emscripten_path / 'em++'
|
||||
ar = emscripten_path / 'emar'
|
||||
d = ldc_path / 'ldc2'
|
||||
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
|
||||
|
||||
[built-in options]
|
||||
d_args = ['-mtriple=wasm32-unknown-unknown-wasm', '--d-version=ECSEmscripten']
|
||||
default_library = 'static'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'wasm32'
|
||||
cpu = 'wasm32'
|
||||
endian = 'little'
|
||||
19
install_emscripten.sh
Normal file
19
install_emscripten.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
cd ..
|
||||
# Get the emsdk repo
|
||||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
|
||||
# Enter that directory
|
||||
cd emsdk
|
||||
|
||||
# Fetch the latest version of the emsdk (not needed the first time you clone)
|
||||
git pull
|
||||
|
||||
# Download and install the latest SDK tools.
|
||||
./emsdk install latest
|
||||
|
||||
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
|
||||
./emsdk activate latest
|
||||
|
||||
# Activate PATH and other environment variables in the current terminal
|
||||
source ./emsdk_env.sh
|
||||
|
||||
|
|
@ -50,11 +50,15 @@ endif
|
|||
add_global_arguments(args, language : 'd')
|
||||
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
|
||||
endif
|
||||
|
||||
|
||||
# Dependencies
|
||||
threads_dep = dependency('threads')
|
||||
|
||||
ecs_lib = library('decs',
|
||||
src,
|
||||
ecs_lib = library('decs', src,
|
||||
include_directories : [inc],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
option('betterC', type: 'boolean', value: true)
|
||||
option('BuildDemos', type: 'boolean', value: true)
|
||||
option('BuildDemos', type: 'boolean', value: false)
|
||||
option('LTO', type: 'boolean', value: false)
|
||||
|
|
@ -2,12 +2,26 @@ tests_src = files(
|
|||
'tests.d',
|
||||
)
|
||||
|
||||
exe = executable('decs-tests',
|
||||
tests_src,
|
||||
include_directories : [inc],
|
||||
d_args : args,
|
||||
link_args : link_args,
|
||||
dependencies : decs_dep,
|
||||
)
|
||||
|
||||
test('basic-tests', exe)
|
||||
if host_machine.cpu_family() != 'wasm32'
|
||||
exe = executable('decs-tests', tests_src,
|
||||
include_directories : [inc],
|
||||
dependencies : decs_dep,
|
||||
)
|
||||
|
||||
test('basic-tests', exe)
|
||||
else
|
||||
tests_lib = library('decs-tests', tests_src,
|
||||
include_directories : [inc],
|
||||
)
|
||||
emcc = find_program('emcc')
|
||||
args_wasm_web = ['-v', '-s', 'ALLOW_MEMORY_GROWTH=1', '-s', 'WASM_MEM_MAX=1024MB', '-s', 'MALLOC=dlmalloc', '-s', 'WASM=1']
|
||||
wasm_web = custom_target('wasm-web',
|
||||
command: [emcc, args_wasm_web, '-o', '@OUTPUT@', '@INPUT@'],
|
||||
input: [ecs_lib, tests_lib],
|
||||
output: ['index.html'],
|
||||
build_by_default: true,
|
||||
)
|
||||
summary('wasm-index', wasm_web.full_path())
|
||||
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue