-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dujing
committed
Sep 13, 2023
1 parent
a36f0e8
commit de7872b
Showing
5 changed files
with
392 additions
and
393 deletions.
There are no files selected for viewing
This file contains 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,47 +1,47 @@ | ||
if(NOT ANDROID) | ||
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) | ||
|
||
if(NOT GRAPH_TOOLS) | ||
set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE) | ||
set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE) | ||
endif() | ||
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") | ||
FetchContent_Declare(openfst | ||
URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.7.2.1.tar.gz | ||
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} | ||
) | ||
FetchContent_MakeAvailable(openfst) | ||
add_dependencies(fst gflags glog) | ||
target_link_libraries(fst PUBLIC gflags_nothreads_static glog) | ||
include_directories(${openfst_SOURCE_DIR}/src/include) | ||
else() | ||
set(openfst_BINARY_DIR ${build_DIR}/wenet-openfst-android-1.0.2.aar/jni) | ||
include_directories(${openfst_BINARY_DIR}/include) | ||
link_directories(${openfst_BINARY_DIR}/${ANDROID_ABI}) | ||
link_libraries(log gflags_nothreads glog fst) | ||
endif() | ||
if(NOT ANDROID) | ||
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) | ||
|
||
if(NOT GRAPH_TOOLS) | ||
set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE) | ||
set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE) | ||
endif() | ||
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") | ||
FetchContent_Declare(openfst | ||
URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.7.2.1.tar.gz | ||
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} | ||
) | ||
FetchContent_MakeAvailable(openfst) | ||
add_dependencies(fst gflags glog) | ||
target_link_libraries(fst PUBLIC gflags_nothreads_static glog) | ||
include_directories(${openfst_SOURCE_DIR}/src/include) | ||
else() | ||
set(openfst_BINARY_DIR ${build_DIR}/wenet-openfst-android-1.0.2.aar/jni) | ||
include_directories(${openfst_BINARY_DIR}/include) | ||
link_directories(${openfst_BINARY_DIR}/${ANDROID_ABI}) | ||
link_libraries(log gflags_nothreads glog fst) | ||
endif() |
Oops, something went wrong.