From df7ccaff73468df4874f7228e9123ce2eefd9180 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期五, 15 三月 2024 10:09:05 +0800
Subject: [PATCH] update cmakelist
---
runtime/websocket/CMakeLists.txt | 20 ++++++++++++++------
runtime/websocket/bin/CMakeLists.txt | 5 -----
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/runtime/websocket/CMakeLists.txt b/runtime/websocket/CMakeLists.txt
index ba6497a..da0e6e7 100644
--- a/runtime/websocket/CMakeLists.txt
+++ b/runtime/websocket/CMakeLists.txt
@@ -8,6 +8,10 @@
option(ENABLE_WEBSOCKET "Whether to build websocket server" ON)
option(ENABLE_PORTAUDIO "Whether to build portaudio" ON)
+option(ENABLE_GLOG "Whether to build glog" ON)
+option(ENABLE_FST "Whether to build openfst" ON) # ITN need openfst compiled
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+option(GPU "Whether to build with GPU" OFF)
if(WIN32)
file(REMOVE ${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/glog/src/config.h
@@ -20,12 +24,16 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fPIC")
endif()
-
-
-
-option(ENABLE_GLOG "Whether to build glog" ON)
-option(ENABLE_FST "Whether to build openfst" ON) # ITN need openfst compiled
-option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+if(GPU)
+ add_definitions(-DUSE_GPU)
+ set(TORCH_DIR "/usr/local/lib/python3.8/dist-packages/torch")
+ set(TORCH_BLADE_DIR "/usr/local/lib/python3.8/dist-packages/torch_blade")
+ include_directories(${TORCH_DIR}/include)
+ include_directories(${TORCH_DIR}/include/torch/csrc/api/include)
+ link_directories(${TORCH_DIR}/lib)
+ link_directories(${TORCH_BLADE_DIR})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -D_GLIBCXX_USE_CXX11_ABI=0")
+endif()
if(ENABLE_WEBSOCKET)
# cmake_policy(SET CMP0135 NEW)
diff --git a/runtime/websocket/bin/CMakeLists.txt b/runtime/websocket/bin/CMakeLists.txt
index 3d2a6cf..6ad940d 100644
--- a/runtime/websocket/bin/CMakeLists.txt
+++ b/runtime/websocket/bin/CMakeLists.txt
@@ -1,5 +1,4 @@
-
if(WIN32)
include_directories(${ONNXRUNTIME_DIR}/include)
include_directories(${FFMPEG_DIR}/include)
@@ -11,10 +10,6 @@
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
SET(RELATION_SOURCE "../../onnxruntime/src/resample.cpp" "../../onnxruntime/src/util.cpp" "../../onnxruntime/src/alignedmem.cpp" "../../onnxruntime/src/encode_converter.cpp")
endif()
-
-
-
-
add_executable(funasr-wss-server "funasr-wss-server.cpp" "websocket-server.cpp" ${RELATION_SOURCE})
add_executable(funasr-wss-server-2pass "funasr-wss-server-2pass.cpp" "websocket-server-2pass.cpp" ${RELATION_SOURCE})
--
Gitblit v1.9.1