cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
project(wenet VERSION 0.1)
|
|
# 测试模块参数设置
|
|
option(GRPC "build with gRPC" OFF)
|
|
option(GLOGS "build with GLOGS" OFF)
|
|
option(ONNX "build with ONNX" OFF)
|
|
option(OPENFST "build with FST" ON)
|
|
option(CLEAN_CMAKE_CACHE "更换Build目录运行需要清空缓存" OFF)
|
|
|
|
|
|
# set color
|
|
string(ASCII 27 Esc)
|
|
set(ColourReset "${Esc}[m")
|
|
set(BoldGreen "${Esc}[1;32m")
|
|
set(Red "${Esc}[31m")
|
|
|
|
include(FetchContent)
|
|
set(FETCHCONTENT_QUIET OFF)
|
|
set(third_party_libraries)
|
|
set(LIB_BASE_DIR /root/projects/temp_xiaoke/asr_runtime/lib_files)
|
|
set(FETCHCONTENT_BASE_DIR ${LIB_BASE_DIR})
|
|
#清空缓存
|
|
if(CLEAN_CMAKE_CACHE)
|
|
message(STATUS "Cleaning CMakeCache.txt")
|
|
execute_process(
|
|
COMMAND find . -name "CMake*" -exec rm -rf {} \;
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
endif ()
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-linux)
|
|
if(GLOGS)
|
|
include(gflags)
|
|
include(glog)
|
|
add_executable(glog_main "glogs.cc")
|
|
target_link_libraries(glog_main ${third_party_libraries})
|
|
endif()
|
|
if(GRPC)
|
|
include(grpc)
|
|
add_subdirectory(bin_grpc)
|
|
endif()
|
|
|
|
if(ONNX)
|
|
include(onnx)
|
|
add_executable(onnx_main "onnx.cc")
|
|
target_link_libraries(onnx_main PRIVATE ${third_party_libraries})
|
|
endif()
|
|
if(OPENFST)
|
|
include(openfst)
|
|
add_executable(fst_main bin_test_env/fst.cc)
|
|
target_link_libraries(fst_main PRIVATE ${third_party_libraries})
|
|
endif()
|