Skip to content

Build

Build #1689

Workflow file for this run

name: Build
# TODO: nuget, vcpkg on macOS, $(brew --prefix llvm)/bin/clang (llvm11), llvm12 is default
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
on:
push:
schedule:
- cron: '0 12 * * 0'
repository_dispatch:
env:
FF_VER: master
LLVM_VER: ${{ vars.LLVM_VER }}
VC_LTL_VER: ${{ vars.VC_LTL_VER }}
NINJA_STATUS: '[%f/%t %e %r]'
SF_PW: ${{ secrets.SF_PW }}
SF_USER: ${{ secrets.SF_USER }}
SF_UPLOAD: ${{ github.event_name != 'repository_dispatch' || github.event.client_payload.ref == 'master' }}
jobs:
macOS:
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: macos-latest
env:
TARGET_OS: 'macOS'
TARGET_ARCH: ${{ matrix.arch }}
LTO_SUFFIX: -lto
strategy:
fail-fast: false
matrix:
config: [MinSizeRel]
arch: [x86_64, arm64] # different minos
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} # https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_dispatch
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: |
./mdk/external
!./mdk/external/lib/macOS/libvulkan.tbd
!./mdk/external/lib/libdav1d.tbd
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
# why may failed to cache/restore /usr/local/bin/sshpass?
# no build cache because build dir content changes but key should not, then no cache save.
- name: Create Build Environment
shell: bash
env:
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- name: Configure CMake
if: ${{ matrix.arch == 'x86_64' }}
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: mdk # TODO: remove
run: |
pwd
cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_X11=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk
- name: Configure CMake
if: ${{ startsWith(matrix.arch, 'arm64') }} # arm64, arm64e
shell: bash
working-directory: mdk
run: |
cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_X11=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk
- name: Build
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS} --parallel
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk*.tar.xz ../mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch }}.tar.xz
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}.tar.xz
- name: Upload to SourceForge
if: ${{ matrix.config == 'RelWithDebInfo' && matrix.arch == 'x86_64' && env.SF_UPLOAD == 'true' }}
shell: bash
run: |
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-${{ matrix.arch }}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
iOS:
runs-on: macos-latest
env:
TARGET_OS: ${{ matrix.os }}${{ matrix.simulator }}
LTO_SUFFIX: -lto
strategy:
fail-fast: false
matrix:
os: [iOS, tvOS, visionOS, macCatalyst]
config: [MinSizeRel]
simulator: ['', Simulator]
exclude:
- os: macCatalyst
simulator: Simulator
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: |
./mdk/external
!./mdk/external/lib/macOS/libvulkan.tbd
!./mdk/external/lib/libdav1d.tbd
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
# why may failed to cache/restore /usr/local/bin/sshpass?
# no build cache because build dir content changes but key should not, then no cache save.
- name: Create Build Environment
shell: bash
env:
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- name: Configure CMake
if: ${{ matrix.os != 'macCatalyst' }}
shell: bash
working-directory: mdk
run: |
minver=8.0
[[ "$TARGET_OS" == "tv"* ]] && minver=10.2 # VT: 10.2+
[[ "$TARGET_OS" == "vision"* ]] && minver=1.0
archs=arm64
[[ "$TARGET_OS" == *"Simulator" ]] && {
archs="arm64;x86_64"
sdk=$TARGET_OS
sdk=${sdk/iOSS/iphones}
sdk=${sdk/tvOSS/appletvs}
sdk=${sdk/visionOSS/xrs}
sdk=${sdk/xrOSS/xrs}
EXTRA_OPTS="-DCMAKE_OSX_SYSROOT=${sdk}"
}
[ ${{ matrix.os }} == visionOS ] && archs=arm64
cmake -GNinja -DFFMPEG_EMBED=1 -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_DEB_INFO=1 -DCMAKE_SYSTEM_NAME=${{ matrix.os }} $EXTRA_OPTS -DCMAKE_OSX_DEPLOYMENT_TARGET=$minver -DCMAKE_OSX_ARCHITECTURES="$archs" -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_IOS_INSTALL_COMBINED=YES -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib
- name: Configure CMake
if: ${{ matrix.os == 'macCatalyst' }}
shell: bash
working-directory: mdk
run: cmake -GNinja -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/macCatalyst.cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk
- name: Build
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS} --parallel
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk*.tar.xz ..
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}.tar.xz
- name: Upload to SourceForge
if: ${{ env.SF_UPLOAD == 'true' }}
shell: bash
run: sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
Apple:
runs-on: macos-latest
needs: [macOS, iOS]
steps:
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app
- uses: actions/checkout@v4
- name: Download macOS x64 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-macOS-x86_64-MinSizeRel
- name: Download macOS arm64 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-macOS-arm64-MinSizeRel
- name: Download iOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-iOS-MinSizeRel
- name: Download iOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-iOSSimulator-MinSizeRel
- name: Download tvOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-tvOS-MinSizeRel
- name: Download tvOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-tvOSSimulator-MinSizeRel
- name: Download visionOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-visionOS-MinSizeRel
- name: Download visionOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-visionOSSimulator-MinSizeRel
- name: Download macCatalyst sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-macCatalyst-MinSizeRel
- name: Install tools
shell: bash
run: brew install hudochenkov/sshpass/sshpass
- name: make XCFramework and SDK
shell: bash
run: |
export XZ_OPT="-9e -T0"
mkdir -p macOS iOS iOSSimulator tvOS tvOSSimulator visionOS visionOSSimulator macCatalyst mdk-sdk/{Frameworks,include,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
tar Jxf mdk-sdk-iOSSimulator.tar.xz -C iOSSimulator
tar Jxf mdk-sdk-tvOS.tar.xz -C tvOS
tar Jxf mdk-sdk-tvOSSimulator.tar.xz -C tvOSSimulator
tar Jxf mdk-sdk-visionOS.tar.xz -C visionOS
tar Jxf mdk-sdk-visionOSSimulator.tar.xz -C visionOSSimulator
tar Jxf mdk-sdk-macCatalyst.tar.xz -C macCatalyst
find .
cp -af macOS-$(uname -m)/mdk-sdk macOS/ # libffmpeg is already fat
lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/mdk -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/mdk
lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework.dSYM/Contents/Resources/DWARF/mdk -output macOS/mdk-sdk/lib/mdk.framework.dSYM/Contents/Resources/DWARF/mdk
if [ -f macOS-arm64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib -a -f macOS-x86_64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib ]; then
lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib
fi
if [ -f macOS-arm64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib -a -f macOS-x86_64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib ]; then
lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib
fi
for b in `ls macOS-arm64/mdk-sdk/bin`; do # exes exist in both archs
if [ -f macOS-x86_64/mdk-sdk/bin/$b ]; then
lipo -create macOS-{arm,x86_}64/mdk-sdk/bin/$b -output macOS/mdk-sdk/bin/$b
fi
done
codesign --force --sign - --deep --timestamp macOS/mdk-sdk/lib/mdk.framework
libffmpeg=$(find macCatalyst/mdk-sdk/lib/mdk.framework -name "libffmpeg*.dylib")
# xcrun bitcode_strip -r $libffmpeg -o $libffmpeg
# xcrun bitcode_strip -r macCatalyst/mdk-sdk/lib/mdk.framework/mdk -o macCatalyst/mdk-sdk/lib/mdk.framework/Versions/Current/mdk
cp -af macOS/mdk-sdk/{bin,doc,*.sh} mdk-sdk
cp -af macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md
cp -af macOS/mdk-sdk/lib/cmake mdk-sdk/lib/
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 -debug-symbols $PWD/iOS/mdk-sdk/lib/mdk.framework.dSYM -framework iOSSimulator/mdk-sdk/lib/mdk.framework -framework tvOS/mdk-sdk/lib/mdk.framework -framework tvOSSimulator/mdk-sdk/lib/mdk.framework -framework visionOS/mdk-sdk/lib/mdk.framework -framework visionOSSimulator/mdk-sdk/lib/mdk.framework -framework macCatalyst/mdk-sdk/lib/mdk.framework -output mdk-sdk/lib/mdk.xcframework
mdkfw=`find mdk-sdk/lib/mdk.xcframework -name "macos-*" -depth 1`
# ensure bin/* can Find mdk and ffmpeg
ln -sf ${mdkfw/mdk-sdk/..}/mdk.framework mdk-sdk/Frameworks
ln -sf ../Frameworks/mdk.framework/Headers mdk-sdk/include/mdk
codesign --force --sign - --deep --timestamp mdk-sdk/lib/mdk.xcframework
# pod requires a file in tarball
gtar Jcvf mdk-sdk-apple.tar.xz mdk-sdk README.md
gtar Jcvf mdk-sdk-macOS.tar.xz -C macOS .
7z a mdk-sdk-apple.zip mdk-sdk
swift package compute-checksum mdk-sdk-apple.zip
- name: Archieve XCFramework SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-apple
path: mdk-sdk-apple.tar.xz
- name: Archieve macOS SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-macOS
path: mdk-sdk-macOS.tar.xz
- name: Upload to SourceForge
if: ${{ env.SF_UPLOAD == 'true' }}
shell: bash
run: |
make -f upload.mk
Windows:
runs-on: windows-latest
env:
TARGET_OS: windows-desktop
strategy:
fail-fast: false
matrix:
config: [RelWithDebInfo]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: true
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_arm64
- name: Configure for win arm64
env:
ARCH: arm64
working-directory: mdk
run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win arm64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-arm64
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Configure for win x86
env:
ARCH: x86
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x86
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x86
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure for win x64
env:
ARCH: x64
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x64
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z
rm -rf mdk-sdk/bin/{x86,arm*}
7z a -ssc -m0=lzma2 -mx=9 -ms=on -mf=off ../mdk-sdk-${{ env.TARGET_OS }}-vs2022-x64.7z mdk-sdk
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-vs2022*.7z
# - name: Upload to SourceForge
# if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }}
# uses: garygrossgarten/github-action-scp@release
# with:
# host: 'frs.sourceforge.net'
# username: ${{ secrets.SF_USER }}
# password: ${{ secrets.SF_PW }}
# local: mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z
# remote: '/home/frs/project/mdk-sdk/nightly/'
Win64_SRC:
if: false
runs-on: windows-latest
env:
TARGET_OS: windows-desktop
ARCH: x64
strategy:
fail-fast: false
matrix:
config: [Debug]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: true
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure for win x64
env:
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DSOURCE_MODULES=core -DR3DSDK=${{ env.R3DSDK }} -DUSE_LTO=0 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x64
- name: Install for win x64
working-directory: mdk
run: cmake --install build/${{ env.TARGET_OS }}-x64
- name: Make SRC SDK
shell: bash
working-directory: mdk
run: |
chmod +x ../mksrc.sh
../mksrc.sh $PWD mdk-sdk-${{ env.ARCH }}
cp -avf ../CMakeLists.txt mdk-sdk-${{ env.ARCH }}
if [[ ${{ matrix.config }} == Debug ]]; then
CRT_SUFFIX=d
fi
cp -avf external/lib/windows/${{ env.ARCH }}/MD$CRT_SUFFIX/{vpl,snappy}.lib mdk-sdk-${{ env.ARCH }}/lib
date +%m%d
7z a -p${{ secrets.SRC_USER }}`date +%m%d` -mhe ../mdk-src-${{ env.TARGET_OS }}-vs2022.7z mdk-sdk-${{ env.ARCH }}
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-src-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-src-${{ env.TARGET_OS }}-vs2022.7z
Windows_LTL:
runs-on: windows-latest
env:
TARGET_OS: windows-desktop
CRT_EXTRA: LTL
strategy:
fail-fast: false
matrix:
config: [RelWithDebInfo]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-${{ env.CRT_EXTRA }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: 'Restore VC-LTL cache'
id: ltl-cache
uses: actions/cache@v4
with:
path: ./mdk/cmake/VC-LTL
key: ltl-${{ vars.VC_LTL_VER }}
- if: ${{ steps.ltl-cache.outputs.cache-hit != 'true' }}
name: Get VC-LTL
shell: bash
working-directory: mdk/cmake
run: |
curl -kL -o ltl.7z https://github.com/Chuyu-Team/VC-LTL5/releases/download/v${VC_LTL_VER}/VC-LTL-${VC_LTL_VER}-Binary.7z
7z x ltl.7z -oVC-LTL
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: true
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Configure for win x86
env:
ARCH: x86
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DVC_LTL=1 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x86
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x86
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure for win x64
env:
ARCH: x64
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DVC_LTL=1 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x64
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022-ltl.7z
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-vs2022-ltl-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-vs2022-ltl.7z
UWP:
runs-on: windows-latest
env:
TARGET_OS: uwp
strategy:
fail-fast: false
matrix:
config: [RelWithDebInfo]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: true
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_arm64
uwp: true
- name: Configure for uwp arm64
env:
ARCH: arm64
working-directory: mdk
run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win arm64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-arm64
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
uwp: true
- name: Configure for uwp x64
env:
ARCH: x64
working-directory: mdk
run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x64
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z
ClangCL:
runs-on: ubuntu-latest
env:
TARGET_OS: ${{ matrix.os }}
VCDIR: '/tmp/winsysroot/msvcrt-dev'
WINDOWSSDKDIR: '/tmp/winsysroot/winsdk'
strategy:
fail-fast: false
matrix:
os: [windows-desktop]
config: [MinSizeRel]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: 'Restore sysroot cache'
id: sysroot-cache
uses: actions/cache@v4
with:
path: /tmp/winsysroot
key: sysroot-${{ env.TARGET_OS }}${{ vars.WINSDKVER }}-vc${{ vars.VCVER }}
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- name: Configure for win arm64
env:
ARCH: arm64
working-directory: mdk
run: |
export WindowsSdkDir=${WINDOWSSDKDIR}
export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version)
cmake -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for arm64
working-directory: mdk
run: cmake --build build/${TARGET_OS}-arm64
- name: Configure for win x86
env:
ARCH: x86
working-directory: mdk
run: |
export WindowsSdkDir=${WINDOWSSDKDIR}
export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version)
cmake -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for x86
working-directory: mdk
run: cmake --build build/${TARGET_OS}-x86
- name: Configure for win x64
env:
ARCH: x64
working-directory: mdk
run: |
export WindowsSdkDir=${WINDOWSSDKDIR}
export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version)
cmake -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for x64
working-directory: mdk
run: cmake --build build/${TARGET_OS}-x64
- name: Make SDK
working-directory: mdk
run: |
../ci-after-build.sh
if [ -f $VCDIR/bin/x64/vcruntime140_1.dll ]; then
mkdir -p mdk-sdk/bin/x64
cp $VCDIR/bin/x64/vcruntime140_1.dll mdk-sdk/bin/x64
7z a mdk-sdk-*.7z mdk-sdk/bin/x64/vcruntime140_1.dll
fi
mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-clang.7z
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-clang-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-clang.7z
- name: Upload to SourceForge
if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }}
run: sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-clang.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
NuGet:
runs-on: ubuntu-latest
needs: [Windows, UWP, Windows_LTL]
steps:
- uses: actions/checkout@v4
- name: Download win32 vs2022 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-windows-desktop-RelWithDebInfo
- name: Download win32 vs2022 ltl sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-ltl-windows-desktop-RelWithDebInfo
- name: Download uwp vs2022 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-uwp-RelWithDebInfo
- name: update build version
shell: bash
run: sed -i "s,\(.*\.\)[0-9]*\(</version>\),\1${GITHUB_RUN_NUMBER}\2," nuget/mdk.nuspec
- name: Make nupkg (VS2022)
run: |
rm -rf mdk-sdk uwp
md5sum mdk-sdk-windows-desktop-vs2022.7z | cut -d ' ' -f1 > mdk-sdk-windows-desktop-vs2022.7z.md5
md5sum mdk-sdk-windows-desktop-vs2022-x64.7z | cut -d ' ' -f1 > mdk-sdk-windows-desktop-vs2022-x64.7z.md5
7z x mdk-sdk-windows-desktop-vs2022.7z
7z x mdk-sdk-uwp-vs2022.7z -o"uwp"
mkdir mdk-sdk/bin/UAP
cp -af uwp/mdk-sdk/bin/* mdk-sdk/bin/UAP
cp nuget/mdk.nuspec mdk-sdk
cp -avf nuget/README.md mdk-sdk
cd mdk-sdk
nuget pack mdk.nuspec
mv *.nupkg ../mdk-vs2022.nupkg
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-nuget
path: 'mdk*.nupkg'
- name: Upload to SourceForge
if: ${{ env.SF_UPLOAD == 'true' }}
shell: bash
run: |
sudo apt update
sudo apt install -y sshpass
make -f upload.mk
Linux:
runs-on: ubuntu-latest
env:
TARGET_OS: linux
LTO_SUFFIX: -lto
strategy:
fail-fast: false
matrix:
config: [MinSizeRel]
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: 'Restore sysroot cache'
id: sysroot-cache
uses: actions/cache@v4
with:
path: ./mdk/sysroot
key: sysroot-${{ env.TARGET_OS }}-${{ vars.LINUX_SYSROOT_ID }}
- name: Create Build Environment
shell: bash
env:
SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: |
sudo apt remove -y libc++1-14 libc++abi1-14 libunwind-14 python3-lldb-14 # conflict with latest llvm
../ci-before-build.sh
- name: Configure for x64
env:
ARCH: amd64
shell: bash
working-directory: mdk
run: cmake -DR3DSDK=$PWD/external/R3DSDK -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for x64
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-amd64
- name: Configure for aarch64
env:
ARCH: arm64
shell: bash
working-directory: mdk
run: cmake -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for aarch64
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-arm64
- name: Configure for armhf
env:
ARCH: armhf
shell: bash
working-directory: mdk
run: cmake -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for armhf
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-armhf
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk*.tar.xz ..
rm -rf mdk-sdk/{bin,lib}/arm*
tar Jcvf ../mdk-sdk-${{ env.TARGET_OS }}-x64.tar.xz mdk-sdk
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}*.tar.xz
- name: Upload to SourceForge
if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }}
shell: bash
run: |
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-x64.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
md5sum mdk-sdk-${TARGET_OS}.tar.xz | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}.tar.xz.md5
md5sum mdk-sdk-${TARGET_OS}-x64.tar.xz | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}-x64.tar.xz.md5
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-*.md5 ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
Android:
runs-on: ubuntu-latest # ndk 25 removed
env:
#FF_VER: 6.1 # 7.0 and master is very slow in avformat_find_stream_info
TARGET_OS: android
LTO_SUFFIX: -lto
MIN_API: 21
NDK_32: r25c
strategy:
fail-fast: false
matrix:
config: [MinSizeRel] # https://github.com/android/ndk/issues/721
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
submodules: 'recursive'
- name: 'Restore External Dep cache'
id: external-dep-cache
uses: actions/cache@v4
with:
path: ./mdk/external
key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }}
- name: Create Build Environment
shell: bash
env:
# SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
working-directory: mdk
run: ../ci-before-build.sh
- name: Configure for arm64-v8a
env:
ARCH: arm64-v8a
shell: bash
working-directory: mdk
run: |
ls ${ANDROID_HOME}/ndk
MIN_API_64=21
[ $MIN_API -gt 21 ] && MIN_API_64=$MIN_API
cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API_64} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for arm64-v8a
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-arm64-v8a
- name: Configure for x86_64
env:
ARCH: x86_64
shell: bash
working-directory: mdk
run: |
MIN_API_64=21
[ $MIN_API -gt 21 ] && MIN_API_64=$MIN_API
cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API_64} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for x86_64
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-x86_64
# - uses: nttld/setup-ndk@v1
# id: setup-ndk
# with:
# ndk-version: ${{ env.NDK_32 }}
# local-cache: false
# - name: 'Restore ndk cache' # setup-ndk not fully cached
# id: ndk-cache
# uses: actions/cache@v4
# with:
# path: ${{ runner.tool_cache }}/ndk/${{ env.NDK_32 }} # /opt/hostedtoolcache
# key: ndk-cache-${{ runner.os }}-${{ env.NDK_32 }}
- name: Configure for armeabi-v7a
env:
ARCH: armeabi-v7a
MIN_API: 21 # 19: android 4.4. ndk25
# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
shell: bash
working-directory: mdk
run: cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for armeabi-v7a
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-armeabi-v7a
- name: Configure for x86
env:
ARCH: x86
MIN_API: 21 # 19: android 4.4. ndk25
# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
shell: bash
working-directory: mdk
run: cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1
- name: Build for x86
shell: bash
working-directory: mdk
run: cmake --build build/${TARGET_OS}-x86
- name: Make SDK
shell: bash
working-directory: mdk
run: |
../ci-after-build.sh
mv mdk-sdk-*.7z ..
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}.7z
- name: Upload to SourceForge
if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }}
shell: bash
run: |
7z d -ssc -m0=lzma2 -mx=9 -ms=on -mf=off mdk-sdk-${TARGET_OS}.7z mdk-sdk/lib/{x86,x86_64}/libmdk.so.dsym
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk/build/android-arm64-v8a/video/libqtav-mediacodec.so ${SF_USER}@frs.sourceforge.net:/home/frs/project/qtav/depends/mediacodec/arm64-v8a
md5sum mdk-sdk-${TARGET_OS}.7z | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}.7z.md5
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-*.md5 ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
abi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/mdk
path: mdk
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }}
fetch-depth: 1
token: ${{ secrets.CLONE_PAT }}
- name: Make SDK
shell: bash
run: |
mkdir -p mdk-sdk/include/abi/mdk
cp -avf mdk/include/mdk/{AudioFormat,AudioFrame,Buffer,ColorSpace,FrameReader,global,MediaInfo,Property,VideoBuffer,VideoFormat,VideoFrame,VideoDecoder,Packet,MediaIO}.h mdk-sdk/include/abi/mdk
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: mdk-abi-sdk
path: mdk-sdk/
- run: sudo apt install -y sshpass p7zip-full
- name: Upload to SourceForge
shell: bash
run: |
7z a mdk-abi-sdk.7z mdk-sdk
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-abi-sdk.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
cd mdk && git describe --always >.version
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no .version ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
- name: test
if: ${{ env.SF_UPLOAD == 'true' }}
run: echo bye
# https://github.com/orgs/community/discussions/26323#discussioncomment-3251451
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
# https://github.blog/changelog/2022-09-08-github-actions-use-github_token-with-workflow_dispatch-and-repository_dispatch/
Dispatch:
runs-on: ubuntu-latest
permissions: write-all
needs: [abi, NuGet, Apple, Linux, Android]
steps:
# - name: 'Trigger Workflow'
# uses: actions/github-script@v7
# with:
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: '${{ github.repository_owner }}',
# repo: 'mdk-examples',
# workflow_id: 'workflows/main.yaml',
# ref: 'master',
# inputs: {
# run_id: ${{ github.run_id }}
# }
# });
- name: Dispatch
if: ${{ env.SF_UPLOAD == 'true' }}
run: |
gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-examples # -f run_id=${{ github.run_id }}
gh workflow run build.yml --repo ${{ github.repository_owner }}/SPV # -f run_id=${{ github.run_id }}
gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-braw -f run_id=${{ github.run_id }}
gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-nvjp2k -f run_id=${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.ACTION_PAT }} # GITHUB_TOKEN?
Release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [Apple, NuGet, Linux, Android, ClangCL]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download iOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-iOS-MinSizeRel
- name: Download iOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-iOSSimulator-MinSizeRel
- name: Download tvOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-tvOS-MinSizeRel
- name: Download tvOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-tvOSSimulator-MinSizeRel
- name: Download visionOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-visionOS-MinSizeRel
- name: Download visionOSSimulator sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-visionOSSimulator-MinSizeRel
- name: Download macCatalyst sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-macCatalyst-MinSizeRel
- name: Download macOS sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-macOS
- name: Download Apple sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-apple
- name: Download win32 vs2022 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-windows-desktop-RelWithDebInfo
- name: Download win32 vs2022 ltl sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-ltl-windows-desktop-RelWithDebInfo
- name: Download uwp vs2022 sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-vs2022-uwp-RelWithDebInfo
- name: Download clang-cl sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-clang-windows-desktop-MinSizeRel
- name: Download linux sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-linux-MinSizeRel
- name: Download android sdk
uses: actions/download-artifact@v4
with:
name: mdk-sdk-android-MinSizeRel
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
body_path: Changelog.md
files: |
*.7z
*.xz