addon: adapt to compile on Windows

pull/468/head
chenqianhe 2 years ago
parent 015afc6027
commit d1015ba960
No known key found for this signature in database
GPG Key ID: 1AC9D28A999EC1DA

@ -24,3 +24,8 @@ target_include_directories(${TARGET} PRIVATE ${NODE_ADDON_API_DIR})
#================================================================== #==================================================================
target_link_libraries(${TARGET} ${CMAKE_JS_LIB} whisper ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${TARGET} ${CMAKE_JS_LIB} 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()

@ -1,3 +1,4 @@
#include <cstdint>
#include <string> #include <string>
#include <thread> #include <thread>
#include <vector> #include <vector>
@ -398,9 +399,9 @@ Napi::Object whisper(const Napi::CallbackInfo& info) {
} }
Napi::Object res = Napi::Array::New(env, result.size()); Napi::Object res = Napi::Array::New(env, result.size());
for (u_int32_t i = 0; i < result.size(); ++i) { for (uint64_t i = 0; i < result.size(); ++i) {
Napi::Object tmp = Napi::Array::New(env, 3); Napi::Object tmp = Napi::Array::New(env, 3);
for (u_int32_t j = 0; j < 3; ++j) { for (uint64_t j = 0; j < 3; ++j) {
tmp[j] = Napi::String::New(env, result[i][j]); tmp[j] = Napi::String::New(env, result[i][j]);
} }
res[i] = tmp; res[i] = tmp;

Loading…
Cancel
Save