mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-20 21:23:06 +00:00
c306a7fd89
* addon: implement node addon call whisper through cpp * addon: modify the license to MIT * addon: remove iostream * addon: rename dir * addon: fix typo * addon: configure cmake to build when cmake-js is used
27 lines
1.0 KiB
CMake
27 lines
1.0 KiB
CMake
set(TARGET whisper-addon)
|
|
|
|
# Base settings
|
|
#==================================================================
|
|
# env var supported by cmake-js
|
|
add_definitions(-DNAPI_VERSION=4)
|
|
include_directories(${CMAKE_JS_INC})
|
|
#==================================================================
|
|
|
|
add_library(${TARGET} SHARED ${CMAKE_JS_SRC} addon.cpp)
|
|
set_target_properties(${TARGET} PROPERTIES PREFIX "" SUFFIX ".node")
|
|
|
|
include(DefaultTargetOptions)
|
|
|
|
# Include N-API wrappers
|
|
#==================================================================
|
|
execute_process(COMMAND node -p "require('node-addon-api').include"
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
OUTPUT_VARIABLE NODE_ADDON_API_DIR
|
|
)
|
|
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
target_include_directories(${TARGET} PRIVATE ${NODE_ADDON_API_DIR})
|
|
#==================================================================
|
|
|
|
target_link_libraries(${TARGET} ${CMAKE_JS_LIB} whisper ${CMAKE_THREAD_LIBS_INIT})
|