Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,18 @@ jobs:
ESIGNERCKA_USERNAME: ${{ secrets.ESIGNERCKA_USERNAME }}
ESIGNERCKA_PASSWORD: ${{ secrets.ESIGNERCKA_PASSWORD }}
ESIGNERCKA_TOTP_SECRET: ${{ secrets.ESIGNERCKA_TOTP_SECRET }}
- name: Upload artifact to build XCFramework
- name: Upload artifact to build XCFramework(iOS)
if: matrix.c_release_format == 'ios-xcframework'
uses: actions/upload-artifact@v4
with:
name: voicevox_core-${{ matrix.target }}
path: artifact/${{ env.ASSET_NAME }}
- name: Upload artifact to build XCFramework(macOS)
if: matrix.artifact_name == 'osx-arm64' || matrix.artifact_name == 'osx-x64'
uses: actions/upload-artifact@v4
with:
name: voicevox_core-${{ matrix.target }}
path: artifact/${{ env.ASSET_NAME }}
- name: Archive artifact
run: |
cd artifact
Expand Down Expand Up @@ -284,7 +290,9 @@ jobs:
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 }}
MACOS_ARM64_PATH: artifact/voicevox_core-aarch64-apple-darwin
MACOS_X64_PATH: artifact/voicevox_core-x86_64-apple-darwin
ASSET_NAME: voicevox_core-xcframework-cpu-${{ needs.config.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
Expand All @@ -299,13 +307,21 @@ jobs:
with:
name: voicevox_core-aarch64-apple-ios
path: ${{ env.IOS_AARCH64_PATH }}
- uses: actions/download-artifact@v4
with:
name: voicevox_core-aarch64-apple-darwin
path: ${{ env.MACOS_ARM64_PATH }}
- uses: actions/download-artifact@v4
with:
name: voicevox_core-x86_64-apple-darwin
path: ${{ env.MACOS_X64_PATH }}
- name: Create xcframework
id: create-xcframework
run: |
build_util/make_ios_xcframework.bash
build_util/make_xcframework.bash
echo "output_asset_path=${OUTPUT_ASSET_PATH}" >> "$GITHUB_OUTPUT"
env:
OUTPUT_ASSET_PATH: artifact/voicevox_core-ios-xcframework-cpu
OUTPUT_ASSET_PATH: artifact/voicevox_core-xcframework-cpu
- name: Archive artifact
run: |
cd ${{ steps.create-xcframework.outputs.output_asset_path }}
Expand Down
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iosのみではなくなったため、ファイル名からiosを削除している

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ if [ ! -v IOS_AARCH64_PATH ]; then # AARCH64用のモジュールのディレク
echo "IOS_AARCH64_PATHが未定義です"
exit 1
fi
if [ ! -v MACOS_ARM64_PATH ]; then # MACOS_ARM64用のモジュールのディレクトリ
echo "MACOS_ARM64_PATHが未定義です"
exit 1
fi
if [ ! -v MACOS_X64_PATH ]; then # MACOS_X64用のモジュールのディレクトリ
echo "MACOS_X64_PATHが未定義です"
exit 1
fi
if [ ! -v OUTPUT_ASSET_PATH ]; then # 出力するASSETのディレクトリ
echo "OUTPUT_ASSET_PATHが未定義です"
exit 1
Expand All @@ -37,43 +45,54 @@ 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]}"
platforms=("ios" "sim" "macos")
artifacts=("${IOS_AARCH64_PATH}" "${IOS_AARCH64_SIM_PATH}" "${MACOS_ARM64_PATH}")
for i in "${!platforms[@]}"; do
platform="${platforms[$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}/"
echo "* Copy Framework-${platform} template"
mkdir -p "Framework-${platform}/voicevox_core.framework/Headers"
cp -vr "crates/voicevox_core_c_api/xcframework/Frameworks/${platform}/" "Framework-${platform}/"
cp -v "${artifact}/include/voicevox_core.h" \
"Framework-${arch}/voicevox_core.framework/Headers/voicevox_core.h"
"Framework-${platform}/voicevox_core.framework/Headers/voicevox_core.h"
done

echo "* Create dylib"
# aarch64はdylibをコピー
# iosはdylibをコピー
cp -v "${IOS_AARCH64_PATH}/lib/libvoicevox_core.dylib" \
"Framework-aarch64/voicevox_core.framework/voicevox_core"
"Framework-ios/voicevox_core.framework/voicevox_core"

# simはx86_64とarrch64を合わせてdylib作成
lipo -create "${IOS_X86_64_PATH}/lib/libvoicevox_core.dylib" \
"${IOS_AARCH64_SIM_PATH}/lib/libvoicevox_core.dylib" \
-output "Framework-sim/voicevox_core.framework/voicevox_core"

for arch in "${arches[@]}"; do
echo "* Change ${arch} @rpath"
# macosはx64とarrch64を合わせてdylib作成
lipo -create "${MACOS_X64_PATH}/lib/libvoicevox_core.dylib" \
"${MACOS_ARM64_PATH}/lib/libvoicevox_core.dylib" \
-output "Framework-macos/voicevox_core.framework/voicevox_core"

for platform in "${platforms[@]}"; do
echo "* Change ${platform} @rpath"
# 自身への@rpathを変更
install_name_tool -id "@rpath/voicevox_core.framework/voicevox_core" \
"Framework-${arch}/voicevox_core.framework/voicevox_core"
"Framework-${platform}/voicevox_core.framework/voicevox_core"

# macOSはonnxruntimeを依存に入れていないため、以下の処理はスキップ
if [[ "$platform" == "macos" ]]; then
continue
fi

# onnxruntimeへの@rpathを、voicevox_onnxruntimeのXCFrameworkに変更
install_name_tool -change "@rpath/$dylib_string" \
"@rpath/voicevox_onnxruntime.framework/voicevox_onnxruntime" \
"Framework-${arch}/voicevox_core.framework/voicevox_core"
"Framework-${platform}/voicevox_core.framework/voicevox_core"
done

echo "* Create XCFramework"
mkdir -p "${OUTPUT_ASSET_PATH}"
xcodebuild -create-xcframework \
-framework "Framework-sim/voicevox_core.framework" \
-framework "Framework-aarch64/voicevox_core.framework" \
-framework "Framework-ios/voicevox_core.framework" \
-framework "Framework-macos/voicevox_core.framework" \
-output "${OUTPUT_ASSET_PATH}/voicevox_core.xcframework"
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23B81</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>voicevox_core</string>
<key>CFBundleIdentifier</key>
<string>jp.hiroshiba.voicevox.voicevox-core</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>voicevox_core</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>21C52</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>13.0</string>
<key>DTSDKBuild</key>
<string>21C52</string>
<key>DTSDKName</key>
<string>macosx13.0</string>
<key>DTXcode</key>
<string>1510</string>
<key>DTXcodeBuild</key>
<string>15C65</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module voicevox_core {
umbrella header "voicevox_core.h"
export *

module * { export * }
}
4 changes: 2 additions & 2 deletions crates/voicevox_core_c_api/xcframework/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# xcframeworkフォルダの内容について
## Frameworks

iOS向けの配布ライブラリXCFramework内のFrameworkを作るための雛形です
雛形は端末用とシミュレータ用の2種類です
iOSとmacOS向けの配布ライブラリXCFramework内のFrameworkを作るための雛形です
雛形はiOS端末用(ios)とシミュレータ用(sim)、およびmacOS端末用(macos)の3種類です