Skip to content

Commit d27c31d

Browse files
committed
ci: ios arm64 only, add ffmpeg xcframework
1 parent 932110d commit d27c31d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
strategy:
101101
fail-fast: false
102102
matrix:
103-
config: [RelWithDebInfo]
103+
config: [MinSizeRel]
104104
steps:
105105
- uses: actions/checkout@v2
106106
- name: Checkout source
@@ -119,7 +119,7 @@ jobs:
119119
- name: Configure CMake
120120
shell: bash
121121
working-directory: mdk
122-
run: cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/ios.cmake -DIOS_DEPLOYMENT_TARGET=6.0 -DIOS_ARCH="arm64;armv7" -DIOS_BITCODE=1 -DIOS_BITCODE_MARKER=1 -H. -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=0 # FFMPEG_EMBED=0 to copy libffmpeg.4.dylib
122+
run: cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/ios.cmake -DIOS_DEPLOYMENT_TARGET=8.0 -DIOS_ARCH="arm64" -DIOS_BITCODE=1 -DIOS_BITCODE_MARKER=1 -H. -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=0 # FFMPEG_EMBED=0 to copy libffmpeg.4.dylib
123123
- name: Build
124124
shell: bash
125125
working-directory: mdk
@@ -130,6 +130,7 @@ jobs:
130130
run: |
131131
cmake -P build/${TARGET_OS}/cmake_install.cmake
132132
tools/mksdk.sh mdk-sdk || echo done
133+
lipo -thin arm64 mdk-sdk/lib/libffmpeg.4.dylib -output mdk-sdk/lib/libffmpeg.4.dylib
133134
tar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
134135
mv mdk-sdk*.tar.xz ..
135136
- name: Archieve SDK
@@ -158,15 +159,15 @@ jobs:
158159
- name: Download iOS sdk
159160
uses: actions/download-artifact@v2
160161
with:
161-
name: mdk-sdk-iOS-RelWithDebInfo
162+
name: mdk-sdk-iOS-MinSizeRel
162163
- name: Install tools
163164
shell: bash
164165
run: brew install p7zip hudochenkov/sshpass/sshpass
165166
- name: make XCFramework and SDK
166167
shell: bash
167168
run: |
168169
export XZ_OPT="-9e --threads=`getconf _NPROCESSORS_ONLN`"
169-
mkdir -p macOS iOS mdk-sdk/lib macOS-arm64 macOS-x86_64
170+
mkdir -p macOS iOS mdk-sdk/{Frameworks,lib} macOS-arm64 macOS-x86_64
170171
tar Jxf mdk-sdk-macOS-x86_64.tar.xz -C macOS-x86_64
171172
tar Jxf mdk-sdk-macOS-arm64.tar.xz -C macOS-arm64
172173
tar Jxf mdk-sdk-iOS.tar.xz -C iOS
@@ -178,14 +179,17 @@ jobs:
178179
for b in `ls macOS-arm64/mdk-sdk/bin`; do # exes exist in both archs
179180
lipo -create macOS-{arm,x86_}64/mdk-sdk/bin/$b -output macOS/mdk-sdk/bin/$b
180181
done
181-
mv macOS/mdk-sdk/lib/libffmpeg*.dylib macOS/mdk-sdk/lib/cmake mdk-sdk/lib/
182-
mv macOS/mdk-sdk/{bin,doc,include,*.sh} mdk-sdk
183-
mv macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md
184-
mv iOS/mdk-sdk/README.md mdk-sdk/README-iOS.md
182+
cp -af macOS/mdk-sdk/{bin,doc,include,*.sh} mdk-sdk
183+
cp -af macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md
184+
cp -af iOS/mdk-sdk/README.md mdk-sdk/README-iOS.md
185185
# https://developer.apple.com/forums/thread/655768 (error: the path does not point to a valid debug symbols file: macOS/mdk-sdk/lib/mdk.framework.dSYM)
186186
xcodebuild -create-xcframework -framework macOS/mdk-sdk/lib/mdk.framework -debug-symbols $PWD/macOS/mdk-sdk/lib/mdk.framework.dSYM -framework iOS/mdk-sdk/lib/mdk.framework -output mdk-sdk/lib/mdk.xcframework
187-
binfw=`find mdk-sdk/lib/mdk.xcframework/ -name "macos-*" -depth 1`
188-
ln -sf ${binfw/mdk-sdk/..}/mdk.framework mdk-sdk/bin
187+
xcodebuild -create-xcframework -library macOS/mdk-sdk/lib/libffmpeg*.dylib -library iOS/mdk-sdk/lib/libffmpeg*.dylib -output mdk-sdk/lib/FFmpeg.xcframework
188+
mdkfw=`find mdk-sdk/lib/mdk.xcframework -name "macos-*" -depth 1`
189+
avfw=`find mdk-sdk/lib/FFmpeg.xcframework -name "macos-*" -depth 1`
190+
# ensure bin/* can Find mdk and ffmpeg
191+
ln -sf ${mdkfw/mdk-sdk/..}/mdk.framework mdk-sdk/Frameworks
192+
ln -sf ${avfw/mdk-sdk/..}/libffmpeg.4.dylib mdk-sdk/Frameworks
189193
tar Jcvf mdk-sdk-apple.tar.xz mdk-sdk
190194
7z a mdk-sdk-apple.zip mdk-sdk
191195
tar Jcvf mdk-sdk-macOS.tar.xz -C macOS .
@@ -199,8 +203,8 @@ jobs:
199203
- name: Archieve macOS SDK
200204
uses: actions/upload-artifact@v2
201205
with:
202-
name: mdk-sdk-apple
203-
path: mdk-sdk-apple.tar.xz
206+
name: mdk-sdk-macOS
207+
path: mdk-sdk-macOS.tar.xz
204208
- name: Upload to SourceForge
205209
shell: bash
206210
run: |

0 commit comments

Comments
 (0)