Skip to content

Commit

Permalink
[ros-o] julius: use system install julius, download dictation and gra…
Browse files Browse the repository at this point in the history
…mmer kit by script
  • Loading branch information
k-okada committed Jan 8, 2025
1 parent eae3584 commit 491f2a9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
15 changes: 15 additions & 0 deletions 3rdparty/julius/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ add_custom_command(
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.dictation-kit MD5SUM_DIR=${MD5SUM_DIR} PATCH_DIR=${PATCH_DIR} INSTALL_DIR=${INSTALL_DIR}
)

# on ROS-O do not download grammer_kit, dictation_kit, instead install download script
if(NOT $ENV{ROS_DISTRO} STREQUAL "debian")
add_custom_target(all_installed ALL DEPENDS julius_installed grammar_kit_installed dictation_kit_installed)

install(DIRECTORY
Expand All @@ -36,3 +38,16 @@ install(DIRECTORY
${INSTALL_DIR}/model
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS)
else()
install(PROGRAMS
download_julius_data.sh
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(FILES
Makefile.grammar-kit
Makefile.dictation-kit
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(FILES
md5sum/dictation-kit-v4.4.zip.md5sum
md5sum/grammar-kit-v4.3.1.tar.gz.md5sum
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/md5sum)
endif()
11 changes: 11 additions & 0 deletions 3rdparty/julius/download_julius_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -xe

SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
MD5SUM_DIR=${SCRIPT_DIR}/md5sum
INSTALL_DIR=$(rospack find julius)

DIR=$(mktemp -d /tmp/julius-XXXX)
cd $DIR
make -f ${SCRIPT_DIR}/Makefile.dictation-kit MD5SUM_DIR=${MD5SUM_DIR} INSTALL_DIR=${INSTALL_DIR}
make -f ${SCRIPT_DIR}/Makefile.grammar-kit MD5SUM_DIR=${MD5SUM_DIR} INSTALL_DIR=${INSTALL_DIR}
rm -fr $DIR
10 changes: 9 additions & 1 deletion julius_ros/scripts/run_julius.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ for OPT in "$@"; do
esac
done

exec rosrun julius julius $ARGS
if [ "$ROS_DISTRO" = "debian" ]; then
if ! test -e $(rospack find julius)/conf -a -e $(rospack find julius)/model; then
echo "julius need install grammer and dictation kit, run 'rosrun julius download_julius_data.sh'"
exit 1
fi
exec julius $ARGS
else
exec rosrun julius julius $ARGS
fi

0 comments on commit 491f2a9

Please sign in to comment.