From 47663e69f191b26d09f632070390d4b96c77bca3 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Sun, 31 Dec 2023 01:14:54 +0900 Subject: [PATCH 01/24] =?UTF-8?q?xcframework=E3=81=A7dylib=E3=82=92framewo?= =?UTF-8?q?rk=E3=81=AB=E5=85=A5=E3=82=8C=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 92 +++++++++++++++--- .../voicevox_core.framework/Info.plist | Bin 0 -> 769 bytes .../Modules/module.modulemap | 6 ++ .../sim/voicevox_core.framework/Info.plist | Bin 0 -> 749 bytes .../Modules/module.modulemap | 6 ++ .../xcframework/Headers/README.md | 5 - .../xcframework/Headers/module.modulemap | 4 - .../voicevox_core_c_api/xcframework/README.md | 6 ++ 8 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Info.plist create mode 100644 crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Modules/module.modulemap create mode 100644 crates/voicevox_core_c_api/xcframework/Frameworks/sim/voicevox_core.framework/Info.plist create mode 100644 crates/voicevox_core_c_api/xcframework/Frameworks/sim/voicevox_core.framework/Modules/module.modulemap delete mode 100644 crates/voicevox_core_c_api/xcframework/Headers/README.md delete mode 100644 crates/voicevox_core_c_api/xcframework/Headers/module.modulemap create mode 100644 crates/voicevox_core_c_api/xcframework/README.md diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 80a7f807c..e7be19539 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -376,26 +376,90 @@ jobs: with: name: voicevox_core-aarch64-apple-ios path: artifact/voicevox_core-aarch64-apple-ios - - name: Create fat binary + - name: Create aarch64 Framework run: | - mkdir -p "artifact/voicevox_core-sim" - lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" -output "artifact/voicevox_core-sim/libvoicevox_core.dylib" + mkdir -p "Framework-aarch64" + cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ + cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ + Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h + lipo -create artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ + -output Framework-aarch64/voicevox_core.framework/voicevox_core + + - name: Change aarch64 @rpath + run: | + # 自身の@rpathを変更 + install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core + + # onnixruntimeの@rpathを変更 + # 依存関係を調べると@rpath/libonnxruntime.A.BB.C.dylibのような文字列があるので、 + # これを@rpath/framework/libonnxruntime.A.BB.C.dylibに変更したい。 + + # dylib名取得 + output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) + matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") + if [[ $matched_line ]]; then + if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then + dylib_string=${BASH_REMATCH[2]} + else + echo "Expected pattern not found in the matched line" + echo "$output" + exit 1 + fi + else + echo "No line containing '@rpath' and 'libonnxruntime' found" + echo "$output" + exit 1 + fi + echo "onnx dylib file name: $dylib_string" + + # onnxruntimeへの@rpathを変更 + install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/$dylib_string" Framework-aarch64/voicevox_core.framework/voicevox_core + + - name: Create sim Framework + run: | + mkdir -p "Framework-sim" + cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ + cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ + Framework-sim/voicevox_core.framework/Headers/voicevox_core.h + lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ + artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ + -output Framework-sim/voicevox_core.framework/voicevox_core + + - name: Change sim @rpath + run: | + # 自身の@rpathを変更 + install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core + + # 方針はaarch64同じ + # dylib名取得 + output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) + matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") + if [[ $matched_line ]]; then + if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then + dylib_string=${BASH_REMATCH[2]} + else + echo "Expected pattern not found in the matched line" + echo "$output" + exit 1 + fi + else + echo "No line containing '@rpath' and 'libonnxruntime' found" + echo "$output" + exit 1 + fi + echo "onnx dylib file name: $dylib_string" + + # onnxruntimeへの@rpathを変更 + install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/$dylib_string" Framework-sim/voicevox_core.framework/voicevox_core + - name: Create XCFramework run: | mkdir -p "artifact/${{ env.ASSET_NAME }}" - # 必要なファイルだけコピー - mkdir -p "Headers-sim" - cp -v artifact/voicevox_core-x86_64-apple-ios/voicevox_core.h "Headers-sim" - cp -v crates/voicevox_core_c_api/xcframework/Headers/module.modulemap "Headers-sim" - mkdir -p "Headers-aarch64" - cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h "Headers-aarch64" - cp -v crates/voicevox_core_c_api/xcframework/Headers/module.modulemap "Headers-aarch64" xcodebuild -create-xcframework \ - -library "artifact/voicevox_core-sim/libvoicevox_core.dylib" \ - -headers "Headers-sim" \ - -library "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ - -headers "Headers-aarch64" \ + -framework "Framework-sim/voicevox_core.framework" \ + -framework "Framework-aarch64/voicevox_core.framework" \ -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" + - name: Archive artifact run: | cd artifact/${{ env.ASSET_NAME }} diff --git a/crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Info.plist b/crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..ba567405ed72f3042b0a37ea5daadbc343f77898 GIT binary patch literal 769 zcmYjO%Wl&^6!i?R0HtvnLLan{ro2lnJCMMJO=5zg5*lKs4G?N3&Lkc>_832+L{K4C zNbL9k7G=$bAK(XAA$5<$AMgj*iA_42bI(2JjPBg&*p#@QDE{U%03JJj;^e8s=`&|% z&dnzI)Li;}=ED5K;?ly!<(13X)!f?Zm8;jT-&oi9bjc^QTSK}*EWD+RnZ_@cD<$9R zQY_;Erpz|6%NCN6d!3;yMdMT2zE4nC3aS=9+Qdg1$pF*wz1;| zRXbLnATzij9n(6}_fQ|JBRl9W#a+cM;NV-uMvxwzPY7D z;oW96*d)<$1(}47G=8~RZQwUPad3Acl#z`(gc6Tnx0%0Fx-T`b^>V<1%zzCwojJia z)?V9!K^*29q=ST5{9kN@E~O}lYNfWbsYrr&aH&P=1`B`osig5aotXl%ZHk4U8t=jt zC>@xBPLb6YBu#AQrE($PB6gT!t}5LV^6i*~M3oAX*pv$8VnLOPLjLQ`TRh<5!R;n; z%;H@x!4AKW4L7tDezSO*WlWAF;>0UzvxPv8sq27ZEH;1K+Q2{;2& pFazgd7Utk1ScBW}1vH=uT{whq;XZs1KXBs%!34RD2qSoFd206b-0b|Bvy11J&Mz;mT)24YvMCiR5oO(mWe=!JHuPjNrMYUY61iPQ zG%_TNdk%5KP12{_HKpl{yS+o~D6~3^>;vmvA*DS^d{bJ;ly$eqHEM^#Z~3E##1BNb zow4^VN8C`z#-?RIxBA2wc>voPu>20GV(k@lWvn)VUPPxU`qMSnVOzx zMwL4rW$|Wt&B&xl;`Vsn+h%GEjQzT{o~R#dhG=8qmS#M%d6#UbHT^!RL0#%Z&W4_v z+pW6zNotdt)cW@s&*vAomfs%t^ MucE7IO$#3F0=Zo1%>V!Z literal 0 HcmV?d00001 diff --git a/crates/voicevox_core_c_api/xcframework/Frameworks/sim/voicevox_core.framework/Modules/module.modulemap b/crates/voicevox_core_c_api/xcframework/Frameworks/sim/voicevox_core.framework/Modules/module.modulemap new file mode 100644 index 000000000..a4812ac0c --- /dev/null +++ b/crates/voicevox_core_c_api/xcframework/Frameworks/sim/voicevox_core.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module voicevox_core { + umbrella header "voicevox_core.h" + export * + + module * { export * } +} diff --git a/crates/voicevox_core_c_api/xcframework/Headers/README.md b/crates/voicevox_core_c_api/xcframework/Headers/README.md deleted file mode 100644 index cd3b3f6a0..000000000 --- a/crates/voicevox_core_c_api/xcframework/Headers/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# xcframeworkのHeadersに追加されるファイル -## module.modulemap - -C言語やObjective-Cのモジュールが、ライブラリ内の公開インターフェースを表現するために使用されます。 -これにより、外部のコードがこのライブラリを利用する際に、必要なインクルードや参照を容易にすることができます。 diff --git a/crates/voicevox_core_c_api/xcframework/Headers/module.modulemap b/crates/voicevox_core_c_api/xcframework/Headers/module.modulemap deleted file mode 100644 index 1b1680b2d..000000000 --- a/crates/voicevox_core_c_api/xcframework/Headers/module.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module VoicevoxCore { - header "voicevox_core.h" - export * -} diff --git a/crates/voicevox_core_c_api/xcframework/README.md b/crates/voicevox_core_c_api/xcframework/README.md new file mode 100644 index 000000000..3dda8f3a7 --- /dev/null +++ b/crates/voicevox_core_c_api/xcframework/README.md @@ -0,0 +1,6 @@ +# xcframeworkフォルダの内容について +## Frameworks + +iOS向けの配布ライブラリXCFramework内のFrameworkを作るための雛形です。 +雛形は端末用とシミュレータ用の2種類です。 + From 94661adc40692dfda03956deb54d2f85bef616bb Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Thu, 4 Jan 2024 15:03:45 +0900 Subject: [PATCH 02/24] =?UTF-8?q?Headers=E3=81=AE=E3=83=87=E3=82=A3?= =?UTF-8?q?=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=83=BC=E3=81=BE=E3=81=A7?= =?UTF-8?q?=E4=BD=9C=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index e7be19539..736d710a4 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -378,7 +378,7 @@ jobs: path: artifact/voicevox_core-aarch64-apple-ios - name: Create aarch64 Framework run: | - mkdir -p "Framework-aarch64" + mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h @@ -417,7 +417,7 @@ jobs: - name: Create sim Framework run: | - mkdir -p "Framework-sim" + mkdir -p "Framework-sim/voicevox_core.framework/Headers" cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ Framework-sim/voicevox_core.framework/Headers/voicevox_core.h From 3ac7672ee30de85318d217951729a2761ad8750c Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Thu, 4 Jan 2024 22:11:19 +0900 Subject: [PATCH 03/24] =?UTF-8?q?onnxruntime=E3=81=AEdylb=E3=81=AE?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E7=95=AA=E5=8F=B7?= =?UTF-8?q?=E3=82=92=E3=81=AA=E3=81=8F=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 736d710a4..2c4899069 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -413,7 +413,7 @@ jobs: echo "onnx dylib file name: $dylib_string" # onnxruntimeへの@rpathを変更 - install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/$dylib_string" Framework-aarch64/voicevox_core.framework/voicevox_core + install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core - name: Create sim Framework run: | @@ -450,7 +450,7 @@ jobs: echo "onnx dylib file name: $dylib_string" # onnxruntimeへの@rpathを変更 - install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/$dylib_string" Framework-sim/voicevox_core.framework/voicevox_core + install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core - name: Create XCFramework run: | From be6326a866bde502d73b2049b533603793184841 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Sat, 6 Jan 2024 22:53:12 +0900 Subject: [PATCH 04/24] =?UTF-8?q?space=E9=99=A4=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 2c4899069..f8a3b94bd 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -376,7 +376,7 @@ jobs: with: name: voicevox_core-aarch64-apple-ios path: artifact/voicevox_core-aarch64-apple-ios - - name: Create aarch64 Framework + - name: Create aarch64 Framework run: | mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ @@ -385,7 +385,7 @@ jobs: lipo -create artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ -output Framework-aarch64/voicevox_core.framework/voicevox_core - - name: Change aarch64 @rpath + - name: Change aarch64 @rpath run: | # 自身の@rpathを変更 install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core @@ -424,14 +424,13 @@ jobs: lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ -output Framework-sim/voicevox_core.framework/voicevox_core - + - name: Change sim @rpath run: | # 自身の@rpathを変更 install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core - - # 方針はaarch64同じ - # dylib名取得 + + # dylib名取得(方針はaarch64同じ) output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then From c994f67ff22cbcce8423ec02d4e87f51e4834432 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Sat, 6 Jan 2024 23:24:22 +0900 Subject: [PATCH 05/24] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index f8a3b94bd..c456470ab 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -387,12 +387,11 @@ jobs: - name: Change aarch64 @rpath run: | - # 自身の@rpathを変更 + # 自身への@rpathを変更 install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core - # onnixruntimeの@rpathを変更 - # 依存関係を調べると@rpath/libonnxruntime.A.BB.C.dylibのような文字列があるので、 - # これを@rpath/framework/libonnxruntime.A.BB.C.dylibに変更したい。 + # 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 + # これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 # dylib名取得 output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) @@ -427,7 +426,7 @@ jobs: - name: Change sim @rpath run: | - # 自身の@rpathを変更 + # 自身への@rpathを変更 install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core # dylib名取得(方針はaarch64同じ) From d9e693f1c968cc2990581619b440ee64105a8369 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 9 Jan 2024 02:27:06 +0900 Subject: [PATCH 06/24] =?UTF-8?q?plist=E3=82=92Binary=E5=BD=A2=E5=BC=8F?= =?UTF-8?q?=E3=81=8B=E3=82=89XML=E5=BD=A2=E5=BC=8F=E3=81=B8=E5=A4=89?= =?UTF-8?q?=E6=8F=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aarch64/voicevox_core.framework/Info.plist | Bin 769 -> 1478 bytes .../sim/voicevox_core.framework/Info.plist | Bin 749 -> 1414 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Info.plist b/crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/voicevox_core.framework/Info.plist index ba567405ed72f3042b0a37ea5daadbc343f77898..f3f359d09954c086d4ac90c141ca65e5f102293a 100644 GIT binary patch literal 1478 zcmbVM+m4$s5PfdGg7O}`Y@2jdu~{{cNYN%6w2)q&Rt`A9U4va?a{2oXB;>*+Qu}7( zIWyZWn0Ya|JHNR#!WzVOH02mNW#u|7I;+yCW`G{I=9GBj9l!m?BqlL8RJGAz2py zMyNs^${ey^(Sffa4b-6X!FnhA!7!sNoZ%p%37LDv%|iJDyr)V6?ZN%0;e%x&MBcV>N%@xN9Tzg5&>F1ROEU& zbmZE7XH=WcFGfQt&w2hAW)Oahl-XG0C#;#8dCZ>K(5)i0k&xN5`@O2@8BJ)M#dEJs zbHA>6F@e_832+L{K4C zNbL9k7G=$bAK(XAA$5<$AMgj*iA_42bI(2JjPBg&*p#@QDE{U%03JJj;^e8s=`&|% z&dnzI)Li;}=ED5K;?ly!<(13X)!f?Zm8;jT-&oi9bjc^QTSK}*EWD+RnZ_@cD<$9R zQY_;Erpz|6%NCN6d!3;yMdMT2zE4nC3aS=9+Qdg1$pF*wz1;| zRXbLnATzij9n(6}_fQ|JBRl9W#a+cM;NV-uMvxwzPY7D z;oW96*d)<$1(}47G=8~RZQwUPad3Acl#z`(gc6Tnx0%0Fx-T`b^>V<1%zzCwojJia z)?V9!K^*29q=ST5{9kN@E~O}lYNfWbsYrr&aH&P=1`B`osig5aotXl%ZHk4U8t=jt zC>@xBPLb6YBu#AQrE($PB6gT!t}5LV^6i*~M3oAX*pv$8VnLOPLjLQ`TRh<5!R;n; z%;H@x!4AKW4L7tDezSO*WlWAF;>0UzvxPv8sq27ZEH;1K+Q2{;2& pFazgd7Utk1ScBW}1vH=uT{whq;XZs1KXBs%!34RD2qS~U4t#-T=@GABqUufRogck z&zU)A<}midG3Cads+@`J-n7t-Y0xYZG0V31<~p1W@5~2hV88cPZurBW8j`bI8~%E- zn7f8K#Q3w6oMP;Sp5ZU%L1;h@jHgegVJ2G3PZ%E#2Smy!6p6G9%(1V8q)HbHNHzoj zigj#4nN#*Rbl_{uBJB*`*{`&4COgLCC5aN2(N$30Y+OFTd#)AGc5XjR?kpRhZ)co4 zo9wcfQ;+T`7c!-p{zA7Px{0Rnr5idu(rBm23#U!YUa*Mn#ql{33Ld-R^B8Kf4Wp_F z|0z+zl*kkILQtLSav1(GX|@p_vAf*NfzAD3*Jcya2orZ=#5ZmegPAuNa=x#37DUVj0P;-L9Bq5Ux$M0 z;L1?7F?xE}GLjd%B9)A{#|ZAe`n-zB5$F39MVw??WIeZpd10-j+sKwXy8WGb>GLb5 zYj#YQvhyz4Z^3tOu*K^nx@NdsZ%6QS?HkN6+rOE-D)W_0<^%;6uA7KyG#oFd206b-0b|Bvy11J&Mz;mT)24YvMCiR5oO(mWe=!JHuPjNrMYUY61iPQ zG%_TNdk%5KP12{_HKpl{yS+o~D6~3^>;vmvA*DS^d{bJ;ly$eqHEM^#Z~3E##1BNb zow4^VN8C`z#-?RIxBA2wc>voPu>20GV(k@lWvn)VUPPxU`qMSnVOzx zMwL4rW$|Wt&B&xl;`Vsn+h%GEjQzT{o~R#dhG=8qmS#M%d6#UbHT^!RL0#%Z&W4_v z+pW6zNotdt)cW@s&*vAomfs%t^ MucE7IO$#3F0=Zo1%>V!Z From 2cd3af7e98a056fa32db32faa40fdf29ede83a8c Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Wed, 24 Jan 2024 13:51:21 +0900 Subject: [PATCH 07/24] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AEcopy=E3=81=A8=E3=81=97=E3=81=A6=E4=BD=BF=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=82=8Blipo=E3=82=92cp=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index c456470ab..7184f28ba 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -382,8 +382,8 @@ jobs: cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h - lipo -create artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ - -output Framework-aarch64/voicevox_core.framework/voicevox_core + cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ + Framework-aarch64/voicevox_core.framework/voicevox_core - name: Change aarch64 @rpath run: | From e5cda7432fdf14fa8775126f1b576c5ebed945b7 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Mon, 5 Feb 2024 16:09:21 +0900 Subject: [PATCH 08/24] =?UTF-8?q?github=20action=E3=81=9D=E3=81=AE?= =?UTF-8?q?=E3=81=BE=E3=81=BE=E3=81=A7=E3=80=81bash=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 136 +++++++++++++------------ build_util/ios_xcframework.bash | 77 ++++++++++++++ 2 files changed, 147 insertions(+), 66 deletions(-) create mode 100755 build_util/ios_xcframework.bash diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 7184f28ba..81cf9d6cb 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -376,87 +376,91 @@ jobs: with: name: voicevox_core-aarch64-apple-ios path: artifact/voicevox_core-aarch64-apple-ios - - name: Create aarch64 Framework + - name: Create xcframework run: | - mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" - cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ - cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ - Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h - cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ - Framework-aarch64/voicevox_core.framework/voicevox_core - - - name: Change aarch64 @rpath - run: | - # 自身への@rpathを変更 - install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core + build_util/ios_xcframework.bash + +# - name: Create aarch64 Framework +# run: | +# mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" +# cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ +# cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ +# Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h +# cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ +# Framework-aarch64/voicevox_core.framework/voicevox_core +# +# - name: Change aarch64 @rpath +# run: | +# # 自身への@rpathを変更 +# install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core # 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 # これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 # dylib名取得 - output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) - matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") - if [[ $matched_line ]]; then - if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then - dylib_string=${BASH_REMATCH[2]} - else - echo "Expected pattern not found in the matched line" - echo "$output" - exit 1 - fi - else - echo "No line containing '@rpath' and 'libonnxruntime' found" - echo "$output" - exit 1 - fi - echo "onnx dylib file name: $dylib_string" +# output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) +# matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") +# if [[ $matched_line ]]; then +# if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then +# dylib_string=${BASH_REMATCH[2]} +# else +# echo "Expected pattern not found in the matched line" +# echo "$output" +# exit 1 +# fi +# else +# echo "No line containing '@rpath' and 'libonnxruntime' found" +# echo "$output" +# exit 1 +# fi +# echo "onnx dylib file name: $dylib_string" # onnxruntimeへの@rpathを変更 - install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core - - - name: Create sim Framework - run: | - mkdir -p "Framework-sim/voicevox_core.framework/Headers" - cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ - cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ - Framework-sim/voicevox_core.framework/Headers/voicevox_core.h - lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ - artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ - -output Framework-sim/voicevox_core.framework/voicevox_core + # install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core - - name: Change sim @rpath - run: | +# - name: Create sim Framework +# run: | +# mkdir -p "Framework-sim/voicevox_core.framework/Headers" +# cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ +# cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ +# Framework-sim/voicevox_core.framework/Headers/voicevox_core.h +# lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ +# artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ +# -output Framework-sim/voicevox_core.framework/voicevox_core +# +# - name: Change sim @rpath +# run: | # 自身への@rpathを変更 - install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core +# install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core # dylib名取得(方針はaarch64同じ) - output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) - matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") - if [[ $matched_line ]]; then - if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then - dylib_string=${BASH_REMATCH[2]} - else - echo "Expected pattern not found in the matched line" - echo "$output" - exit 1 - fi - else - echo "No line containing '@rpath' and 'libonnxruntime' found" - echo "$output" - exit 1 - fi - echo "onnx dylib file name: $dylib_string" +# output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) +# matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") +# if [[ $matched_line ]]; then +# if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then +# dylib_string=${BASH_REMATCH[2]} +# else +# echo "Expected pattern not found in the matched line" +# echo "$output" +# exit 1 +# fi +# else +# echo "No line containing '@rpath' and 'libonnxruntime' found" +# echo "$output" +# exit 1 +# fi +# echo "onnx dylib file name: $dylib_string" # onnxruntimeへの@rpathを変更 - install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core +# install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core - - name: Create XCFramework - run: | - mkdir -p "artifact/${{ env.ASSET_NAME }}" - xcodebuild -create-xcframework \ - -framework "Framework-sim/voicevox_core.framework" \ - -framework "Framework-aarch64/voicevox_core.framework" \ - -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" +# - name: Create XCFramework +# run: | +# mkdir -p "artifact/${{ env.ASSET_NAME }}" +# xcodebuild -create-xcframework \ +# -framework "Framework-sim/voicevox_core.framework" \ +# -framework "Framework-aarch64/voicevox_core.framework" \ +# -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" - name: Archive artifact run: | diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash new file mode 100755 index 000000000..46a988ba8 --- /dev/null +++ b/build_util/ios_xcframework.bash @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# - name: Create aarch64 Framework +mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" +cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ +cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ + Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h +cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ + Framework-aarch64/voicevox_core.framework/voicevox_core + +# - name: Change aarch64 @rpath +# 自身への@rpathを変更 +install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core + +# 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 +# これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 + +# dylib名取得 +output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) +matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") +if [[ $matched_line ]]; then + if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then + dylib_string=${BASH_REMATCH[2]} + else + echo "Expected pattern not found in the matched line" + echo "$output" + exit 1 + fi +else + echo "No line containing '@rpath' and 'libonnxruntime' found" + echo "$output" + exit 1 +fi +echo "onnx dylib file name: $dylib_string" + +# onnxruntimeへの@rpathを変更 +install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core + +# - name: Create sim Framework +mkdir -p "Framework-sim/voicevox_core.framework/Headers" +cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ +cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ + Framework-sim/voicevox_core.framework/Headers/voicevox_core.h +lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ + artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ + -output Framework-sim/voicevox_core.framework/voicevox_core + +# - name: Change sim @rpath +# 自身への@rpathを変更 +install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core + +# dylib名取得(方針はaarch64同じ) +output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) +matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") +if [[ $matched_line ]]; then + if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then + dylib_string=${BASH_REMATCH[2]} + else + echo "Expected pattern not found in the matched line" + echo "$output" + exit 1 + fi +else + echo "No line containing '@rpath' and 'libonnxruntime' found" + echo "$output" + exit 1 +fi +echo "onnx dylib file name: $dylib_string" + +# onnxruntimeへの@rpathを変更 +install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core + +# - name: Create XCFramework +mkdir -p "artifact/${{ env.ASSET_NAME }}" +xcodebuild -create-xcframework \ + -framework "Framework-sim/voicevox_core.framework" \ + -framework "Framework-aarch64/voicevox_core.framework" \ + -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" From 72fad0d387f12d4f8e5c71c95327e47c0c506b25 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Mon, 5 Feb 2024 16:42:25 +0900 Subject: [PATCH 09/24] =?UTF-8?q?=E6=96=87=E6=B3=95=E7=9A=84=E3=81=AA?= =?UTF-8?q?=E3=83=9F=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/ios_xcframework.bash | 35 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash index 46a988ba8..9510168c4 100755 --- a/build_util/ios_xcframework.bash +++ b/build_util/ios_xcframework.bash @@ -1,21 +1,22 @@ #!/usr/bin/env bash +set -e # - name: Create aarch64 Framework mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" -cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ -cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ - Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h -cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ - Framework-aarch64/voicevox_core.framework/voicevox_core +cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/" "Framework-aarch64/" +cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + "Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h" +cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ + "Framework-aarch64/voicevox_core.framework/voicevox_core" # - name: Change aarch64 @rpath # 自身への@rpathを変更 -install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core +install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" "Framework-aarch64/voicevox_core.framework/voicevox_core" # 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 # これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 # dylib名取得 -output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) +output=$(otool -L "Framework-aarch64/voicevox_core.framework/voicevox_core") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then @@ -37,19 +38,19 @@ install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/o # - name: Create sim Framework mkdir -p "Framework-sim/voicevox_core.framework/Headers" -cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ -cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ - Framework-sim/voicevox_core.framework/Headers/voicevox_core.h -lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ - artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ - -output Framework-sim/voicevox_core.framework/voicevox_core +cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/sim/" "Framework-sim/" +cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + "Framework-sim/voicevox_core.framework/Headers/voicevox_core.h" +lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" \ + "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" \ + -output "Framework-sim/voicevox_core.framework/voicevox_core" # - name: Change sim @rpath # 自身への@rpathを変更 -install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core +install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" "Framework-sim/voicevox_core.framework/voicevox_core" # dylib名取得(方針はaarch64同じ) -output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) +output=$(otool -L "Framework-sim/voicevox_core.framework/voicevox_core") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then @@ -70,8 +71,8 @@ echo "onnx dylib file name: $dylib_string" install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core # - name: Create XCFramework -mkdir -p "artifact/${{ env.ASSET_NAME }}" +mkdir -p "artifact/${ASSET_NAME}" xcodebuild -create-xcframework \ -framework "Framework-sim/voicevox_core.framework" \ -framework "Framework-aarch64/voicevox_core.framework" \ - -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" + -output "artifact/${ASSET_NAME}/voicevox_core.xcframework" From 1f542f9ade8fb96a1c938829cf6360dc99bf3069 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Mon, 5 Feb 2024 23:27:50 +0900 Subject: [PATCH 10/24] =?UTF-8?q?=E9=87=8D=E8=A4=87=E3=83=AD=E3=82=B8?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82=E7=B4=B0=E9=83=A8=E3=82=92=E8=A6=8B=E7=9B=B4=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/ios_xcframework.bash | 71 ++++++++++++++------------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash index 9510168c4..25a451933 100755 --- a/build_util/ios_xcframework.bash +++ b/build_util/ios_xcframework.bash @@ -1,21 +1,7 @@ #!/usr/bin/env bash -set -e -# - name: Create aarch64 Framework -mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" -cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/" "Framework-aarch64/" -cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ - "Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h" -cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ - "Framework-aarch64/voicevox_core.framework/voicevox_core" - -# - name: Change aarch64 @rpath -# 自身への@rpathを変更 -install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" "Framework-aarch64/voicevox_core.framework/voicevox_core" - -# 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 -# これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 +set -eu -# dylib名取得 +echo "* Get original onnixruntime file name from rpath" output=$(otool -L "Framework-aarch64/voicevox_core.framework/voicevox_core") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then @@ -31,12 +17,29 @@ else echo "$output" exit 1 fi -echo "onnx dylib file name: $dylib_string" +echo "Origial onnx dylib file name: $dylib_string" +echo "* Create aarch64 Framework" +mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" +cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/" \ + "Framework-aarch64/" +cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + "Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h" +cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ + "Framework-aarch64/voicevox_core.framework/voicevox_core" + +echo "* Change aarch64 @rpath" +# 自身への@rpathを変更 +install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ + "Framework-aarch64/voicevox_core.framework/voicevox_core" +# 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 +# これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 # onnxruntimeへの@rpathを変更 -install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core +install_name_tool -change "@rpath/$dylib_string" \ + "@rpath/onnxruntime.framework/onnxruntime" \ + "Framework-aarch64/voicevox_core.framework/voicevox_core" -# - name: Create sim Framework +echo "* Create sim Framework" mkdir -p "Framework-sim/voicevox_core.framework/Headers" cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/sim/" "Framework-sim/" cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ @@ -45,32 +48,16 @@ lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" \ "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" \ -output "Framework-sim/voicevox_core.framework/voicevox_core" -# - name: Change sim @rpath +echo "* Change sim @rpath" # 自身への@rpathを変更 -install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" "Framework-sim/voicevox_core.framework/voicevox_core" - -# dylib名取得(方針はaarch64同じ) -output=$(otool -L "Framework-sim/voicevox_core.framework/voicevox_core") -matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") -if [[ $matched_line ]]; then - if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then - dylib_string=${BASH_REMATCH[2]} - else - echo "Expected pattern not found in the matched line" - echo "$output" - exit 1 - fi -else - echo "No line containing '@rpath' and 'libonnxruntime' found" - echo "$output" - exit 1 -fi -echo "onnx dylib file name: $dylib_string" - +install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ + "Framework-sim/voicevox_core.framework/voicevox_core" # onnxruntimeへの@rpathを変更 -install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core +install_name_tool -change "@rpath/$dylib_string" \ + "@rpath/onnxruntime.framework/onnxruntime" \ + "Framework-sim/voicevox_core.framework/voicevox_core" -# - name: Create XCFramework +echo "* Create XCFramework" mkdir -p "artifact/${ASSET_NAME}" xcodebuild -create-xcframework \ -framework "Framework-sim/voicevox_core.framework" \ From 0bb8aca00b24d44bad5bfb6dcc351d6e33724ee6 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Mon, 5 Feb 2024 23:39:58 +0900 Subject: [PATCH 11/24] =?UTF-8?q?=E8=AA=A4=E5=AD=97=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/ios_xcframework.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash index 25a451933..8362249ad 100755 --- a/build_util/ios_xcframework.bash +++ b/build_util/ios_xcframework.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eu -echo "* Get original onnixruntime file name from rpath" +echo "* Get original onnxruntime file name from rpath" output=$(otool -L "Framework-aarch64/voicevox_core.framework/voicevox_core") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then @@ -17,7 +17,7 @@ else echo "$output" exit 1 fi -echo "Origial onnx dylib file name: $dylib_string" +echo "Original onnx dylib file name: $dylib_string" echo "* Create aarch64 Framework" mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" From 7d890877045cbaaeb8c898e133c4b61d5bb52478 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 6 Feb 2024 00:05:14 +0900 Subject: [PATCH 12/24] =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=BC=E5=89=8D?= =?UTF-8?q?=E3=81=A7=E3=82=82libvoicevox=5Fcore.dylib=E3=81=AB=E5=8F=82?= =?UTF-8?q?=E7=85=A7=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/ios_xcframework.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash index 8362249ad..da45e05cb 100755 --- a/build_util/ios_xcframework.bash +++ b/build_util/ios_xcframework.bash @@ -2,7 +2,7 @@ set -eu echo "* Get original onnxruntime file name from rpath" -output=$(otool -L "Framework-aarch64/voicevox_core.framework/voicevox_core") +output=$(otool -L "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then From 0c62e3d68631ebae627ccabd967ce61054ed6183 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 6 Feb 2024 00:19:53 +0900 Subject: [PATCH 13/24] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 85 +------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 81cf9d6cb..08c75d80e 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -378,90 +378,7 @@ jobs: path: artifact/voicevox_core-aarch64-apple-ios - name: Create xcframework run: | - build_util/ios_xcframework.bash - -# - name: Create aarch64 Framework -# run: | -# mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" -# cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/ Framework-aarch64/ -# cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ -# Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h -# cp -v artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib \ -# Framework-aarch64/voicevox_core.framework/voicevox_core -# -# - name: Change aarch64 @rpath -# run: | -# # 自身への@rpathを変更 -# install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-aarch64/voicevox_core.framework/voicevox_core - - # 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 - # これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 - - # dylib名取得 -# output=$(otool -L Framework-aarch64/voicevox_core.framework/voicevox_core) -# matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") -# if [[ $matched_line ]]; then -# if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then -# dylib_string=${BASH_REMATCH[2]} -# else -# echo "Expected pattern not found in the matched line" -# echo "$output" -# exit 1 -# fi -# else -# echo "No line containing '@rpath' and 'libonnxruntime' found" -# echo "$output" -# exit 1 -# fi -# echo "onnx dylib file name: $dylib_string" - - # onnxruntimeへの@rpathを変更 - # install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-aarch64/voicevox_core.framework/voicevox_core - -# - name: Create sim Framework -# run: | -# mkdir -p "Framework-sim/voicevox_core.framework/Headers" -# cp -vr crates/voicevox_core_c_api/xcframework/Frameworks/sim/ Framework-sim/ -# cp -v artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h \ -# Framework-sim/voicevox_core.framework/Headers/voicevox_core.h -# lipo -create artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib \ -# artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib \ -# -output Framework-sim/voicevox_core.framework/voicevox_core -# -# - name: Change sim @rpath -# run: | - # 自身への@rpathを変更 -# install_name_tool -id @rpath/voicevox_core.framework/voicevox_core Framework-sim/voicevox_core.framework/voicevox_core - - # dylib名取得(方針はaarch64同じ) -# output=$(otool -L Framework-sim/voicevox_core.framework/voicevox_core) -# matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") -# if [[ $matched_line ]]; then -# if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then -# dylib_string=${BASH_REMATCH[2]} -# else -# echo "Expected pattern not found in the matched line" -# echo "$output" -# exit 1 -# fi -# else -# echo "No line containing '@rpath' and 'libonnxruntime' found" -# echo "$output" -# exit 1 -# fi -# echo "onnx dylib file name: $dylib_string" - - # onnxruntimeへの@rpathを変更 -# install_name_tool -change "@rpath/$dylib_string" "@rpath/onnxruntime.framework/onnxruntime" Framework-sim/voicevox_core.framework/voicevox_core - -# - name: Create XCFramework -# run: | -# mkdir -p "artifact/${{ env.ASSET_NAME }}" -# xcodebuild -create-xcframework \ -# -framework "Framework-sim/voicevox_core.framework" \ -# -framework "Framework-aarch64/voicevox_core.framework" \ -# -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" - + build_util/ios_xcframework.bash - name: Archive artifact run: | cd artifact/${{ env.ASSET_NAME }} From e1814909a5cac4da5949dc62464ccab9b2dde4d2 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 6 Feb 2024 03:03:23 +0900 Subject: [PATCH 14/24] =?UTF-8?q?=E3=82=A2=E3=83=BC=E3=82=AD=E3=83=86?= =?UTF-8?q?=E3=82=AF=E3=83=81=E3=83=A3=E3=82=92=E3=81=BE=E3=81=A8=E3=82=81?= =?UTF-8?q?=E3=81=A6=E3=83=AB=E3=83=BC=E3=83=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/ios_xcframework.bash | 54 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/build_util/ios_xcframework.bash b/build_util/ios_xcframework.bash index da45e05cb..6bd41f5a2 100755 --- a/build_util/ios_xcframework.bash +++ b/build_util/ios_xcframework.bash @@ -19,43 +19,37 @@ else fi echo "Original onnx dylib file name: $dylib_string" -echo "* Create aarch64 Framework" -mkdir -p "Framework-aarch64/voicevox_core.framework/Headers" -cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/aarch64/" \ - "Framework-aarch64/" -cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ - "Framework-aarch64/voicevox_core.framework/Headers/voicevox_core.h" -cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ - "Framework-aarch64/voicevox_core.framework/voicevox_core" +arches=("aarch64" "sim") +for arch in "${arches[@]}"; do + echo "* copy Framework-${arch} template" + mkdir -p "Framework-${arch}/voicevox_core.framework/Headers" + cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/${arch}/" "Framework-${arch}/" + cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + "Framework-${arch}/voicevox_core.framework/Headers/voicevox_core.h" +done -echo "* Change aarch64 @rpath" -# 自身への@rpathを変更 -install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ - "Framework-aarch64/voicevox_core.framework/voicevox_core" -# 依存ライブラリを調べると@rpath/libonnxruntime.A.BB.C.dylibの文字列があるので、 -# これを@rpath/onnxruntime.framework/onnxruntimeに変更したい。 -# onnxruntimeへの@rpathを変更 -install_name_tool -change "@rpath/$dylib_string" \ - "@rpath/onnxruntime.framework/onnxruntime" \ +echo "* Create dylib" +# aarch64はdylibをコピー +cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ "Framework-aarch64/voicevox_core.framework/voicevox_core" -echo "* Create sim Framework" -mkdir -p "Framework-sim/voicevox_core.framework/Headers" -cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/sim/" "Framework-sim/" -cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ - "Framework-sim/voicevox_core.framework/Headers/voicevox_core.h" +# simはx86_64とarrch64を合わせてdylib作成 lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" \ "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" \ -output "Framework-sim/voicevox_core.framework/voicevox_core" -echo "* Change sim @rpath" -# 自身への@rpathを変更 -install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ - "Framework-sim/voicevox_core.framework/voicevox_core" -# onnxruntimeへの@rpathを変更 -install_name_tool -change "@rpath/$dylib_string" \ - "@rpath/onnxruntime.framework/onnxruntime" \ - "Framework-sim/voicevox_core.framework/voicevox_core" +for arch in "${arches[@]}"; do + echo "* Change ${arch} @rpath" + # 自身への@rpathを変更 + install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \ + "Framework-${arch}/voicevox_core.framework/voicevox_core" + + # 依存ライブラリonnxruntimeへの@rpathを変更 + install_name_tool -change "@rpath/$dylib_string" \ + "@rpath/onnxruntime.framework/onnxruntime" \ + "Framework-${arch}/voicevox_core.framework/voicevox_core" +done + echo "* Create XCFramework" mkdir -p "artifact/${ASSET_NAME}" From 4c8a7e1b6fe23dd80ca60de24566906e7b7b685a Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Fri, 9 Feb 2024 17:29:46 +0900 Subject: [PATCH 15/24] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=81=AE=E5=A4=89=E6=9B=B4=E3=80=82ios=5Fxcframework.?= =?UTF-8?q?bash=20->=20make=5Fios=5Fxcframework.bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 2 +- build_util/{ios_xcframework.bash => make_ios_xcframework.bash} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename build_util/{ios_xcframework.bash => make_ios_xcframework.bash} (100%) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 08c75d80e..5a4f234f6 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -378,7 +378,7 @@ jobs: path: artifact/voicevox_core-aarch64-apple-ios - name: Create xcframework run: | - build_util/ios_xcframework.bash + build_util/make_ios_xcframework.bash - name: Archive artifact run: | cd artifact/${{ env.ASSET_NAME }} diff --git a/build_util/ios_xcframework.bash b/build_util/make_ios_xcframework.bash similarity index 100% rename from build_util/ios_xcframework.bash rename to build_util/make_ios_xcframework.bash From d95e7dac4ef78fbbd1bdba7b6cb6b6185a5b7cbf Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Fri, 9 Feb 2024 17:36:49 +0900 Subject: [PATCH 16/24] =?UTF-8?q?=E3=83=98=E3=83=83=E3=83=80=E3=83=BC?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=99=E3=82=8B=E9=9A=9B=E3=81=AB=E5=9B=BA=E5=AE=9A=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=9F=E3=82=A2=E3=83=BC=E3=82=AD?= =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=81=E3=83=A3=E3=82=92=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/make_ios_xcframework.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index 6bd41f5a2..cd268dac4 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -24,7 +24,7 @@ for arch in "${arches[@]}"; do echo "* copy Framework-${arch} template" mkdir -p "Framework-${arch}/voicevox_core.framework/Headers" cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/${arch}/" "Framework-${arch}/" - cp -v "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + cp -v "artifact/voicevox_core-${arch}-apple-ios/voicevox_core.h" \ "Framework-${arch}/voicevox_core.framework/Headers/voicevox_core.h" done From 929925a8bbc39e935cc80dd2dbdeb0ffc2a42cb7 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Fri, 9 Feb 2024 18:51:44 +0900 Subject: [PATCH 17/24] =?UTF-8?q?artifact=E3=81=AE=E3=83=87=E3=82=A3?= =?UTF-8?q?=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=82=92bash=E3=81=AB?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 13 +++++++++---- build_util/make_ios_xcframework.bash | 21 +++++++++++++-------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 5a4f234f6..23d5eef4a 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -361,27 +361,32 @@ jobs: needs: [config, build_and_deploy] runs-on: macos-12 env: + IOS_X86_64_PATH: artifact/voicevox_core-x86_64-apple-ios + IOS_AARCH64_SIM_PATH: artifact/voicevox_core-aarch64-apple-ios-sim + IOS_AARCH64_PATH: artifact/voicevox_core-aarch64-apple-ios ASSET_NAME: voicevox_core-ios-xcframework-cpu-${{ needs.config.outputs.version }} + ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu-${{ needs.config.outputs.version }} steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v2 with: name: voicevox_core-x86_64-apple-ios - path: artifact/voicevox_core-x86_64-apple-ios + path: ${{ env.IOS_X86_64_PATH }} +# path: artifact/voicevox_core-x86_64-apple-ios - uses: actions/download-artifact@v2 with: name: voicevox_core-aarch64-apple-ios-sim - path: artifact/voicevox_core-aarch64-apple-ios-sim + path: ${{ env.IOS_AARCH64_SIM_PATH }} - uses: actions/download-artifact@v2 with: name: voicevox_core-aarch64-apple-ios - path: artifact/voicevox_core-aarch64-apple-ios + path: ${{ env.IOS_AARCH64_PATH }} - name: Create xcframework run: | build_util/make_ios_xcframework.bash - name: Archive artifact run: | - cd artifact/${{ env.ASSET_NAME }} + cd ${{ env.ASSET_PATH }} 7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework" - name: Upload to Release if: fromJson(needs.config.outputs.deploy) diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index cd268dac4..997025f1e 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -eu + + echo "* Get original onnxruntime file name from rpath" -output=$(otool -L "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib") +output=$(otool -L "${IOS_AARCH64_PATH}/libvoicevox_core.dylib") matched_line=$(echo "$output" | grep "@rpath" | grep "libonnxruntime") if [[ $matched_line ]]; then if [[ $matched_line =~ (@rpath/([^ ]+\.dylib)) ]]; then @@ -20,22 +22,25 @@ fi echo "Original onnx dylib file name: $dylib_string" arches=("aarch64" "sim") -for arch in "${arches[@]}"; do +artifacts=(${IOS_AARCH64_PATH} ${IOS_AARCH64_SIM_PATH}) +for i in "${!arches[@]}"; do + arch="${arches[$i]}" + artifact="${artifacts[$i]}" echo "* copy Framework-${arch} template" mkdir -p "Framework-${arch}/voicevox_core.framework/Headers" cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/${arch}/" "Framework-${arch}/" - cp -v "artifact/voicevox_core-${arch}-apple-ios/voicevox_core.h" \ + cp -v "${artifact}/voicevox_core.h" \ "Framework-${arch}/voicevox_core.framework/Headers/voicevox_core.h" done echo "* Create dylib" # aarch64はdylibをコピー -cp -v "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ +cp -v "${IOS_AARCH64_PATH}/libvoicevox_core.dylib" \ "Framework-aarch64/voicevox_core.framework/voicevox_core" # simはx86_64とarrch64を合わせてdylib作成 -lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" \ - "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" \ +lipo -create "${IOS_X86_64_PATH}/libvoicevox_core.dylib" \ + "${IOS_AARCH64_SIM_PATH}/libvoicevox_core.dylib" \ -output "Framework-sim/voicevox_core.framework/voicevox_core" for arch in "${arches[@]}"; do @@ -52,8 +57,8 @@ done echo "* Create XCFramework" -mkdir -p "artifact/${ASSET_NAME}" +mkdir -p "${ASSET_PATH}" xcodebuild -create-xcframework \ -framework "Framework-sim/voicevox_core.framework" \ -framework "Framework-aarch64/voicevox_core.framework" \ - -output "artifact/${ASSET_NAME}/voicevox_core.xcframework" + -output "${ASSET_PATH}/voicevox_core.xcframework" From 18206a08b60a1325846a19a494b27c4aeb0c3040 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Fri, 9 Feb 2024 19:04:44 +0900 Subject: [PATCH 18/24] =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E6=9C=AA=E5=AE=9A=E7=BE=A9=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=81=AE=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82echo=E3=81=AE=E6=96=87=E8=A8=80=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/make_ios_xcframework.bash | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index 997025f1e..d8b3f9bf0 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -1,7 +1,22 @@ #!/usr/bin/env bash set -eu - +if [ ! -v IOS_X86_64_PATH ]; then # 入力用:X86_64用のモジュールのディレクトリ(simulator) + echo "IOS_X86_64_PATHが未定義です" + exit 1 +fi +if [ ! -v IOS_AARCH64_SIM_PATH ]; then # 入力用:AARCH64_SIM用のモジュールのディレクトリ(simulator) + echo "IOS_AARCH64_SIM_PATHが未定義です" + exit 1 +fi +if [ ! -v IOS_AARCH64_PATH ]; then # 入力用: AARCH64用のモジュールのディレクトリ(実機) + echo "IOS_AARCH64_PATHが未定義です" + exit 1 +fi +if [ ! -v ASSET_PATH ]; then # 出力用: ASSETのディレクトリ + echo "ASSET_PATHが未定義です" + exit 1 +fi echo "* Get original onnxruntime file name from rpath" output=$(otool -L "${IOS_AARCH64_PATH}/libvoicevox_core.dylib") @@ -21,12 +36,13 @@ else fi echo "Original onnx dylib file name: $dylib_string" +echo "* Copy Framework template" arches=("aarch64" "sim") artifacts=(${IOS_AARCH64_PATH} ${IOS_AARCH64_SIM_PATH}) for i in "${!arches[@]}"; do arch="${arches[$i]}" artifact="${artifacts[$i]}" - echo "* copy Framework-${arch} template" + echo "* Copy Framework-${arch} template" mkdir -p "Framework-${arch}/voicevox_core.framework/Headers" cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/${arch}/" "Framework-${arch}/" cp -v "${artifact}/voicevox_core.h" \ From bb6e24b5834a5c9cecc9b7f1fcbb21914913a6d9 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Fri, 9 Feb 2024 20:36:33 +0900 Subject: [PATCH 19/24] =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=82=92=20"=20=E3=81=A7=E5=9B=B2=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_util/make_ios_xcframework.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index d8b3f9bf0..150d92421 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -38,7 +38,7 @@ echo "Original onnx dylib file name: $dylib_string" echo "* Copy Framework template" arches=("aarch64" "sim") -artifacts=(${IOS_AARCH64_PATH} ${IOS_AARCH64_SIM_PATH}) +artifacts=("${IOS_AARCH64_PATH}" "${IOS_AARCH64_SIM_PATH}") for i in "${!arches[@]}"; do arch="${arches[$i]}" artifact="${artifacts[$i]}" From 92b3bc8c5f6392b321389bc89fdd936613a2907a Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Mon, 26 Feb 2024 01:43:05 +0900 Subject: [PATCH 20/24] Update .github/workflows/build_and_deploy.yml --- .github/workflows/build_and_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 23d5eef4a..8f7ed1251 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -372,7 +372,6 @@ jobs: with: name: voicevox_core-x86_64-apple-ios path: ${{ env.IOS_X86_64_PATH }} -# path: artifact/voicevox_core-x86_64-apple-ios - uses: actions/download-artifact@v2 with: name: voicevox_core-aarch64-apple-ios-sim From c93d89671602642ad2d7a4825c3437c5c58b08c8 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Mon, 26 Feb 2024 01:48:37 +0900 Subject: [PATCH 21/24] =?UTF-8?q?OUTPUT=5FASSET=5FPATH=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=82=8A=E3=81=AA=E3=81=A9=E3=81=AE=E5=BE=AE=E8=AA=BF?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 9 ++++--- build_util/make_ios_xcframework.bash | 37 +++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 8f7ed1251..556dfd613 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -365,13 +365,12 @@ jobs: IOS_AARCH64_SIM_PATH: artifact/voicevox_core-aarch64-apple-ios-sim IOS_AARCH64_PATH: artifact/voicevox_core-aarch64-apple-ios ASSET_NAME: voicevox_core-ios-xcframework-cpu-${{ needs.config.outputs.version }} - ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu-${{ needs.config.outputs.version }} steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v2 with: name: voicevox_core-x86_64-apple-ios - path: ${{ env.IOS_X86_64_PATH }} + path: ${{ env.IOS_X86_64_PATH }} - uses: actions/download-artifact@v2 with: name: voicevox_core-aarch64-apple-ios-sim @@ -382,10 +381,12 @@ jobs: path: ${{ env.IOS_AARCH64_PATH }} - name: Create xcframework run: | - build_util/make_ios_xcframework.bash + build_util/make_ios_xcframework.bash + env: + OUTPUT_ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu - name: Archive artifact run: | - cd ${{ env.ASSET_PATH }} + cd artifact/voicevox_core-ios-xcframework-cpu 7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework" - name: Upload to Release if: fromJson(needs.config.outputs.deploy) diff --git a/build_util/make_ios_xcframework.bash b/build_util/make_ios_xcframework.bash index 150d92421..2d35fac88 100755 --- a/build_util/make_ios_xcframework.bash +++ b/build_util/make_ios_xcframework.bash @@ -1,22 +1,22 @@ #!/usr/bin/env bash set -eu -if [ ! -v IOS_X86_64_PATH ]; then # 入力用:X86_64用のモジュールのディレクトリ(simulator) - echo "IOS_X86_64_PATHが未定義です" - exit 1 -fi -if [ ! -v IOS_AARCH64_SIM_PATH ]; then # 入力用:AARCH64_SIM用のモジュールのディレクトリ(simulator) - echo "IOS_AARCH64_SIM_PATHが未定義です" - exit 1 -fi -if [ ! -v IOS_AARCH64_PATH ]; then # 入力用: AARCH64用のモジュールのディレクトリ(実機) - echo "IOS_AARCH64_PATHが未定義です" - exit 1 -fi -if [ ! -v ASSET_PATH ]; then # 出力用: ASSETのディレクトリ - echo "ASSET_PATHが未定義です" - exit 1 -fi +if [ ! -v IOS_X86_64_PATH ]; then # X86_64用のモジュールのディレクトリ(simulator) + echo "IOS_X86_64_PATHが未定義です" + exit 1 +fi +if [ ! -v IOS_AARCH64_SIM_PATH ]; then # AARCH64_SIM用のモジュールのディレクトリ(simulator) + echo "IOS_AARCH64_SIM_PATHが未定義です" + exit 1 +fi +if [ ! -v IOS_AARCH64_PATH ]; then # AARCH64用のモジュールのディレクトリ(実機) + echo "IOS_AARCH64_PATHが未定義です" + exit 1 +fi +if [ ! -v OUTPUT_ASSET_PATH ]; then # 出力するASSETのディレクトリ + echo "OUTPUT_ASSET_PATHが未定義です" + exit 1 +fi echo "* Get original onnxruntime file name from rpath" output=$(otool -L "${IOS_AARCH64_PATH}/libvoicevox_core.dylib") @@ -71,10 +71,9 @@ for arch in "${arches[@]}"; do "Framework-${arch}/voicevox_core.framework/voicevox_core" done - echo "* Create XCFramework" -mkdir -p "${ASSET_PATH}" +mkdir -p "${OUTPUT_ASSET_PATH}" xcodebuild -create-xcframework \ -framework "Framework-sim/voicevox_core.framework" \ -framework "Framework-aarch64/voicevox_core.framework" \ - -output "${ASSET_PATH}/voicevox_core.xcframework" + -output "${OUTPUT_ASSET_PATH}/voicevox_core.xcframework" From 3f037f11eee7b2153a29f7dfa26b1801664cd9b3 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 27 Feb 2024 01:41:56 +0900 Subject: [PATCH 22/24] =?UTF-8?q?=E6=8C=87=E6=91=98=E3=81=AE=E7=82=B9?= =?UTF-8?q?=E3=81=A7run:=20|=E3=81=AE=E5=BE=8C=E3=80=81=E3=82=B3=E3=83=9E?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=8C1=E8=A1=8C=E3=81=AE=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=81=AF|=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 556dfd613..b93e6b837 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -380,7 +380,7 @@ jobs: name: voicevox_core-aarch64-apple-ios path: ${{ env.IOS_AARCH64_PATH }} - name: Create xcframework - run: | + run: build_util/make_ios_xcframework.bash env: OUTPUT_ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu From d6da3bedd0c0ada0e1c4fc7fa8cc53e59018ce27 Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 27 Feb 2024 01:50:41 +0900 Subject: [PATCH 23/24] =?UTF-8?q?=E5=90=8C=E6=A7=98=E3=81=AB=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=81=97=E3=81=A6=E3=80=81run:=20|?= =?UTF-8?q?=E3=81=AE=E5=BE=8C=E3=80=81=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=81=8C1=E8=A1=8C=E3=81=AE=E6=99=82=E3=81=AB=E3=81=AF|?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index b93e6b837..53ee100d5 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -242,7 +242,7 @@ jobs: - name: Raplace resource if: inputs.is_production shell: bash - run: | + run: mv -f download/resource/core/README.md ./README.md - name: Install cargo-binstall uses: taiki-e/install-action@cargo-binstall @@ -315,7 +315,7 @@ jobs: cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && inputs.code_signing - run: | + run: bash build_util/codesign.bash "artifact/${{ env.ASSET_NAME }}/voicevox_core.dll" env: ESIGNERCKA_USERNAME: ${{ secrets.ESIGNERCKA_USERNAME }} @@ -415,7 +415,7 @@ jobs: - name: Raplace resource if: inputs.is_production shell: bash - run: | + run: rm -r ./model; mv download/fat_resource/core/model ./model - name: Create artifact run: | @@ -457,7 +457,7 @@ jobs: - name: Install cargo-edit run: cargo binstall cargo-edit@^0.11 --no-confirm - name: set cargo version - run: | + run: cargo set-version "$VERSION" -p voicevox_core_java_api - name: "Download artifact (android-arm64-cpu)" From a1ffeab9304ba5dc7bee9966474e629ea421f78c Mon Sep 17 00:00:00 2001 From: nekomimimi Date: Tue, 27 Feb 2024 22:41:12 +0900 Subject: [PATCH 24/24] =?UTF-8?q?OUTPUT=5FASSET=5FPATH=E3=81=A8=E5=90=8C?= =?UTF-8?q?=E3=81=98=E5=80=A4=E3=81=8C=E6=9B=B8=E3=81=8B=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E3=81=AE=E3=82=92=E8=A7=A3=E6=B6=88=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 53ee100d5..263e287f9 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -380,13 +380,15 @@ jobs: name: voicevox_core-aarch64-apple-ios path: ${{ env.IOS_AARCH64_PATH }} - name: Create xcframework - run: + id: create-xcframework + run: | build_util/make_ios_xcframework.bash + echo "output_asset_path=${OUTPUT_ASSET_PATH}" >> "$GITHUB_OUTPUT" env: OUTPUT_ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu - name: Archive artifact run: | - cd artifact/voicevox_core-ios-xcframework-cpu + cd ${{ steps.create-xcframework.outputs.output_asset_path }} 7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework" - name: Upload to Release if: fromJson(needs.config.outputs.deploy)