diff --git a/bin_test/fst.cc b/bin_test/fst.cc index 5364d29..92ab5e8 100644 --- a/bin_test/fst.cc +++ b/bin_test/fst.cc @@ -21,8 +21,6 @@ int main() { // 设置终止状态 fst.SetFinal(2, 3.5); // 设置状态2为终止状态,权重为3.5 - // 输出 FST 的文本表示 - fst.Write("example.fst"); return 0; } \ No newline at end of file diff --git a/cmake-local/openfst.cmake b/cmake-local/openfst.cmake index f6d5892..c404422 100644 --- a/cmake-local/openfst.cmake +++ b/cmake-local/openfst.cmake @@ -1,11 +1,16 @@ # We can't build glog with gflags, unless gflags is pre-installed. # 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") if(NOT EXISTS ${openfst_BUILD}) # install openfst #./configure --prefix=${openfst_SOURCE_DIR}/build --enable-static --disable-shared --with-pic + # patch补丁必须打,不然会报glog无法动态识别这个库的方法,导致链接不成功。 + 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( COMMAND ./configure --prefix=${openfst_BUILD} 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}") 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) list(APPEND third_party_libraries fst) \ No newline at end of file diff --git a/tmp_cmake/helloworld/openfst.cmake b/tmp_cmake/helloworld/openfst.cmake index ac6f952..917f7bd 100644 --- a/tmp_cmake/helloworld/openfst.cmake +++ b/tmp_cmake/helloworld/openfst.cmake @@ -33,7 +33,7 @@ if(NOT ANDROID) URL_HASH SHA256=e04e1dabcecf3a687ace699ccb43a8a27da385777a56e69da6e103344cc66bca #URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.6.5.1.tar.gz #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) add_dependencies(fst gflags glog)