mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
infra wasm: migrate wasm into bindings.
This commit is contained in:
parent
1267a9d718
commit
6ab32cae0b
8 changed files with 34 additions and 26 deletions
18
meson.build
18
meson.build
|
@ -83,6 +83,10 @@ if get_option('bindings').contains('capi') == true
|
|||
config_h.set10('THORVG_CAPI_BINDING_SUPPORT', true)
|
||||
endif
|
||||
|
||||
if get_option('bindings').contains('wasm') == true
|
||||
config_h.set10('THORVG_WASM_BINDING_SUPPORT', true)
|
||||
endif
|
||||
|
||||
#Log
|
||||
if get_option('log') == true
|
||||
config_h.set10('THORVG_LOG_ENABLED', true)
|
||||
|
@ -126,12 +130,13 @@ Summary:
|
|||
Loader (WEBP_BETA): @10@
|
||||
Loader (LOTTIE_BETA): @11@
|
||||
Saver (TVG): @12@
|
||||
CAPI Binding: @13@
|
||||
Log Message: @14@
|
||||
Tests: @15@
|
||||
Examples: @16@
|
||||
Tool (Svg2Tvg): @17@
|
||||
Tool (Svg2Png): @18@
|
||||
Binding (CAPI): @13@
|
||||
Binding (WASM): @14@
|
||||
Log Message: @15@
|
||||
Tests: @16@
|
||||
Examples: @17@
|
||||
Tool (Svg2Tvg): @18@
|
||||
Tool (Svg2Png): @19@
|
||||
|
||||
'''.format(
|
||||
meson.project_version(),
|
||||
|
@ -148,6 +153,7 @@ Summary:
|
|||
get_option('loaders').contains('lottie_beta'),
|
||||
all_savers or get_option('savers').contains('tvg'),
|
||||
get_option('bindings').contains('capi'),
|
||||
get_option('bindings').contains('wasm'),
|
||||
get_option('log'),
|
||||
get_option('tests'),
|
||||
get_option('examples'),
|
||||
|
|
|
@ -23,7 +23,7 @@ option('vector',
|
|||
|
||||
option('bindings',
|
||||
type: 'array',
|
||||
choices: ['', 'capi'],
|
||||
choices: ['', 'capi', 'wasm'],
|
||||
value: [''],
|
||||
description: 'Enable API bindings')
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
if get_option('bindings').contains('capi') == true
|
||||
subdir('capi')
|
||||
endif
|
||||
|
||||
if get_option('bindings').contains('wasm') == true
|
||||
subdir('wasm')
|
||||
endif
|
||||
|
|
13
src/bindings/wasm/meson.build
Normal file
13
src/bindings/wasm/meson.build
Normal file
|
@ -0,0 +1,13 @@
|
|||
if (cc.get_id() == 'emscripten')
|
||||
source_file = files('tvgWasm.cpp')
|
||||
thorvg_wasm_dep = declare_dependency(include_directories
|
||||
: include_directories('.'), sources
|
||||
: source_file)
|
||||
executable('thorvg-wasm',
|
||||
[],
|
||||
include_directories : headers,
|
||||
dependencies : [thorvg_lib_dep, thorvg_wasm_dep],
|
||||
)
|
||||
else
|
||||
message('wasm compiler is not the emscripten!')
|
||||
endif
|
|
@ -60,16 +60,6 @@ thorvg_lib = library(
|
|||
override_options : override_options
|
||||
)
|
||||
|
||||
if (cc.get_id() == 'emscripten')
|
||||
subdir('wasm')
|
||||
|
||||
executable('thorvg-wasm',
|
||||
[],
|
||||
include_directories : headers,
|
||||
dependencies : [thorvg_lib_dep, thorvg_wasm_dep],
|
||||
)
|
||||
endif
|
||||
|
||||
pkg_mod = import('pkgconfig')
|
||||
|
||||
pkg_mod.generate(
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
source_file = files('thorvgwasm.cpp')
|
||||
|
||||
thorvg_wasm_dep = declare_dependency(include_directories
|
||||
: include_directories('.'), sources
|
||||
: source_file)
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#https://github.com/thorvg/thorvg/wiki/ThorVG-Viewer-Development-Guide
|
||||
|
||||
if [ ! -d "./build_wasm" ]; then
|
||||
sed "s|EMSDK:|$1|g" wasm_cross.txt > /tmp/.wasm_cross.txt
|
||||
meson -Db_lto=true -Ddefault_library=static -Dstatic=true -Dloaders="all, lottie_beta" -Dsavers="all" -Dlog=true --cross-file /tmp/.wasm_cross.txt build_wasm
|
||||
meson -Db_lto=true -Ddefault_library=static -Dstatic=true -Dloaders="all, lottie_beta" -Dsavers="all" -Dbindings="wasm" -Dlog=true --cross-file /tmp/.wasm_cross.txt build_wasm
|
||||
cp ./test/wasm/wasm_test.html build_wasm/src/index.html
|
||||
fi
|
||||
|
||||
ninja -C build_wasm/
|
||||
echo "RESULT:"
|
||||
echo " thorvg-wasm.wasm and thorvg-wasm.js can be found in build_wasm/src folder"
|
||||
ls -lrt build_wasm/src/thorvg-wasm.*
|
||||
ls -lrt build_wasm/src/bindings/wasm/thorvg-wasm.*
|
||||
|
|
Loading…
Add table
Reference in a new issue