Skip to content

Commit

Permalink
cmake: add support for triplet x64-mingw-static (#15)
Browse files Browse the repository at this point in the history
* cmake: add support for triplet x64-mingw-static

* rename build to mingw
  • Loading branch information
oltolm authored Sep 16, 2024
1 parent 29123c3 commit 434b71f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: C/C++ CI

on: [push]
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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}")
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}")

0 comments on commit 434b71f

Please sign in to comment.