Skip to content

Commit 1c6ae67

Browse files
committed
feat: add ffmpeg-fake vcpkg
1 parent 460c2c7 commit 1c6ae67

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,7 @@ $RECYCLE.BIN/
455455

456456
# Extensions Projects
457457
/[Ee]xtensions/
458+
459+
# vcpkg
460+
/TuneLab/vcpkg/
461+
/TuneLab/scripts/vcpkg-overlay/

TuneLab/TuneLab.csproj

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
<LangVersion>latest</LangVersion>
1111
<Version>1.5.10</Version>
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13+
<VcpkgRoot Condition="'$(VCPKG_ROOT)' != '' AND Exists('$(VCPKG_ROOT)\vcpkg.exe')">$(VCPKG_ROOT)</VcpkgRoot>
14+
<VcpkgRoot Condition="'$(VCPKG_ROOT)' != '' AND Exists('$(VCPKG_ROOT)\vcpkg')">$(VCPKG_ROOT)</VcpkgRoot>
15+
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$(MSBuildThisFileDirectory)vcpkg</VcpkgRoot>
16+
<ScriptsPath>$(MSBuildThisFileDirectory)scripts\</ScriptsPath>
17+
<VcpkgOverlayRoot>$(ScriptsPath)vcpkg-overlay\</VcpkgOverlayRoot>
18+
<!-- 定义平台相关的路径 -->
19+
<VcpkgTriplet Condition="'$(OS)' == 'Windows_NT'">x64-windows</VcpkgTriplet>
20+
<VcpkgTriplet Condition="'$(OS)' == 'Unix' AND $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))">x64-osx</VcpkgTriplet>
21+
<VcpkgTriplet Condition="'$(OS)' == 'Unix' AND $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))">x64-linux</VcpkgTriplet>
1322
</PropertyGroup>
1423

1524
<ItemGroup>
@@ -56,4 +65,28 @@
5665
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5766
</None>
5867
</ItemGroup>
68+
69+
<!-- 自定义目标:检查并安装 vcpkg -->
70+
<Target Name="InstallVcpkg" BeforeTargets="Build">
71+
<Exec Command="git clone https://github.com/SineStriker/vcpkg-overlay.git $(VcpkgOverlayRoot)" Condition="!Exists('$(VcpkgOverlayRoot)')" />
72+
<Exec Command="git clone https://github.com/microsoft/vcpkg.git $(VcpkgRoot)" Condition="!Exists('$(VcpkgRoot)')" />
73+
<!-- Windows -->
74+
<Exec Command="$(VcpkgRoot)\bootstrap-vcpkg.bat" Condition="'$(OS)' == 'Windows_NT' AND !Exists('$(VcpkgRoot)\vcpkg.exe')" />
75+
<!-- macOS/Linux -->
76+
<Exec Command="$(VcpkgRoot)\bootstrap-vcpkg.sh" Condition="'$(OS)' == 'Unix' AND !Exists('$(VcpkgRoot)\vcpkg')" />
77+
<Exec Command="$(VcpkgRoot)\vcpkg install --x-manifest-root=$(ScriptsPath)vcpkg-manifest --x-install-root=$(VcpkgOverlayRoot)\installed --triplet $(VcpkgTriplet)" />
78+
</Target>
79+
80+
<!-- 将 FFmpeg 的动态库复制到输出目录 -->
81+
<Target Name="CopyLibraries" AfterTargets="Build">
82+
<ItemGroup>
83+
<!-- Windows -->
84+
<FFmpegLibraries Include="$(VcpkgOverlayRoot)\installed\$(VcpkgTriplet)\bin\*.dll" Condition="'$(OS)' == 'Windows_NT'" />
85+
<!-- macOS -->
86+
<FFmpegLibraries Include="$(VcpkgOverlayRoot)\installed\$(VcpkgTriplet)\lib\*.dylib" Condition="'$(OS)' == 'Unix' AND $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))" />
87+
<!-- Linux -->
88+
<FFmpegLibraries Include="$(VcpkgOverlayRoot)\installed\$(VcpkgTriplet)\lib\*.so" Condition="'$(OS)' == 'Unix' AND $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))" />
89+
</ItemGroup>
90+
<Copy SourceFiles="@(FFmpegLibraries)" DestinationFolder="$(OutputPath)\ffmpeg" />
91+
</Target>
5992
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3+
"dependencies": [
4+
"ffmpeg-fake"
5+
],
6+
"vcpkg-configuration": {
7+
"overlay-ports": [
8+
"../vcpkg-overlay/ports"
9+
],
10+
"overlay-triplets": [
11+
"../vcpkg-overlay/triplets"
12+
]
13+
}
14+
}

0 commit comments

Comments
 (0)