From 84821b1f9929d39118725199284f6b77c73c0984 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 6 Dec 2024 10:11:18 +0800 Subject: [PATCH] Fix building node-addon package (#1598) --- .../sherpa_onnx/src/main/cpp/non-streaming-tts.cc | 2 ++ scripts/node-addon-api/CMakeLists.txt | 4 +--- scripts/node-addon-api/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-tts.cc b/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-tts.cc index 67f348e9b..ed1f3afb3 100644 --- a/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-tts.cc +++ b/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-tts.cc @@ -406,7 +406,9 @@ class TtsGenerateWorker : public Napi::AsyncWorker { for (auto d : _this->data_list_) { if (d->cancelled) { +#if __OHOS__ OH_LOG_INFO(LOG_APP, "TtsGenerate is cancelled"); +#endif return 0; } } diff --git a/scripts/node-addon-api/CMakeLists.txt b/scripts/node-addon-api/CMakeLists.txt index b71f7a0d4..4fdffbfc7 100644 --- a/scripts/node-addon-api/CMakeLists.txt +++ b/scripts/node-addon-api/CMakeLists.txt @@ -11,9 +11,7 @@ cmake_policy(SET CMP0042 NEW) project(sherpa-onnx) -set(CMAKE_CXX_STANDARD 14) - -add_definitions(-DNAPI_VERSION=3) +set(CMAKE_CXX_STANDARD 17) include_directories(${CMAKE_JS_INC}) diff --git a/scripts/node-addon-api/package.json b/scripts/node-addon-api/package.json index e7e1727e1..f0bb57d0d 100644 --- a/scripts/node-addon-api/package.json +++ b/scripts/node-addon-api/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Speech-to-text, text-to-speech, and speaker diarization using Next-gen Kaldi without internet connection", "dependencies": { - "cmake-js": "^6.0.0", - "node-addon-api": "^1.1.0", + "cmake-js": "^7.0.0", + "node-addon-api": "^8.3.0", "perf_hooks": "*" }, "scripts": {