-
Notifications
You must be signed in to change notification settings - Fork 102
[runtime] use fst instead of far #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,36 @@ | ||
| include(gflags) | ||
| # We can't build glog with gflags, unless gflags is pre-installed. | ||
| # If build glog with pre-installed gflags, there will be conflict. | ||
| set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE) | ||
| include(glog) | ||
|
|
||
| set(CONFIG_FLAGS "") | ||
| if(NOT FST_HAVE_BIN) | ||
| set(CONFIG_FLAGS "--disable-bin") | ||
| set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE) | ||
| set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE) | ||
| set(HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE) | ||
| set(HAVE_CONST OFF CACHE BOOL "Build const" FORCE) | ||
| set(HAVE_GRM OFF CACHE BOOL "Build grm" FORCE) | ||
| set(HAVE_FAR OFF CACHE BOOL "Build far" FORCE) | ||
| set(HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE) | ||
| set(HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE) | ||
| set(HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE) | ||
| set(HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE) | ||
| set(HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE) | ||
| set(HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE) | ||
|
|
||
| if(MSVC) | ||
| add_compile_options(/W0 /wd4244 /wd4267) | ||
| endif() | ||
|
|
||
| # "OpenFST port for Windows" builds openfst with cmake for multiple platforms. | ||
| # Openfst is compiled with glog/gflags to avoid log and flag conflicts with log and flags in wenet/libtorch. | ||
| # To build openfst with gflags and glog, we comment out some vars of {flags, log}.h and flags.cc. | ||
| set(openfst_SOURCE_DIR ${fc_base}/openfst-src CACHE PATH "OpenFST source directory") | ||
| set(openfst_PREFIX_DIR ${fc_base}/openfst-subbuild/openfst-populate-prefix CACHE PATH "OpenFST prefix directory") | ||
| ExternalProject_Add(openfst | ||
| URL https://github.com/mjansche/openfst/archive/1.7.2.zip | ||
| URL_HASH MD5=96656fee440ee2d71006a4900ef9ac00 | ||
| PREFIX ${openfst_PREFIX_DIR} | ||
| SOURCE_DIR ${openfst_SOURCE_DIR} | ||
| CONFIGURE_COMMAND ${openfst_SOURCE_DIR}/configure ${CONFIG_FLAGS} --enable-far --prefix=${openfst_PREFIX_DIR} | ||
| "CPPFLAGS=-I${gflags_BINARY_DIR}/include -I${glog_SOURCE_DIR}/src -I${glog_BINARY_DIR}" | ||
| "LDFLAGS=-L${gflags_BINARY_DIR} -L${glog_BINARY_DIR}" | ||
| "LIBS=-lgflags_nothreads -lglog -lpthread" | ||
| COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/patch/openfst ${openfst_SOURCE_DIR} | ||
| BUILD_COMMAND make -j$(nproc) | ||
| FetchContent_Declare(openfst | ||
| URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.7.2.1.tar.gz | ||
| URL_HASH SHA256=e04e1dabcecf3a687ace699ccb43a8a27da385777a56e69da6e103344cc66bca | ||
| PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/patch/openfst ${openfst_SOURCE_DIR} | ||
| ) | ||
| add_dependencies(openfst gflags glog) | ||
| link_directories(${openfst_PREFIX_DIR}/lib) | ||
| FetchContent_MakeAvailable(openfst) | ||
| add_dependencies(fst gflags glog) | ||
| target_link_libraries(fst PUBLIC gflags_nothreads_static glog) | ||
| include_directories(${openfst_SOURCE_DIR}/src/include) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.