Skip to content

Commit

Permalink
ci: ios arm64 only, add ffmpeg xcframework
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 14, 2020
1 parent 932110d commit d27c31d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
strategy:
fail-fast: false
matrix:
config: [RelWithDebInfo]
config: [MinSizeRel]
steps:
- uses: actions/checkout@v2
- name: Checkout source
Expand All @@ -119,7 +119,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: mdk
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
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
- name: Build
shell: bash
working-directory: mdk
Expand All @@ -130,6 +130,7 @@ jobs:
run: |
cmake -P build/${TARGET_OS}/cmake_install.cmake
tools/mksdk.sh mdk-sdk || echo done
lipo -thin arm64 mdk-sdk/lib/libffmpeg.4.dylib -output mdk-sdk/lib/libffmpeg.4.dylib
tar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
mv mdk-sdk*.tar.xz ..
- name: Archieve SDK
Expand Down Expand Up @@ -158,15 +159,15 @@ jobs:
- name: Download iOS sdk
uses: actions/download-artifact@v2
with:
name: mdk-sdk-iOS-RelWithDebInfo
name: mdk-sdk-iOS-MinSizeRel
- name: Install tools
shell: bash
run: brew install p7zip hudochenkov/sshpass/sshpass
- name: make XCFramework and SDK
shell: bash
run: |
export XZ_OPT="-9e --threads=`getconf _NPROCESSORS_ONLN`"
mkdir -p macOS iOS mdk-sdk/lib macOS-arm64 macOS-x86_64
mkdir -p macOS iOS mdk-sdk/{Frameworks,lib} macOS-arm64 macOS-x86_64
tar Jxf mdk-sdk-macOS-x86_64.tar.xz -C macOS-x86_64
tar Jxf mdk-sdk-macOS-arm64.tar.xz -C macOS-arm64
tar Jxf mdk-sdk-iOS.tar.xz -C iOS
Expand All @@ -178,14 +179,17 @@ jobs:
for b in `ls macOS-arm64/mdk-sdk/bin`; do # exes exist in both archs
lipo -create macOS-{arm,x86_}64/mdk-sdk/bin/$b -output macOS/mdk-sdk/bin/$b
done
mv macOS/mdk-sdk/lib/libffmpeg*.dylib macOS/mdk-sdk/lib/cmake mdk-sdk/lib/
mv macOS/mdk-sdk/{bin,doc,include,*.sh} mdk-sdk
mv macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md
mv iOS/mdk-sdk/README.md mdk-sdk/README-iOS.md
cp -af macOS/mdk-sdk/{bin,doc,include,*.sh} mdk-sdk
cp -af macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md
cp -af iOS/mdk-sdk/README.md mdk-sdk/README-iOS.md
# 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)
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
binfw=`find mdk-sdk/lib/mdk.xcframework/ -name "macos-*" -depth 1`
ln -sf ${binfw/mdk-sdk/..}/mdk.framework mdk-sdk/bin
xcodebuild -create-xcframework -library macOS/mdk-sdk/lib/libffmpeg*.dylib -library iOS/mdk-sdk/lib/libffmpeg*.dylib -output mdk-sdk/lib/FFmpeg.xcframework
mdkfw=`find mdk-sdk/lib/mdk.xcframework -name "macos-*" -depth 1`
avfw=`find mdk-sdk/lib/FFmpeg.xcframework -name "macos-*" -depth 1`
# ensure bin/* can Find mdk and ffmpeg
ln -sf ${mdkfw/mdk-sdk/..}/mdk.framework mdk-sdk/Frameworks
ln -sf ${avfw/mdk-sdk/..}/libffmpeg.4.dylib mdk-sdk/Frameworks
tar Jcvf mdk-sdk-apple.tar.xz mdk-sdk
7z a mdk-sdk-apple.zip mdk-sdk
tar Jcvf mdk-sdk-macOS.tar.xz -C macOS .
Expand All @@ -199,8 +203,8 @@ jobs:
- name: Archieve macOS SDK
uses: actions/upload-artifact@v2
with:
name: mdk-sdk-apple
path: mdk-sdk-apple.tar.xz
name: mdk-sdk-macOS
path: mdk-sdk-macOS.tar.xz
- name: Upload to SourceForge
shell: bash
run: |
Expand Down

0 comments on commit d27c31d

Please sign in to comment.