From b768c9b0fd425a7651cf4c81cc7eb3f505701bb3 Mon Sep 17 00:00:00 2001 From: Chris Moeller <kode54@gmail.com> Date: Thu, 19 Jul 2012 21:59:13 -0700 Subject: [PATCH] Fixes MSVC projects and adds git version generator tool --- celt/celt.vcxproj | 65 +++++++++++++++++++++++++++++++---- celt/celt.vcxproj.filters | 8 +---- silk/float/silk_float.vcxproj | 60 ++++++++++++++++++++++++++++++-- silk/silk_common.vcxproj | 62 +++++++++++++++++++++++++++++++-- src/opus.vcxproj | 61 +++++++++++++++++++++++++++++--- win32/config.h | 2 +- win32/genversion.bat | 17 +++++++++ 7 files changed, 250 insertions(+), 25 deletions(-) create mode 100644 win32/genversion.bat diff --git a/celt/celt.vcxproj b/celt/celt.vcxproj index 2356d0178..3f4508e89 100644 --- a/celt/celt.vcxproj +++ b/celt/celt.vcxproj @@ -63,7 +63,10 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <CustomBuildBeforeTargets> + </CustomBuildBeforeTargets> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> @@ -77,11 +80,24 @@ <Optimization>Disabled</Optimization> <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -89,13 +105,26 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -114,6 +143,18 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> @@ -123,8 +164,10 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <FloatingPointModel>Fast</FloatingPointModel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -132,14 +175,24 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\..\win32\config.h" /> + <ClInclude Include="..\win32\config.h" /> <ClInclude Include="arch.h" /> <ClInclude Include="bands.h" /> <ClInclude Include="celt.h" /> - <ClInclude Include="celt_header.h" /> - <ClInclude Include="celt_types.h" /> <ClInclude Include="cwrs.h" /> <ClInclude Include="ecintrin.h" /> <ClInclude Include="entcode.h" /> diff --git a/celt/celt.vcxproj.filters b/celt/celt.vcxproj.filters index 66e4fc567..2773bae88 100644 --- a/celt/celt.vcxproj.filters +++ b/celt/celt.vcxproj.filters @@ -24,12 +24,6 @@ <ClInclude Include="celt.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="celt_header.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="celt_types.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="cwrs.h"> <Filter>Header Files</Filter> </ClInclude> @@ -90,7 +84,7 @@ <ClInclude Include="vq.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\..\win32\config.h"> + <ClInclude Include="..\win32\config.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> diff --git a/silk/float/silk_float.vcxproj b/silk/float/silk_float.vcxproj index fff13026f..e25aad5de 100644 --- a/silk/float/silk_float.vcxproj +++ b/silk/float/silk_float.vcxproj @@ -66,7 +66,9 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <CustomBuildBeforeTargets>Compile</CustomBuildBeforeTargets> + </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PrecompiledHeader> @@ -75,6 +77,7 @@ <Optimization>Disabled</Optimization> <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt;../../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -83,6 +86,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\..\win32\genversion.bat" "$(ProjectDir)..\..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -90,8 +105,9 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt;../../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -100,6 +116,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\..\win32\genversion.bat" "$(ProjectDir)..\..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -121,6 +149,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\..\win32\genversion.bat" "$(ProjectDir)..\..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> @@ -130,8 +170,10 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../;../fixed;../../win32;../../celt;../../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FloatingPointModel>Fast</FloatingPointModel> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -142,6 +184,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\..\win32\genversion.bat" "$(ProjectDir)..\..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="apply_sine_window_FLP.c" /> diff --git a/silk/silk_common.vcxproj b/silk/silk_common.vcxproj index a63b2c33e..87eca6090 100644 --- a/silk/silk_common.vcxproj +++ b/silk/silk_common.vcxproj @@ -66,7 +66,10 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <CustomBuildBeforeTargets> + </CustomBuildBeforeTargets> + </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PrecompiledHeader> @@ -75,6 +78,7 @@ <Optimization>Disabled</Optimization> <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -83,6 +87,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -90,8 +106,9 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -100,6 +117,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -111,6 +140,7 @@ <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FloatingPointModel>Fast</FloatingPointModel> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -121,6 +151,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> @@ -130,8 +172,10 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>fixed;float;../win32;../celt;../include</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FloatingPointModel>Fast</FloatingPointModel> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -142,6 +186,18 @@ <Lib> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Lib> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="A2NLSF.c" /> diff --git a/src/opus.vcxproj b/src/opus.vcxproj index 1eeba0b91..9aa3dcb3c 100644 --- a/src/opus.vcxproj +++ b/src/opus.vcxproj @@ -68,12 +68,14 @@ </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> + <CustomBuildBeforeTargets> + </CustomBuildBeforeTargets> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../silk;../celt;../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <Optimization>Disabled</Optimization> @@ -85,12 +87,24 @@ <AdditionalLibraryDirectories>$(SolutionDir)$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>celt.lib;silk_common.lib;silk_fixed.lib;silk_float.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../silk;../celt;../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <Optimization>Disabled</Optimization> @@ -101,6 +115,18 @@ <AdditionalLibraryDirectories>$(SolutionDir)$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>celt.lib;silk_common.lib;silk_fixed.lib;silk_float.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -121,14 +147,27 @@ <AdditionalLibraryDirectories>$(SolutionDir)$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <LinkStatus>false</LinkStatus> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> - <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>../silk;../celt;../win32;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FloatingPointModel>Fast</FloatingPointModel> </ClCompile> <Link> <GenerateDebugInformation>false</GenerateDebugInformation> @@ -139,6 +178,18 @@ <AdditionalLibraryDirectories>$(SolutionDir)$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <LinkStatus>false</LinkStatus> </Link> + <PreBuildEvent> + <Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" OPUS_VERSION</Command> + <Message>Generating version.h</Message> + </PreBuildEvent> + <CustomBuildStep> + <Command> + </Command> + </CustomBuildStep> + <CustomBuildStep> + <Outputs> + </Outputs> + </CustomBuildStep> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="opus.c" /> diff --git a/win32/config.h b/win32/config.h index f41dda329..4b8cb6da4 100644 --- a/win32/config.h +++ b/win32/config.h @@ -19,6 +19,6 @@ #pragma warning(disable : 4996)/* This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. */ #endif -#define OPUS_VERSION "0.9.11 win32" +#include "version.h" #endif CONFIG_H diff --git a/win32/genversion.bat b/win32/genversion.bat new file mode 100644 index 000000000..9bc6917f2 --- /dev/null +++ b/win32/genversion.bat @@ -0,0 +1,17 @@ +@echo off + +for /f %%v in ('git describe --tags --match "v*"') do set version=%%v + +set version_out=#define %2 "%version%" + +echo %version_out% > %1_temp + +echo n | comp %1_temp %1 > NUL 2> NUL + +if not errorlevel 1 goto exit + +copy /y %1_temp %1 + +:exit + +del %1_temp -- GitLab