From 434b71f3c16a949dffd275dcd8bee89fb637cddd Mon Sep 17 00:00:00 2001 From: oltolm Date: Mon, 16 Sep 2024 20:52:52 +0200 Subject: [PATCH] cmake: add support for triplet x64-mingw-static (#15) * cmake: add support for triplet x64-mingw-static * rename build to mingw --- .github/workflows/build.yml | 28 +++++++++++++++++++++++++++- CMakeLists.txt | 4 +++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 595a152..7e6b2c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json name: C/C++ CI on: [push] @@ -24,6 +25,12 @@ jobs: triplet: win-llvm-static-release vcpkg-root: C:\vcpkg extra-args: --overlay-triplets=./triplets + - build: mingw + os: windows-latest + triplet: mingw-static + vcpkg-root: C:\vcpkg + arch: x64 + extra-args: "" - build: macos os: macos-latest triplet: osx-release @@ -37,6 +44,17 @@ jobs: extra-args: --overlay-triplets=./triplets steps: + - run: git config --global core.autocrlf input + - uses: msys2/setup-msys2@v2 + id: msys2 + with: + msystem: CLANG64 + update: true + pacboy: >- + toolchain:p + cmake:p + ninja:p + if: matrix.triplet == 'mingw-static' - uses: actions/checkout@v4 - name: Set up build environment (macos-latest) @@ -65,7 +83,15 @@ jobs: - name: Build ffmpeg run: | - vcpkg ${{ matrix.extra-args }} install ffmpeg[avcodec,avfilter,avdevice,avformat,swresample,swscale]:${{ matrix.arch }}-${{ matrix.triplet }} + vcpkg ${{ matrix.extra-args }} install ffmpeg[avcodec,avfilter,avdevice,avformat,swresample,swscale]:${{ matrix.arch }}-${{ matrix.triplet }} + if: matrix.triplet != 'mingw-static' + + - name: Build ffmpeg (x64-mingw-static) + shell: msys2 {0} + run: | + export PATH=$(cygpath '${{ matrix.vcpkg-root }}'):$PATH + vcpkg ${{ matrix.extra-args }} install ffmpeg[avcodec,avfilter,avdevice,avformat,swresample,swscale]:${{ matrix.arch }}-${{ matrix.triplet }} + if: matrix.triplet == 'mingw-static' - uses: actions/upload-artifact@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index f5f108c..c6c6a5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ elseif (APPLE) set(FFMPEG_PREBUILTS_NAME "ffmpeg-macos") elseif (UNIX) set(FFMPEG_PREBUILTS_NAME "ffmpeg-linux") +elseif (MINGW) + set(FFMPEG_PREBUILTS_NAME "ffmpeg-mingw") else () message(FATAL_ERROR "Unsupported OS.") endif () @@ -76,4 +78,4 @@ target_link_libraries(${FFMPEG_CORE_NAME} INTERFACE "${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swscale.${LIB_EXT}" "${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avutil.${LIB_EXT}" "${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avfilter.${LIB_EXT}" - "${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}") \ No newline at end of file + "${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}")