Test using sherpa-onnx as a cmake subproject (#1961)
This commit is contained in:
17
.github/scripts/as-cmake-sub-project/CMakeLists.txt
vendored
Normal file
17
.github/scripts/as-cmake-sub-project/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
|
||||
project(use-of-sherpa-onnx-as-a-sub-project)
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx/setup.py")
|
||||
message(FATAL_ERROR "Please download the source code of sherpa-onnx and put it inside this directory")
|
||||
endif()
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
include_directories(./sherpa-onnx)
|
||||
add_subdirectory(./sherpa-onnx)
|
||||
|
||||
add_executable(main main.cc)
|
||||
target_link_libraries(main sherpa-onnx-core)
|
||||
10
.github/scripts/as-cmake-sub-project/main.cc
vendored
Normal file
10
.github/scripts/as-cmake-sub-project/main.cc
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "sherpa-onnx/csrc/offline-recognizer.h"
|
||||
#include "sherpa-onnx/csrc/parse-options.h"
|
||||
|
||||
int main(int32_t argc, char *argv[]) {
|
||||
sherpa_onnx::ParseOptions po("help info");
|
||||
sherpa_onnx::OfflineRecognizerConfig config;
|
||||
config.Register(&po);
|
||||
po.PrintUsage();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user