Skip to content

Commit

Permalink
build!: DLLとCヘッダをlib/とinclude/に入れる (#954)
Browse files Browse the repository at this point in the history
#942, #944 の続き。

一般的な慣習に従い、C APIのリリース内容物をこうする。

```
├── include
│   └── voicevox_core.h
├── lib
│   ├── voicevox_core.dll
│   └── voicevox_core.lib
├── LICENSE
├── README.txt
└── VERSION
```
  • Loading branch information
qryxip authored Feb 4, 2025
1 parent 7224847 commit 0325003
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@ jobs:
run: cargo build -p voicevox_core_java_api -vv --target ${{ matrix.target }} --release
- name: Organize artifact
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"
mkdir -p artifact/${{ env.ASSET_NAME }}/{include,lib}
case ${{ matrix.c_release_format }} in
plain-cdylib) feature=VOICEVOX_LOAD_ONNXRUNTIME ;;
ios-xcframework) feature=VOICEVOX_LINK_ONNXRUNTIME ;;
esac
sed 's:^//\(#define '"$feature"'\)$:\1:' crates/voicevox_core_c_api/include/voicevox_core.h \
> "artifact/${{ env.ASSET_NAME }}/voicevox_core.h"
cp -v target/${{ matrix.target }}/release/*voicevox_core.{dll,so,dylib} "artifact/${{ env.ASSET_NAME }}" || true
cp -v target/${{ matrix.target }}/release/voicevox_core.dll.lib "artifact/${{ env.ASSET_NAME }}/voicevox_core.lib" || true
> "artifact/${{ env.ASSET_NAME }}/include/voicevox_core.h"
cp -v target/${{ matrix.target }}/release/*voicevox_core.{dll,so,dylib} "artifact/${{ env.ASSET_NAME }}/lib" || true
cp -v target/${{ matrix.target }}/release/voicevox_core.dll.lib "artifact/${{ env.ASSET_NAME }}/lib/voicevox_core.lib" || true
cp -v README.md "artifact/${{ env.ASSET_NAME }}/README.txt"
cp -v LICENSE "artifact/${{ env.ASSET_NAME }}/"
echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ jobs:
run: cargo build -p voicevox_core_c_api --features load-onnxruntime -v
- name: 必要なfileをunix用exampleのディレクトリに移動させる
run: |
mkdir -p example/cpp/unix/voicevox_core/c_api
mkdir -p example/cpp/unix/voicevox_core/c_api/{include,lib}
sed 's:^//\(#define VOICEVOX_LOAD_ONNXRUNTIME\)$:\1:' \
crates/voicevox_core_c_api/include/voicevox_core.h \
> example/cpp/unix/voicevox_core/c_api/voicevox_core.h
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/c_api/ || true
> example/cpp/unix/voicevox_core/c_api/include/voicevox_core.h
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/c_api/lib/ || true
# FIXME: ↓この二つ要らないのでは?
cp -v target/debug/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true
cp -v target/debug/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true
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 @@ -6,8 +6,8 @@ add_executable(simple_tts simple_tts.cpp)
set_property(TARGET simple_tts PROPERTY CXX_STANDARD 17)

file(GLOB ONNXRUNTIME_SHARED_LIB ./libonnxruntime.so.* ./libonnxruntime.*.dylib) # TODO: なにこれ
target_link_directories(simple_tts PRIVATE ./voicevox_core/c_api/)
target_link_directories(simple_tts PRIVATE ./voicevox_core/c_api/lib/)


file(GLOB CORE_LIB ./voicevox_core/c_api/libvoicevox_core.so.* ./voicevox_core/c_api/libvoicevox_core.*.dylib) # TODO: なにこれ
file(GLOB CORE_LIB ./voicevox_core/c_api/lib/libvoicevox_core.so.* ./voicevox_core/c_api/lib/libvoicevox_core.*.dylib) # TODO: なにこれ
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 @@ -3,7 +3,7 @@
#include <iostream>
#include <string>

#include "voicevox_core/c_api/voicevox_core.h"
#include "voicevox_core/c_api/include/voicevox_core.h"

#define STYLE_ID 0
#define OUTPUT_WAV_NAME "audio.wav"
Expand Down

0 comments on commit 0325003

Please sign in to comment.