Replies: 5 comments
-
emscripten cmake project: set (DECODER_WASM_SOURCES
${MESHOPT_DIR}/src/indexcodec.cpp
${MESHOPT_DIR}
/src/vertexcodec.cpp
${MESHOPT_DIR}/tools/wasmstubs.cpp
)
set (DECODER_WASM_EXPORTS
# allocator
_malloc
_free
# decoder
_meshopt_decodeIndexBuffer
_meshopt_decodeVertexBuffer
)
# add prefix to exports
foreach (WASM_EXPORT ${DECODER_WASM_EXPORTS})
set (WASM_EXPORT "'${WASM_EXPORT}'")
list (APPEND DECODE_EXPORTS ${WASM_EXPORT})
endforeach ()
string (REPLACE ";" "," DECODE_EXPORTS "${DECODE_EXPORTS}")
set (CXX_OPTIONS "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops ")
set (LINK_OPTIONS "--bind --allow-undefined -Wl,-s -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=\"[${DECODE_EXPORTS}]\" -s EXPORTED_RUNTIME_METHODS=\"['ccall', 'cwrap']\"")
add_executable(decoder ${DECODER_WASM_SOURCES})
target_include_directories(decoder
PRIVATE
${CMAKE_SOURCE_DIR}/src
${MESHOPT_DIR}/src
)
set_target_properties(decoder PROPERTIES COMPILE_FLAGS ${CXX_OPTIONS})
set_target_properties(decoder PROPERTIES LINK_FLAGS ${LINK_OPTIONS})
set_target_properties(decoder PROPERTIES OUTPUT_NAME "decoder.wasm") |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
LINK_OPTIONS also needs to add |
Beta Was this translation helpful? Give feedback.
-
ems1: compile_flags: "-O3 -DNDEBUG" link_flags: "-g --bind --allow-undefined -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems2: compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops" link_flags: "-g --bind --allow-undefined -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems3: compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops" link_flags: "-g --bind --allow-undefined -Wl,-s -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems4 (release): compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops -fno-exceptions -fno-rtti" link_flags: "
|
Beta Was this translation helpful? Give feedback.
-
Flagsems1:compile_flags: "-O3 -DNDEBUG" link_flags: "-g --bind --allow-undefined -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems2:compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops" link_flags: "-g --bind --allow-undefined -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems3:compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops" link_flags: "-g --bind --allow-undefined -Wl,-s -Wl,--no-entry -s TOTAL_MEMORY=128MB --stack-size=32768 -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=2 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="[${DECODE_EXPORTS}]" -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']"" ems4 (release):compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops -fno-exceptions -fno-rtti" link_flags: " ems5 (release):compile_flags: "-O3 -DNDEBUG -nostartfiles -nostdlib -fno-vectorize -fno-unroll-loops -fno-exceptions -fno-rtti" link_flags: "-O3 summary
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Meshoptimizer decoder wasm package
meshoptimizer repo
emscripten (-s):
wasi sdk:
Beta Was this translation helpful? Give feedback.
All reactions