diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62e159b85..91b99edca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -436,10 +436,6 @@ jobs: rm -rf download/${{ env.VOICEVOX_CORE_ASSET_NAME }} rm download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip - - name: Copy VOICEVOX Core Models - run: | - cp -r download/core/model ./ - - name: Generate licenses.json run: | OUTPUT_LICENSE_JSON_PATH=engine_manifest_assets/dependency_licenses.json \ @@ -467,6 +463,7 @@ jobs: LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.so fi + CORE_MODEL_DIR_PATH="download/core/model" \ LIBCORE_PATH="$LIBCORE_PATH" \ LIBONNXRUNTIME_PATH="$LIBONNXRUNTIME_PATH" \ pyinstaller --noconfirm run.spec diff --git a/README.md b/README.md index e63e68a6d..ad7eb2a0d 100644 --- a/README.md +++ b/README.md @@ -492,10 +492,14 @@ python -m pip install -r requirements-dev.txt OUTPUT_LICENSE_JSON_PATH=licenses.json \ bash build_util/create_venv_and_generate_licenses.bash -# ビルド自体はLIBCORE_PATH及びLIBONNXRUNTIME_PATHの指定がなくても可能です +# モックでビルドする場合 +pyinstaller --noconfirm run.spec + +# 製品版でビルドする場合 +CORE_MODEL_DIR_PATH="/path/to/core_model" \ LIBCORE_PATH="/path/to/libcore" \ - LIBONNXRUNTIME_PATH="/path/to/libonnxruntime" \ - pyinstaller --noconfirm run.spec +LIBONNXRUNTIME_PATH="/path/to/libonnxruntime" \ +pyinstaller --noconfirm run.spec ``` ## 依存関係 diff --git a/run.spec b/run.spec index e77c68614..b84c82408 100644 --- a/run.spec +++ b/run.spec @@ -12,10 +12,16 @@ datas = [ ('presets.yaml', '.'), ('default_setting.yml', '.'), ('ui_template', 'ui_template'), - ('model', 'model'), ] datas += collect_data_files('pyopenjtalk') +core_model_dir_path = os.environ.get('CORE_MODEL_DIR_PATH') +if core_model_dir_path: + print('CORE_MODEL_DIR_PATH is found:', core_model_dir_path) + if not os.path.isdir(core_model_dir_path): + raise Exception("CORE_MODEL_DIR_PATH was found, but it is not directory!") + datas += [(core_model_dir_path, "model")] + # コアとONNX Runtimeはバイナリであるが、`binaries`に加えると # 依存関係のパスがPyInstallerに書き換えらるので、`datas`に加える # 参考: https://github.com/VOICEVOX/voicevox_engine/pull/446#issuecomment-1210052318