Skip to content

Commit

Permalink
C API版のライブラリとヘッダファイル名をcore -> voicevox_coreに変更 (VOICEVOX#256)
Browse files Browse the repository at this point in the history
* C API版のライブラリとヘッダファイル名をcore -> voicevox_coreに変更

* ignoreするのをvocevox_core.hに変更

* linkするファイル名の変更

* macos向けにlibvoicevox_coreを追加
  • Loading branch information
qwerty2501 authored Sep 13, 2022
1 parent 4e07e7c commit d865b5a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/voicevox_core_c_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
edition = "2021"

[lib]
name = "core"
name = "voicevox_core"
crate-type = ["cdylib"]

[features]
Expand Down
4 changes: 2 additions & 2 deletions crates/voicevox_core_c_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion example/cpp/unix/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
*.dylib
*.so
*.so.*
core.h
vocevox_core.h


# OpenJTalk-dictionary's dir
open_jtalk_dic_utf_8-*
Expand Down
4 changes: 2 additions & 2 deletions example/cpp/unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion example/cpp/unix/simple_tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <iostream>
#include <string>

#include "voicevox_core/core.h"
#include "voicevox_core/voicevox_core.h"

#define OUTPUT_WAV_NAME "audio.wav"

Expand Down

0 comments on commit d865b5a

Please sign in to comment.