mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-30 01:08:52 +00:00
84c6b42e65
- update from 3.0 (from 2014) to 3.19 (from 2020) - move some global setting onto the targets (through a cmake include)
50 lines
1.1 KiB
CMake
50 lines
1.1 KiB
CMake
#
|
|
# libstream
|
|
#
|
|
|
|
set(TARGET libstream)
|
|
|
|
add_executable(${TARGET}
|
|
emscripten.cpp
|
|
)
|
|
|
|
include(DefaultTargetOptions)
|
|
|
|
target_link_libraries(${TARGET} PRIVATE
|
|
whisper
|
|
)
|
|
|
|
unset(EXTRA_FLAGS)
|
|
|
|
if (WHISPER_WASM_SINGLE_FILE)
|
|
set(EXTRA_FLAGS "-s SINGLE_FILE=1")
|
|
message(STATUS "Embedding WASM inside stream.js")
|
|
|
|
add_custom_command(
|
|
TARGET ${TARGET} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${CMAKE_BINARY_DIR}/bin/libstream.js
|
|
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/stream.wasm/stream.js
|
|
)
|
|
endif()
|
|
|
|
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
|
|
--bind \
|
|
-s USE_PTHREADS=1 \
|
|
-s PTHREAD_POOL_SIZE=8 \
|
|
-s INITIAL_MEMORY=1024MB \
|
|
-s TOTAL_MEMORY=1024MB \
|
|
-s FORCE_FILESYSTEM=1 \
|
|
-s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
|
|
${EXTRA_FLAGS} \
|
|
")
|
|
|
|
#
|
|
# stream.wasm
|
|
#
|
|
|
|
set(TARGET stream.wasm)
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY)
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../helpers.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/helpers.js @ONLY)
|