@@ -5,53 +5,25 @@ if(NOT ANDROID)
55 set (WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE )
66 include (glog )
77
8- set (CONFIG_FLAGS "" )
9- if (NOT FST_HAVE_BIN)
10- if (MSVC )
11- set (HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE )
12- else ()
13- set (CONFIG_FLAGS "--disable-bin" )
14- endif ()
15- endif ()
16-
17- if (MSVC )
18- set (HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE )
19- set (HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE )
20- set (HAVE_CONST OFF CACHE BOOL "Build const" FORCE )
21- set (HAVE_GRM OFF CACHE BOOL "Build grm" FORCE )
22- set (HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE )
23- set (HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE )
24- set (HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE )
25- set (HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE )
26- set (HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE )
27- set (HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE )
8+ if (NOT GRAPH_TOOLS)
9+ set (HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE )
2810 endif ()
11+ set (HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE )
12+ set (HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE )
13+ set (HAVE_CONST OFF CACHE BOOL "Build const" FORCE )
14+ set (HAVE_GRM OFF CACHE BOOL "Build grm" FORCE )
15+ set (HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE )
16+ set (HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE )
17+ set (HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE )
18+ set (HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE )
19+ set (HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE )
20+ set (HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE )
2921
3022 # The original openfst uses GNU Build System to run configure and build.
3123 # So, we use "OpenFST port for Windows" to build openfst with cmake in Windows.
3224 # Openfst is compiled with glog/gflags to avoid log and flag conflicts with log and flags in wenet/libtorch.
3325 # To build openfst with gflags and glog, we comment out some vars of {flags, log}.h and flags.cc.
3426 set (openfst_SOURCE_DIR ${fc_base} /openfst-src CACHE PATH "OpenFST source directory" )
35- set (openfst_BINARY_DIR ${fc_base} /openfst-build CACHE PATH "OpenFST build directory" )
36- set (openfst_PREFIX_DIR ${fc_base} /openfst-subbuild/openfst-populate-prefix CACHE PATH "OpenFST prefix directory" )
37- if (NOT MSVC )
38- ExternalProject_Add (openfst
39- URL https://github.com/mjansche/openfst/archive/1.6.5.zip
40- URL_HASH SHA256=b720357a464f42e181d7e33f60867b54044007f50baedc8f4458a3926f4a5a78
41- PREFIX ${openfst_PREFIX_DIR}
42- SOURCE_DIR ${openfst_SOURCE_DIR}
43- BINARY_DIR ${openfst_BINARY_DIR}
44- CONFIGURE_COMMAND ${openfst_SOURCE_DIR} /configure ${CONFIG_FLAGS} --prefix =${openfst_PREFIX_DIR}
45- "CPPFLAGS=-I${gflags_BINARY_DIR} /include -I${glog_SOURCE_DIR} /src -I${glog_BINARY_DIR} ${TORCH_CXX_FLAGS} "
46- "LDFLAGS=-L${gflags_BINARY_DIR} -L${glog_BINARY_DIR} "
47- "LIBS=-lgflags_nothreads -lglog -lpthread"
48- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} /patch/openfst ${openfst_SOURCE_DIR}
49- BUILD_COMMAND make -j$(nproc)
50- )
51- add_dependencies (openfst gflags glog )
52- link_directories (${openfst_PREFIX_DIR} /lib )
53- else ()
54- add_compile_options (/W0 /wd4244 /wd4267 )
5527 FetchContent_Declare (openfst
5628 URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.6.5.1.tar.gz
5729 URL_HASH SHA256=02c49b559c3976a536876063369efc0e41ab374be1035918036474343877046e
@@ -60,7 +32,6 @@ if(NOT ANDROID)
6032 FetchContent_MakeAvailable (openfst)
6133 add_dependencies (fst gflags glog )
6234 target_link_libraries (fst PUBLIC gflags_nothreads_static glog )
63- endif ()
6435 include_directories (${openfst_SOURCE_DIR} /src/include )
6536else ()
6637 set (openfst_BINARY_DIR ${build_DIR} /wenet-openfst-android -1.0.2.aar/jni)
0 commit comments