From d865b5a29c2e830e197e6a3b2bfd209f0febbbaf Mon Sep 17 00:00:00 2001 From: qwerty2501 <939468+qwerty2501@users.noreply.github.com> Date: Wed, 14 Sep 2022 02:45:00 +0900 Subject: [PATCH] =?UTF-8?q?C=20API=E7=89=88=E3=81=AE=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=83=96=E3=83=A9=E3=83=AA=E3=81=A8=E3=83=98=E3=83=83=E3=83=80?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D=E3=82=92core=20->?= =?UTF-8?q?=20voicevox=5Fcore=E3=81=AB=E5=A4=89=E6=9B=B4=20(#256)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * C API版のライブラリとヘッダファイル名をcore -> voicevox_coreに変更 * ignoreするのをvocevox_core.hに変更 * linkするファイル名の変更 * macos向けにlibvoicevox_coreを追加 --- .github/workflows/build_and_deploy.yml | 6 +++--- .github/workflows/test.yml | 4 ++-- crates/voicevox_core_c_api/Cargo.toml | 2 +- crates/voicevox_core_c_api/build.rs | 4 ++-- example/cpp/unix/.gitignore | 3 ++- example/cpp/unix/CMakeLists.txt | 4 ++-- example/cpp/unix/simple_tts.cpp | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 1daa30bdb..48fc2c50d 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -114,9 +114,9 @@ jobs: shell: bash run: | mkdir -p "artifact/${{ env.ASSET_NAME }}" - cp -v target/core.h "artifact/${{ env.ASSET_NAME }}" + cp -v target/voicevox_core.h "artifact/${{ env.ASSET_NAME }}" cp -v target/${{ matrix.target }}/release/*.{dll,so,dylib} "artifact/${{ env.ASSET_NAME }}" || true - cp -v target/${{ matrix.target }}/release/core.dll.lib "artifact/${{ env.ASSET_NAME }}/core.lib" || true + cp -v target/${{ matrix.target }}/release/voicevox_core.dll.lib "artifact/${{ env.ASSET_NAME }}/voicevox_core.lib" || true cp -v -n target/${{ matrix.target }}/release/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/*.{dll,so.*,so,dylib} "artifact/${{ env.ASSET_NAME }}" || true # libonnxruntimeについてはバージョン付のshared libraryを使用するためバージョンがついてないものを削除する rm -f artifact/${{ env.ASSET_NAME }}/libonnxruntime.{so,dylib} @@ -126,7 +126,7 @@ jobs: if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' shell: bash run: | - bash build_util/codesign.bash "artifact/${{ env.ASSET_NAME }}/core.dll" + bash build_util/codesign.bash "artifact/${{ env.ASSET_NAME }}/voicevox_core.dll" env: CERT_BASE64: ${{ secrets.CERT_BASE64 }} CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e9e00eaed..7eff3eeff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,8 +77,8 @@ jobs: - name: 必要なfileをunix用exampleのディレクトリに移動させる run: | mkdir -p example/cpp/unix/voicevox_core/ - cp -v target/core.h example/cpp/unix/voicevox_core/ - cp -v target/debug/libcore.{so,dylib} example/cpp/unix/voicevox_core/ || true + cp -v target/voicevox_core.h example/cpp/unix/voicevox_core/ + cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/ || true cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true diff --git a/crates/voicevox_core_c_api/Cargo.toml b/crates/voicevox_core_c_api/Cargo.toml index 19aab833e..27bdd3d36 100644 --- a/crates/voicevox_core_c_api/Cargo.toml +++ b/crates/voicevox_core_c_api/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.0" edition = "2021" [lib] -name = "core" +name = "voicevox_core" crate-type = ["cdylib"] [features] diff --git a/crates/voicevox_core_c_api/build.rs b/crates/voicevox_core_c_api/build.rs index 97c9cba2d..76eb03095 100644 --- a/crates/voicevox_core_c_api/build.rs +++ b/crates/voicevox_core_c_api/build.rs @@ -8,7 +8,7 @@ fn main() { #[cfg(target_os = "macos")] { println!("cargo:rustc-link-arg=-Wl,-rpath,@loader_path/"); - println!("cargo:rustc-link-arg=-Wl,-install_name,@rpath/libcore.dylib"); + println!("cargo:rustc-link-arg=-Wl,-install_name,@rpath/libvoicevox_core.dylib"); } } @@ -19,7 +19,7 @@ fn generate_c_header() { use std::path::PathBuf; let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let output_file = target_dir().join("core.h").display().to_string(); + let output_file = target_dir().join("voicevox_core.h").display().to_string(); let config = Config { parse: ParseConfig { parse_deps: true, diff --git a/example/cpp/unix/.gitignore b/example/cpp/unix/.gitignore index 3173c2c9a..2b66c295d 100644 --- a/example/cpp/unix/.gitignore +++ b/example/cpp/unix/.gitignore @@ -2,7 +2,8 @@ *.dylib *.so *.so.* -core.h +vocevox_core.h + # OpenJTalk-dictionary's dir open_jtalk_dic_utf_8-* diff --git a/example/cpp/unix/CMakeLists.txt b/example/cpp/unix/CMakeLists.txt index 2f7172a19..5cef356f8 100644 --- a/example/cpp/unix/CMakeLists.txt +++ b/example/cpp/unix/CMakeLists.txt @@ -9,5 +9,5 @@ file(GLOB ONNXRUNTIME_SHARED_LIB ./libonnxruntime.so.* ./libonnxruntime.*.dylib) target_link_directories(simple_tts PRIVATE ./voicevox_core) -file(GLOB CORE_LIB ./voicevox_core/libcore.so.* ./voicevox_core/libcore.*.dylib) -target_link_libraries(simple_tts core) +file(GLOB CORE_LIB ./voicevox_core/libvoicevox_core.so.* ./voicevox_core/libvoicevox_core.*.dylib) +target_link_libraries(simple_tts voicevox_core) diff --git a/example/cpp/unix/simple_tts.cpp b/example/cpp/unix/simple_tts.cpp index 28f7f5916..f41aaf1ee 100644 --- a/example/cpp/unix/simple_tts.cpp +++ b/example/cpp/unix/simple_tts.cpp @@ -2,7 +2,7 @@ #include #include -#include "voicevox_core/core.h" +#include "voicevox_core/voicevox_core.h" #define OUTPUT_WAV_NAME "audio.wav"