|
| 1 | +cmake_minimum_required(VERSION 2.8.3) |
| 2 | +project(voicevox) |
| 3 | + |
| 4 | +find_package(catkin REQUIRED |
| 5 | + COMPONENTS |
| 6 | + catkin_virtualenv |
| 7 | +) |
| 8 | + |
| 9 | +catkin_python_setup() |
| 10 | + |
| 11 | +set(INSTALL_DIR ${PROJECT_SOURCE_DIR}) |
| 12 | + |
| 13 | +catkin_package() |
| 14 | + |
| 15 | +find_package(Python3 QUIET COMPONENTS Interpreter) |
| 16 | +if(NOT Python3_FOUND) |
| 17 | + message(WARNING "voicevox requires python3") |
| 18 | + return() |
| 19 | +endif() |
| 20 | +# generate the virtualenv |
| 21 | +find_package(Python3 QUIET COMPONENTS Interpreter) |
| 22 | +if(Python3_FOUND) |
| 23 | + message(STATUS "Found Python: ${Python3_EXECUTABLE}") |
| 24 | + message(STATUS "Python Version: ${Python3_VERSION}") |
| 25 | +endif() |
| 26 | + |
| 27 | +if("$ENV{ROS_DISTRO}" STREQUAL "melodic") |
| 28 | + set(REQUIREMENTS_TXT_FILE requirements_melodic.txt) |
| 29 | +elseif(Python3_VERSION VERSION_LESS "3.12") |
| 30 | + set(REQUIREMENTS_TXT_FILE requirements_noetic.txt) |
| 31 | +else() |
| 32 | + set(REQUIREMENTS_TXT_FILE requirements_python3.12.txt) |
| 33 | +endif() |
| 34 | +catkin_generate_virtualenv( |
| 35 | + INPUT_REQUIREMENTS ${REQUIREMENTS_TXT_FILE} |
| 36 | + PYTHON_INTERPRETER python3 |
| 37 | + USE_SYSTEM_PACKAGES FALSE |
| 38 | + CHECK_VENV FALSE # Default TRUE |
| 39 | +) |
| 40 | + |
| 41 | +add_custom_command( |
| 42 | + OUTPUT voicevox_model_installed |
| 43 | + COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.model |
| 44 | + MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum |
| 45 | + INSTALL_DIR=${INSTALL_DIR} |
| 46 | +) |
| 47 | + |
| 48 | + |
| 49 | +add_custom_command( |
| 50 | + OUTPUT voicevox_core_installed |
| 51 | + COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.core |
| 52 | + MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum |
| 53 | + INSTALL_DIR=${INSTALL_DIR} |
| 54 | +) |
| 55 | + |
| 56 | +add_custom_command( |
| 57 | + OUTPUT voicevox_engine_installed |
| 58 | + COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.engine |
| 59 | + MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum |
| 60 | + INSTALL_DIR=${INSTALL_DIR} |
| 61 | +) |
| 62 | + |
| 63 | +add_custom_command( |
| 64 | + OUTPUT open_jtalk_dic_installed |
| 65 | + COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.open_jtalk_dic |
| 66 | + MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum |
| 67 | + INSTALL_DIR=${INSTALL_DIR} |
| 68 | +) |
| 69 | + |
| 70 | +add_custom_target(all_installed ALL DEPENDS |
| 71 | + voicevox_model_installed |
| 72 | + voicevox_core_installed |
| 73 | + voicevox_engine_installed |
| 74 | + open_jtalk_dic_installed) |
| 75 | + |
| 76 | +file(GLOB NODE_SCRIPTS_FILES node_scripts/*.py) |
| 77 | +catkin_install_python( |
| 78 | + PROGRAMS ${NODE_SCRIPTS_FILES} |
| 79 | + DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/node_scripts/ |
| 80 | +) |
| 81 | +install(DIRECTORY node_scripts/voicevox_engine |
| 82 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/catkin_virtualenv_scripts/ |
| 83 | + USE_SOURCE_PERMISSIONS) |
| 84 | +install(DIRECTORY launch dict |
| 85 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 86 | + USE_SOURCE_PERMISSIONS) |
| 87 | +install(PROGRAMS bin/text2wave |
| 88 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bin) |
| 89 | + |
| 90 | +install(DIRECTORY |
| 91 | + ${INSTALL_DIR}/lib |
| 92 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 93 | + USE_SOURCE_PERMISSIONS) |
0 commit comments