[wasm] allows to specify MALLOC setting for wasm build (#7934)

This commit is contained in:
Yulong Wang 2021-06-03 23:08:56 -07:00 committed by GitHub
parent 6a9023f47d
commit 0723d16436
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -51,6 +51,7 @@ set_target_properties(onnxruntime_webassembly PROPERTIES LINK_FLAGS "
-s LLD_REPORT_UNDEFINED \
-s VERBOSE=0 \
-s NO_FILESYSTEM=1 \
-s MALLOC=${onnxruntime_WEBASSEMBLY_MALLOC} \
--no-entry")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")

View file

@ -346,6 +346,8 @@ def parse_arguments():
parser.add_argument(
"--enable_wasm_debug_info", action='store_true',
help="Build WebAssembly with DWARF format debug info")
parser.add_argument(
"--wasm_malloc", default="dlmalloc", help="Specify memory allocator for WebAssembly")
# Arguments needed by CI
parser.add_argument(
@ -750,6 +752,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home
else "ON"),
"-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=" + ("ON" if args.enable_wasm_threads else "OFF"),
"-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=" + ("ON" if args.enable_wasm_debug_info else "OFF"),
"-Donnxruntime_WEBASSEMBLY_MALLOC=" + args.wasm_malloc,
"-Donnxruntime_ENABLE_EAGER_MODE=" + ("ON" if args.build_eager_mode else "OFF"),
]