2022-11-21 20:20:42 +00:00
|
|
|
#
|
|
|
|
# libtalk
|
|
|
|
#
|
|
|
|
|
|
|
|
set(TARGET libtalk)
|
|
|
|
|
|
|
|
add_executable(${TARGET}
|
|
|
|
emscripten.cpp
|
2022-11-23 22:08:57 +00:00
|
|
|
gpt-2.cpp
|
2022-11-21 20:20:42 +00:00
|
|
|
)
|
|
|
|
|
2023-01-05 19:22:48 +00:00
|
|
|
include(DefaultTargetOptions)
|
|
|
|
|
2022-11-21 20:20:42 +00:00
|
|
|
target_link_libraries(${TARGET} PRIVATE
|
|
|
|
whisper
|
2023-04-30 15:51:57 +00:00
|
|
|
common
|
2022-11-21 20:20:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
unset(EXTRA_FLAGS)
|
|
|
|
|
|
|
|
if (WHISPER_WASM_SINGLE_FILE)
|
|
|
|
set(EXTRA_FLAGS "-s SINGLE_FILE=1")
|
|
|
|
message(STATUS "Embedding WASM inside talk.js")
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${TARGET} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_BINARY_DIR}/bin/libtalk.js
|
|
|
|
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/talk.wasm/talk.js
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
|
|
|
|
--bind \
|
|
|
|
-s USE_PTHREADS=1 \
|
|
|
|
-s PTHREAD_POOL_SIZE=8 \
|
2023-01-06 19:12:51 +00:00
|
|
|
-s INITIAL_MEMORY=1800MB \
|
|
|
|
-s TOTAL_MEMORY=1800MB \
|
2022-11-21 20:20:42 +00:00
|
|
|
-s FORCE_FILESYSTEM=1 \
|
|
|
|
-s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
|
|
|
|
${EXTRA_FLAGS} \
|
|
|
|
")
|
|
|
|
|
|
|
|
#
|
|
|
|
# talk.wasm
|
|
|
|
#
|
|
|
|
|
|
|
|
set(TARGET talk.wasm)
|
|
|
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY)
|
2022-11-24 21:13:26 +00:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../helpers.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/helpers.js @ONLY)
|