Skip to content

Commit 77f0876

Browse files
committed
Correctly create fst-type object library.
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.
1 parent 6cd219f commit 77f0876

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,22 @@ if(NOT openfst_POPULATED)
6363
set_target_properties(riva_asrlib_openfst PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
6464
target_compile_options(riva_asrlib_openfst PUBLIC -Wno-unused-local-typedefs -Wno-sign-compare -Wno-unused-variable)
6565

66+
add_library(fst-types OBJECT "${openfst_SOURCE_DIR}/src/lib/fst-types.cc")
67+
target_include_directories(fst-types SYSTEM PUBLIC ${openfst_SOURCE_DIR}/src/include/)
68+
set_target_properties(fst-types PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
69+
target_compile_options(fst-types PUBLIC -Wno-unused-local-typedefs -Wno-sign-compare -Wno-unused-variable)
70+
71+
6672
add_library(fstscript_base
67-
SHARED
6873
"${openfst_SOURCE_DIR}/src/script/arciterator-class.cc"
6974
"${openfst_SOURCE_DIR}/src/script/encodemapper-class.cc"
7075
"${openfst_SOURCE_DIR}/src/script/fst-class.cc"
7176
"${openfst_SOURCE_DIR}/src/script/getters.cc"
7277
"${openfst_SOURCE_DIR}/src/script/stateiterator-class.cc"
7378
"${openfst_SOURCE_DIR}/src/script/text-io.cc"
7479
"${openfst_SOURCE_DIR}/src/script/weight-class.cc"
75-
${openfst_SOURCE_DIR}/src/lib/fst-types.cc
76-
# $<TARGET_OBJECTS:openfst-types>
7780
)
78-
target_link_libraries(fstscript_base PUBLIC riva_asrlib_openfst ${CMAKE_DL_LIBS})
81+
target_link_libraries(fstscript_base PUBLIC riva_asrlib_openfst ${CMAKE_DL_LIBS} $<TARGET_OBJECTS:fst-types>)
7982

8083
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)
8184
# decode verify

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def build_extension(self, ext: setuptools.extension.Extension):
6565
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(" ")
6666
fst_binaries.extend(openfst_binaries)
6767
# ERROR to fix: "fstcompose" is used in mkgraph_ctc.sh...
68-
fst_binaries = ["arpa2fst", "fsttablecompose", "fstdeterminizestar", "fstminimizeencoded", "fstarcsort", "fstcompile", "fstaddselfloops", "transcripts-to-fsts"]
68+
fst_binaries = ["arpa2fst", "fsttablecompose", "fstdeterminizestar", "fstminimizeencoded", "fstarcsort", "fstcompile", "fstaddselfloops", "transcripts-to-fsts", "fstconvert"]
6969
build_cmd = f'''
7070
cd {self.build_temp}
7171

0 commit comments

Comments
 (0)