shithub: opus-tools

Download patch

ref: 7667c7c6a5c444888a6a36a57c21cab18a8caa37
parent: b76939a3666406e7a82710bee6c56598e8ed35f6
author: Ricardo Constantino <[email protected]>
date: Wed Jan 3 19:00:41 EST 2018

VS2015: add flac support

Signed-off-by: Mark Harris <[email protected]>

--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -24,6 +24,11 @@
   - move /Y opus-artifacts ..\opus
   - git clone -q https://github.com/xiph/ogg.git ..\ogg
   - msbuild "..\ogg\win32\VS2015\libogg_static.sln" /property:Configuration=%CONFIGURATION%;Platform=%PLATFORM% /m /v:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+  - chocolatey install -y nasm
+  - set PATH=%PROGRAMFILES%\nasm;%PATH%
+  - git clone -q https://github.com/xiph/flac.git ..\flac
+  - xcopy /Y ..\ogg\include\ogg\*.h ..\flac\include\ogg\
+  - msbuild "..\flac\FLAC.sln" /t:libFLAC_static /property:Configuration=%CONFIGURATION%;Platform=%PLATFORM%;PlatformToolset=v140 /m /v:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
 
 build:
   project: win32\VS2015\opus-tools.sln
--- a/win32/VS2015/opus-tools.props
+++ b/win32/VS2015/opus-tools.props
@@ -3,11 +3,11 @@
   <ImportGroup Label="PropertySheets" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
-    <LibraryPath>..\..\..\opus\win32\VS2015\$(Platform)\$(Configuration);..\..\..\ogg\win32\VS2015\$(Platform)\$(Configuration);..\..\..\libopusenc\win32\VS2015\$(Platform)\$(Configuration);..\..\..\opusfile\win32\VS2015\$(Platform)\$(Configuration);..\..\..\openssl\$(Platform)\Release\lib;$(LibraryPath)</LibraryPath>
+    <LibraryPath>..\..\..\opus\win32\VS2015\$(Platform)\$(Configuration);..\..\..\ogg\win32\VS2015\$(Platform)\$(Configuration);..\..\..\libopusenc\win32\VS2015\$(Platform)\$(Configuration);..\..\..\opusfile\win32\VS2015\$(Platform)\$(Configuration);..\..\..\flac\objs\$(Platform)\$(Configuration)\lib;..\..\..\flac\objs\$(Configuration)\lib;..\..\..\openssl\$(Platform)\Release\lib;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      <AdditionalIncludeDirectories>..\..\..\ogg\include;..\..\..\libopusenc\include;..\..\..\opusfile\include;..\..\..\opus\include;..\..\..\openssl\$(Platform)\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\ogg\include;..\..\..\libopusenc\include;..\..\..\opusfile\include;..\..\..\opus\include;..\..\..\flac\include;..\..\..\openssl\$(Platform)\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' or '$(Configuration)'=='Release'">
--- a/win32/VS2015/opusdec.vcxproj
+++ b/win32/VS2015/opusdec.vcxproj
@@ -29,13 +29,11 @@
     <ClCompile Include="..\..\src\resample.c" />
     <ClCompile Include="..\..\src\diag_range.c" />
     <ClCompile Include="..\..\win32\unicode_support.c" />
-    <ClCompile Include="..\..\src\flac.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\arch.h" />
     <ClInclude Include="..\..\src\cpusupport.h" />
     <ClInclude Include="..\..\src\diag_range.h" />
-    <ClInclude Include="..\..\src\flac.h" />
     <ClInclude Include="..\..\src\opus_header.h" />
     <ClInclude Include="..\..\src\os_support.h" />
     <ClInclude Include="..\..\src\resample_sse.h" />
--- a/win32/VS2015/opusdec.vcxproj.filters
+++ b/win32/VS2015/opusdec.vcxproj.filters
@@ -17,9 +17,6 @@
     <ClCompile Include="..\..\src\diag_range.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\flac.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\opusdec.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -50,9 +47,6 @@
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\diag_range.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\flac.h">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\opus_header.h">
--- a/win32/config.h
+++ b/win32/config.h
@@ -1,6 +1,11 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
+/* comment to disable flac dependency */
+#define HAVE_LIBFLAC          1
+/* comment to compile with dynamic flac */
+#define FLAC__NO_DLL
+
 #define OUTSIDE_SPEEX         1
 #define OPUSTOOLS             1
 
@@ -9,6 +14,15 @@
 #define getpid _getpid
 #define USE_ALLOCA            1
 #define FLOATING_POINT        1
+
+#ifdef HAVE_LIBFLAC
+#ifdef FLAC__NO_DLL
+    #pragma comment(lib, "libFLAC_static.lib")
+#else
+    #pragma comment(lib, "libFLAC_dynamic.lib")
+#endif
+#endif
+
 #define SPX_RESAMPLE_EXPORT
 #define __SSE__