Move version.bat/h to root and use it for all Visual Studio modules

This commit is contained in:
bnnm 2017-01-15 23:09:37 +01:00
parent b44e3ec617
commit 2c9acb9cf2
13 changed files with 30 additions and 75 deletions

View File

@ -85,7 +85,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
@ -112,7 +112,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
@ -122,7 +122,6 @@
<ClInclude Include="foo_prefs.h" />
<ClInclude Include="foo_vgmstream.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="version.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="foo_input_vgmstream.rc" />

View File

@ -24,9 +24,6 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="foo_input_vgmstream.rc">

View File

@ -23,8 +23,10 @@ extern "C" {
#include "../src/vgmstream.h"
}
#include "foo_vgmstream.h"
#include "version.h"
#ifndef VERSION
#include "../version.h"
#endif
#ifndef VERSION
#define PLUGIN_VERSION __DATE__
#else

View File

@ -14,8 +14,10 @@
#endif
#ifndef VERSION
/* To include the git version number / commit in test.exe, compile outside of Visual Studio and make sure git / sh is in the current PATH */
#define VERSION ""
#include "../version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"
#endif
#define BUFSIZE 0x8000

View File

@ -86,7 +86,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
@ -114,7 +114,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>

View File

@ -1,5 +1,8 @@
@echo off
REM creates or updates version.h
REM params: $1=filename (usually version.h), $2=VARNAME (usually VERSION)
setlocal enableextensions enabledelayedexpansion
cd /d "%~dp0"
@ -10,7 +13,7 @@ if not "%version%"=="" set version=!version:^:=_!
if not "%version%"=="" goto :gotversion
if exist "..\version.mk" goto :getversion
if exist "version.mk" goto :getversion
echo Git cannot be found, nor can version.mk. Generating unknown version.
@ -20,7 +23,7 @@ goto :gotversion
:getversion
for /f "delims== tokens=2" %%v in (..\version.mk) do set version=%%v
for /f "delims== tokens=2" %%v in (version.mk) do set version=%%v
set version=!version:^"=!
set version=!version: =!
@ -34,8 +37,8 @@ echo %version_out%> %1_temp
if %version%==unknown goto :skipgenerate
echo # static version string; update manually before and after every release.> "..\version.mk"
echo %version_mk%>> "..\version.mk"
echo # static version string; update manually before and after every release.> "version.mk"
echo %version_mk%>> "version.mk"
:skipgenerate

0
fb2k/version.h → version.h Executable file → Normal file
View File

View File

@ -23,7 +23,10 @@
#include "resource.h"
#ifndef VERSION
#define VERSION
#include "../version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"
#endif
#define APP_NAME "vgmstream plugin"

View File

@ -88,7 +88,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
@ -118,7 +118,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>

View File

@ -16,11 +16,12 @@
#include "../src/formats.h"
#include "../src/vgmstream.h"
#include "xmpin.h"
#include "version.h"
#ifndef VERSION
#define VERSION
#include "../version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"
#endif
static XMPFUNC_IN *xmpfin;

View File

@ -1,50 +0,0 @@
@echo off
setlocal enableextensions enabledelayedexpansion
cd /d "%~dp0"
for /f %%v in ('git describe --always --tag') do set version=%%v
set version=!version:^:=_!
if not "%version%"=="" goto :gotversion
if exist "..\version.mk" goto :getversion
echo Git cannot be found, nor can version.mk. Generating unknown version.
set version=unknown
goto :gotversion
:getversion
for /f "delims== tokens=2" %%v in (..\version.mk) do set version=%%v
set version=!version:^"=!
set version=!version: =!
:gotversion
set version_out=#define %2 "%version%"
set version_mk=%2 = "%version%"
echo %version_out%> %1_temp
if %version%==unknown goto :skipgenerate
echo # static version string; update manually before and after every release.> "..\version.mk"
echo %version_mk%>> "..\version.mk"
:skipgenerate
echo n | comp %1_temp %1 > NUL 2> NUL
if not errorlevel 1 goto exit
copy /y %1_temp %1 > NUL 2> NUL
:exit
del %1_temp

View File

@ -66,7 +66,7 @@
<ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -89,14 +89,13 @@
<ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)version.bat" "$(ProjectDir)version.h" VERSION</Command>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DllMain.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="version.h" />
<ClInclude Include="xmpfunc.h" />
<ClInclude Include="xmpin.h" />
</ItemGroup>

View File

@ -4,7 +4,6 @@
<ClCompile Include="DllMain.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="version.h" />
<ClInclude Include="xmpfunc.h" />
<ClInclude Include="xmpin.h" />
</ItemGroup>