From 0325003342dbd72bc6e65c9eb6425b90533f795a Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Wed, 5 Feb 2025 00:13:18 +0900 Subject: [PATCH] =?UTF-8?q?build!:=20DLL=E3=81=A8C=E3=83=98=E3=83=83?= =?UTF-8?q?=E3=83=80=E3=82=92lib/=E3=81=A8include/=E3=81=AB=E5=85=A5?= =?UTF-8?q?=E3=82=8C=E3=82=8B=20(#954)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #942, #944 の続き。 一般的な慣習に従い、C APIのリリース内容物をこうする。 ``` ├── include │ └── voicevox_core.h ├── lib │ ├── voicevox_core.dll │ └── voicevox_core.lib ├── LICENSE ├── README.txt └── VERSION ``` --- .github/workflows/build_and_deploy.yml | 8 ++++---- .github/workflows/test.yml | 7 ++++--- example/cpp/unix/CMakeLists.txt | 4 ++-- example/cpp/unix/simple_tts.cpp | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 7888e41df..1dfc724b9 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -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" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 917aaf3e2..83c43f522 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/example/cpp/unix/CMakeLists.txt b/example/cpp/unix/CMakeLists.txt index 845e2fe0f..a2ed85322 100644 --- a/example/cpp/unix/CMakeLists.txt +++ b/example/cpp/unix/CMakeLists.txt @@ -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) diff --git a/example/cpp/unix/simple_tts.cpp b/example/cpp/unix/simple_tts.cpp index 30eac7cad..99140c0cd 100644 --- a/example/cpp/unix/simple_tts.cpp +++ b/example/cpp/unix/simple_tts.cpp @@ -3,7 +3,7 @@ #include #include -#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"