Skip to content

Commit

Permalink
Correctly create fst-type object library.
Browse files Browse the repository at this point in the history
This allows me to remove the SHARED library fstscript_base, which is not
correctly copied into the created wheel.

Con is that total size of the built project increases.

Also create fstconvert, which is used in graph construction.
  • Loading branch information
galv committed Aug 5, 2022
1 parent 6cd219f commit 77f0876
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,22 @@ if(NOT openfst_POPULATED)
set_target_properties(riva_asrlib_openfst PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_compile_options(riva_asrlib_openfst PUBLIC -Wno-unused-local-typedefs -Wno-sign-compare -Wno-unused-variable)

add_library(fst-types OBJECT "${openfst_SOURCE_DIR}/src/lib/fst-types.cc")
target_include_directories(fst-types SYSTEM PUBLIC ${openfst_SOURCE_DIR}/src/include/)
set_target_properties(fst-types PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_compile_options(fst-types PUBLIC -Wno-unused-local-typedefs -Wno-sign-compare -Wno-unused-variable)


add_library(fstscript_base
SHARED
"${openfst_SOURCE_DIR}/src/script/arciterator-class.cc"
"${openfst_SOURCE_DIR}/src/script/encodemapper-class.cc"
"${openfst_SOURCE_DIR}/src/script/fst-class.cc"
"${openfst_SOURCE_DIR}/src/script/getters.cc"
"${openfst_SOURCE_DIR}/src/script/stateiterator-class.cc"
"${openfst_SOURCE_DIR}/src/script/text-io.cc"
"${openfst_SOURCE_DIR}/src/script/weight-class.cc"
${openfst_SOURCE_DIR}/src/lib/fst-types.cc
# $<TARGET_OBJECTS:openfst-types>
)
target_link_libraries(fstscript_base PUBLIC riva_asrlib_openfst ${CMAKE_DL_LIBS})
target_link_libraries(fstscript_base PUBLIC riva_asrlib_openfst ${CMAKE_DL_LIBS} $<TARGET_OBJECTS:fst-types>)

foreach(operation arcsort closure compile concat connect convert decode determinize disambiguate encode epsnormalize equal equivalent invert isomorphic map minimize project prune push randequivalent randgen relabel replace reverse reweight synchronize topsort union)
# decode verify
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def build_extension(self, ext: setuptools.extension.Extension):
fst_binaries = "arpa2fst arpa-to-const-arpa fstdeterminizestar fstrmsymbols fstisstochastic fstminimizeencoded fstmakecontextfst fstmakecontextsyms fstaddsubsequentialloop fstaddselfloops fstrmepslocal fstcomposecontext fsttablecompose fstrand fstdeterminizelog fstphicompose fstcopy fstpushspecial fsts-to-transcripts fsts-project fsts-union fsts-concat transcripts-to-fsts".split(" ")
fst_binaries.extend(openfst_binaries)
# ERROR to fix: "fstcompose" is used in mkgraph_ctc.sh...
fst_binaries = ["arpa2fst", "fsttablecompose", "fstdeterminizestar", "fstminimizeencoded", "fstarcsort", "fstcompile", "fstaddselfloops", "transcripts-to-fsts"]
fst_binaries = ["arpa2fst", "fsttablecompose", "fstdeterminizestar", "fstminimizeencoded", "fstarcsort", "fstcompile", "fstaddselfloops", "transcripts-to-fsts", "fstconvert"]
build_cmd = f'''
cd {self.build_temp}
Expand Down

0 comments on commit 77f0876

Please sign in to comment.