Browse Source

#第一次提交

master
Administrator 1 year ago
parent
commit
7b143d4887
3 changed files with 7 additions and 5 deletions
  1. +0
    -2
      bin_test/fst.cc
  2. +6
    -2
      cmake-local/openfst.cmake
  3. +1
    -1
      tmp_cmake/helloworld/openfst.cmake

+ 0
- 2
bin_test/fst.cc

@ -21,8 +21,6 @@ int main() {
// 设置终止状态 // 设置终止状态
fst.SetFinal(2, 3.5); // 设置状态2为终止状态,权重为3.5 fst.SetFinal(2, 3.5); // 设置状态2为终止状态,权重为3.5
// 输出 FST 的文本表示
fst.Write("example.fst");
return 0; return 0;
} }

+ 6
- 2
cmake-local/openfst.cmake

@ -1,11 +1,16 @@
# We can't build glog with gflags, unless gflags is pre-installed. # We can't build glog with gflags, unless gflags is pre-installed.
# If build glog with pre-installed gflags, there will be conflict. # If build glog with pre-installed gflags, there will be conflict.
#message(STATUS "${BoldGreen}glog: ${glog_SOURCE_DIR}${ColourReset}")
message(STATUS "${BoldGreen}CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}${ColourReset}")
set(openfst_BUILD "${LIB_BASE_DIR}/openfst-build") set(openfst_BUILD "${LIB_BASE_DIR}/openfst-build")
if(NOT EXISTS ${openfst_BUILD}) if(NOT EXISTS ${openfst_BUILD})
# install openfst # install openfst
#./configure --prefix=${openfst_SOURCE_DIR}/build --enable-static --disable-shared --with-pic #./configure --prefix=${openfst_SOURCE_DIR}/build --enable-static --disable-shared --with-pic
# patchglog
execute_process(
COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/patch/openfst ${LIB_BASE_DIR}/openfst-src
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process( execute_process(
COMMAND ./configure --prefix=${openfst_BUILD} COMMAND ./configure --prefix=${openfst_BUILD}
WORKING_DIRECTORY ${LIB_BASE_DIR}/openfst-src) WORKING_DIRECTORY ${LIB_BASE_DIR}/openfst-src)
@ -50,7 +55,6 @@ include_directories(${LIB_BASE_DIR}/openfst-src/src/include)
message(STATUS "${BoldGreen}openfst_BINARY_DIR: ${openfst_BINARY_DIR}${ColourReset}") message(STATUS "${BoldGreen}openfst_BINARY_DIR: ${openfst_BINARY_DIR}${ColourReset}")
add_dependencies(fst gflags_nothreads_static glog::glog) add_dependencies(fst gflags_nothreads_static glog::glog)
#set_target_properties(fst PROPERTIES COMPILE_FLAGS "-fPIC")
target_link_libraries(fst PUBLIC gflags_nothreads_static glog) target_link_libraries(fst PUBLIC gflags_nothreads_static glog)
list(APPEND third_party_libraries fst) list(APPEND third_party_libraries fst)

+ 1
- 1
tmp_cmake/helloworld/openfst.cmake

@ -33,7 +33,7 @@ if(NOT ANDROID)
URL_HASH SHA256=e04e1dabcecf3a687ace699ccb43a8a27da385777a56e69da6e103344cc66bca URL_HASH SHA256=e04e1dabcecf3a687ace699ccb43a8a27da385777a56e69da6e103344cc66bca
#URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.6.5.1.tar.gz #URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.6.5.1.tar.gz
#URL_HASH SHA256=02c49b559c3976a536876063369efc0e41ab374be1035918036474343877046e #URL_HASH SHA256=02c49b559c3976a536876063369efc0e41ab374be1035918036474343877046e
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/patch/openfst ${openfst_SOURCE_DIR}
PATCH_COMMAND
) )
FetchContent_MakeAvailable(openfst) FetchContent_MakeAvailable(openfst)
add_dependencies(fst gflags glog) add_dependencies(fst gflags glog)

Loading…
Cancel
Save