mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-07-23 11:10:57 -05:00
* ci, examples : add package-lock.json to examples addon node This commit commits the package-lock.json file for examples/addon.node. This is needed to make the CI workflow work properly and after we started pinning the action versions in the workflow, the CI started failing because the package-lock.json was not committed. At least that is what I think is happening. * ci: use node 20.x and 22.x instead of 16.x and 18.x * fix CMakeLists.txt target properties for addon.node
35 lines
1.3 KiB
CMake
35 lines
1.3 KiB
CMake
set(TARGET addon.node)
|
|
|
|
# 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 ""
|
|
OUTPUT_NAME "addon"
|
|
SUFFIX ".node"
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Release"
|
|
)
|
|
|
|
# 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} common whisper ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
|
|
# Generate node.lib
|
|
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
|
|
endif()
|