Dynamically link the runtime for FFMS2 and FFmpeg

This commit is contained in:
Thomas Goyne 2012-11-14 07:46:44 -08:00
parent 558325bce3
commit eaf66ea329
4 changed files with 49 additions and 15 deletions

View File

@ -77,7 +77,7 @@ type ShellWrapper(props : Map<String, String>) =
this.EnvironmentVariables <- [| this.EnvironmentVariables <- [|
"CC=cl"; "CC=cl";
"CPP=cl -E"; "CPP=cl -E";
"CFLAGS=-nologo"; "CFLAGS=-nologo"
"PATH=" + props.["MsysBasePath"] + "\\bin;" + props.["NativeExecutablePath"]; "PATH=" + props.["MsysBasePath"] + "\\bin;" + props.["NativeExecutablePath"];
"INCLUDE=" + props.["AegisubSourceBase"] + "//include;" + props.["IncludePath"]; "INCLUDE=" + props.["AegisubSourceBase"] + "//include;" + props.["IncludePath"];
"LIB=" + props.["AegisubLibraryDir"] + ";" + props.["LibraryPath"]; "LIB=" + props.["AegisubLibraryDir"] + ";" + props.["LibraryPath"];

View File

@ -0,0 +1,34 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Aegisub Project http://www.aegisub.org/
// FFmpeg/libav replace these standard library functions with their own
// implementations by #defining them to avpriv_fn, which results in them
// being declared as __declspec(dllimport) when dynamically linking the
// runtime. To fix this, redeclare them correctly.
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
// Disable the inconsistent dll linkage warning since that's the entire
// point of this
#pragma warning( push )
#pragma warning( disable: 4273 )
int avpriv_snprintf(char *s, size_t n, const char *fmt, ...);
int avpriv_vsnprintf(char *s, size_t n, const char *fmt, va_list ap);
double avpriv_strtod(const char *nptr, char **endptr);
#pragma warning( pop )

View File

@ -36,8 +36,8 @@
<UsingTask TaskName="UpdateFile" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" /> <UsingTask TaskName="UpdateFile" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
<PropertyGroup Label="ConfigArgs"> <PropertyGroup Label="ConfigArgs">
<CfgEnableDebug Condition="'$(Configuration)' == 'Debug'">--enable-debug --disable-stripping</CfgEnableDebug> <CfgDebug Condition="'$(Configuration)' == 'Debug'">--enable-debug --disable-stripping --extra-cflags=-MDd</CfgDebug>
<CfgEnableDebug Condition="'$(Configuration)' == 'Release'">--disable-debug</CfgEnableDebug> <CfgDebug Condition="'$(Configuration)' == 'Release'">--disable-debug --extra-cflags=-MD</CfgDebug>
<CfgArgs> <CfgArgs>
--disable-avfilter --disable-avfilter
--disable-avresample --disable-avresample
@ -61,6 +61,9 @@
--enable-runtime-cpudetect --enable-runtime-cpudetect
--enable-static --enable-static
--extra-cflags=-D_SYSCRT --extra-cflags=-D_SYSCRT
--extra-cflags=-wd4005
--extra-cflags=-wd4189
--extra-cflags=-FI$(MSBuildThisFileDirectory)dynamic_msvcrt.h
--toolchain=msvc --toolchain=msvc
$(CfgEnableDebug) $(CfgEnableDebug)
</CfgArgs> </CfgArgs>

View File

@ -56,18 +56,6 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<!-- Source files --> <!-- Source files -->
<ItemGroup> <ItemGroup>
<InstallHeader Include="$(FfmsSrcDir)\include\ffms.h" /> <InstallHeader Include="$(FfmsSrcDir)\include\ffms.h" />
@ -90,4 +78,13 @@
<ClInclude Include="$(FfmsSrcDir)\src\config\msvc-config.h" /> <ClInclude Include="$(FfmsSrcDir)\src\config\msvc-config.h" />
<ClInclude Include="$(FfmsSrcDir)\src\core\*.h" /> <ClInclude Include="$(FfmsSrcDir)\src\core\*.h" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ffmpeg\ffmpeg.vcxproj">
<Project>{f934ab7b-186b-4e96-b20c-a58c38c1b819}</Project>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{10f22a5a-dd9e-44a1-ba2e-2a9a7c78b0ee}</Project>
</ProjectReference>
</ItemGroup>
</Project> </Project>