2022-10-22 10:07:59 +00:00
|
|
|
set(TARGET libwhisper)
|
|
|
|
|
|
|
|
add_executable(${TARGET}
|
|
|
|
emscripten.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(${TARGET} PRIVATE
|
|
|
|
whisper
|
|
|
|
)
|
|
|
|
|
|
|
|
unset(EXTRA_FLAGS)
|
2022-11-21 20:20:42 +00:00
|
|
|
|
2022-10-22 10:07:59 +00:00
|
|
|
if (WHISPER_WASM_SINGLE_FILE)
|
|
|
|
set(EXTRA_FLAGS "-s SINGLE_FILE=1")
|
|
|
|
message(STATUS "Embedding WASM inside whisper.js")
|
|
|
|
|
|
|
|
add_custom_command(
|
2022-11-21 20:20:42 +00:00
|
|
|
TARGET ${TARGET} POST_BUILD
|
2022-10-22 10:07:59 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_BINARY_DIR}/bin/libwhisper.js
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/whisper.js
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
|
|
|
|
--bind \
|
|
|
|
-s USE_PTHREADS=1 \
|
2022-10-22 13:57:54 +00:00
|
|
|
-s PTHREAD_POOL_SIZE=8 \
|
|
|
|
-s INITIAL_MEMORY=1610612736 \
|
|
|
|
-s TOTAL_MEMORY=1610612736 \
|
2022-10-22 10:07:59 +00:00
|
|
|
-s FORCE_FILESYSTEM=1 \
|
2022-10-22 13:57:54 +00:00
|
|
|
-s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
|
2022-10-22 10:07:59 +00:00
|
|
|
${EXTRA_FLAGS} \
|
|
|
|
")
|