Skip to content

Commit c92df7b

Browse files
committed
switch to dynamically linked
1 parent 6a6861e commit c92df7b

6 files changed

Lines changed: 65 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- build: windows
3333
os: windows-latest
34-
triplet: win-llvm-static-release
34+
triplet: win-llvm-dynamic-release
3535
vcpkg-root: C:\vcpkg
3636
extra-args: --overlay-triplets=./triplets
3737

@@ -55,7 +55,7 @@ jobs:
5555
os: macos-latest
5656
triplet: osx-release
5757
vcpkg-root: /Users/runner/vcpkg
58-
extra-args: ""
58+
extra-args: --overlay-triplets=./triplets
5959

6060
- build: macos
6161
os: macos-latest
@@ -140,7 +140,13 @@ jobs:
140140
- uses: actions/upload-artifact@v7
141141
with:
142142
name: ffmpeg-${{ matrix.build }}-${{ matrix.arch }}
143-
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/lib
143+
# Dynamic-linkage triplets put the actual runtime library in bin/
144+
# on Windows (.dll; lib/ only has the .lib import stub) and in
145+
# lib/ on Linux/macOS (.so/.dylib); include both so whichever
146+
# applies is captured.
147+
path: |
148+
${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/lib
149+
${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/bin
144150
if: ${{ always() }}
145151

146152
create-release:

triplets/arm64-osx-release.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Overlay of vcpkg's community arm64-osx-release triplet, switched to
2+
# dynamic linkage: SharpEmu P/Invokes directly into these .dylib files at
3+
# runtime instead of linking them into its own bridge.
4+
set(VCPKG_TARGET_ARCHITECTURE arm64)
5+
set(VCPKG_CRT_LINKAGE dynamic)
6+
set(VCPKG_LIBRARY_LINKAGE dynamic)
7+
8+
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
9+
set(VCPKG_OSX_ARCHITECTURES arm64)
10+
11+
set(VCPKG_BUILD_TYPE release)

triplets/universal-osx-release.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(VCPKG_TARGET_ARCHITECTURE arm64 x86_64)
22
set(VCPKG_CRT_LINKAGE dynamic)
3-
set(VCPKG_LIBRARY_LINKAGE static)
3+
set(VCPKG_LIBRARY_LINKAGE dynamic)
44

55
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
66
set(VCPKG_OSX_ARCHITECTURES arm64 x86_64)

triplets/x64-linux-release.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# Overlay of vcpkg's community x64-linux-release triplet. These static
2-
# libraries get linked into a shared library (SharpEmu's
3-
# sharpemu_bink2_bridge.c), which the ELF format requires -fPIC for -- the
4-
# stock triplet doesn't set it, since it assumes linking into a standalone
5-
# executable instead.
1+
# Overlay of vcpkg's community x64-linux-release triplet, switched to
2+
# dynamic linkage: SharpEmu P/Invokes directly into these .so files at
3+
# runtime instead of linking them into its own bridge, so a real shared
4+
# object is what's needed here, not a static archive.
65
set(VCPKG_TARGET_ARCHITECTURE x64)
76
set(VCPKG_CRT_LINKAGE dynamic)
8-
set(VCPKG_LIBRARY_LINKAGE static)
7+
set(VCPKG_LIBRARY_LINKAGE dynamic)
98
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
109
set(VCPKG_BUILD_TYPE release)
11-
12-
set(VCPKG_C_FLAGS "-fPIC")
13-
set(VCPKG_CXX_FLAGS "-fPIC")

triplets/x64-osx-release.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Overlay of vcpkg's community x64-osx-release triplet, switched to dynamic
2+
# linkage: SharpEmu P/Invokes directly into these .dylib files at runtime
3+
# instead of linking them into its own bridge.
4+
set(VCPKG_TARGET_ARCHITECTURE x64)
5+
set(VCPKG_CRT_LINKAGE dynamic)
6+
set(VCPKG_LIBRARY_LINKAGE dynamic)
7+
8+
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
9+
set(VCPKG_OSX_ARCHITECTURES x86_64)
10+
set(VCPKG_BUILD_TYPE release)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dynamic-linkage counterpart of x64-win-llvm-static-release.cmake. SharpEmu
2+
# P/Invokes directly into these FFmpeg DLLs at runtime instead of statically
3+
# linking them into its own bridge, so it needs real .dll files here, not
4+
# .lib static archives.
5+
set(VCPKG_TARGET_ARCHITECTURE x64)
6+
set(VCPKG_CRT_LINKAGE static)
7+
set(VCPKG_LIBRARY_LINKAGE dynamic)
8+
set(VCPKG_BUILD_TYPE release)
9+
10+
## Toolchain setup
11+
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/x64-win-llvm/x64-win-llvm.toolchain.cmake")
12+
set(VCPKG_LOAD_VCVARS_ENV ON) # Setting VCPKG_CHAINLOAD_TOOLCHAIN_FILE deactivates automatic vcvars setup so reenable it!
13+
14+
if(DEFINED VCPKG_PLATFORM_TOOLSET)
15+
set(VCPKG_PLATFORM_TOOLSET ClangCL)
16+
endif()
17+
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED "LLVMInstallDir;LLVMToolsVersion") # For the ClangCL toolset
18+
set(VCPKG_QT_TARGET_MKSPEC win32-clang-msvc) # For Qt5
19+
20+
## Policy settings
21+
set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)
22+
set(VCPKG_POLICY_SKIP_DUMPBIN_CHECKS enabled)
23+
24+
set(VCPKG_CMAKE_CONFIGURE_OPTIONS
25+
"-DCMAKE_TRY_COMPILE_CONFIGURATION=Release"
26+
)
27+
28+
include("${CMAKE_CURRENT_LIST_DIR}/x64-win-llvm/extra_setup.cmake")
29+
include("${CMAKE_CURRENT_LIST_DIR}/x64-win-llvm/port_specialization.cmake")

0 commit comments

Comments
 (0)