mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added version info to DLL
This commit is contained in:
parent
148d7287e8
commit
c8723e171b
38
DDrawCompat/DDrawCompat.rc
Normal file
38
DDrawCompat/DDrawCompat.rc
Normal file
@ -0,0 +1,38 @@
|
||||
#include <winver.h>
|
||||
#include <version.h>
|
||||
|
||||
#ifdef SPECIALBUILD
|
||||
#define VERSION_PRODUCT_NAME "DDrawCompat (" SPECIALBUILD ")"
|
||||
#else
|
||||
#define VERSION_PRODUCT_NAME "DDrawCompat"
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_NUMBER
|
||||
PRODUCTVERSION VERSION_NUMBER
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "04090000"
|
||||
{
|
||||
VALUE "CompanyName", ""
|
||||
VALUE "FileDescription", "https://github.com/narzoul/DDrawCompat"
|
||||
VALUE "FileVersion", VERSION_STRING
|
||||
VALUE "InternalName", "ddraw.dll"
|
||||
VALUE "LegalCopyright", "BSD Zero Clause License"
|
||||
VALUE "OriginalFilename", "ddraw.dll"
|
||||
VALUE "ProductName", VERSION_PRODUCT_NAME
|
||||
VALUE "ProductVersion", VERSION_STRING
|
||||
}
|
||||
}
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x409, 0
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>DDrawCompat</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@ -62,18 +63,24 @@
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>ddraw</TargetName>
|
||||
<IncludePath>$(ProjectDir);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithDebugLogs|Win32'">
|
||||
<TargetName>ddraw</TargetName>
|
||||
<IncludePath>$(ProjectDir);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@ -94,6 +101,14 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -File genversion.ps1 "$(IntDir)version.h"</Command>
|
||||
<Message>Generating version information</Message>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(IntDir)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>SPECIALBUILD=\"$(Configuration)\"</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
@ -112,6 +127,13 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -File genversion.ps1 "$(IntDir)version.h"</Command>
|
||||
<Message>Generating version information</Message>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(IntDir)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithDebugLogs|Win32'">
|
||||
<ClCompile>
|
||||
@ -130,6 +152,14 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -File genversion.ps1 "$(IntDir)version.h"</Command>
|
||||
<Message>Generating version information</Message>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(IntDir)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>SPECIALBUILD=\"$(Configuration)\"</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common\CompatPtr.h" />
|
||||
@ -309,6 +339,12 @@
|
||||
<ClCompile Include="Win32\Registry.cpp" />
|
||||
<ClCompile Include="Win32\WaitFunctions.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="DDrawCompat.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="genversion.ps1" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -606,4 +606,14 @@
|
||||
<Filter>Source Files\Gdi</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="DDrawCompat.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="genversion.ps1">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
35
DDrawCompat/genversion.ps1
Normal file
35
DDrawCompat/genversion.ps1
Normal file
@ -0,0 +1,35 @@
|
||||
Param ($VersionFile)
|
||||
|
||||
Try {
|
||||
$VersionString = git describe --tags --dirty --match v[0-9]*
|
||||
}
|
||||
Catch [System.Management.Automation.CommandNotFoundException] {
|
||||
Write-Host 'warning: Git was not found in the system PATH. Version info will be missing from the DLL.'
|
||||
}
|
||||
|
||||
If ( ($VersionString -is [String]) -and ($VersionString -match '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$') ) {
|
||||
$VersionNumber = $VersionString.Split('-', 2)[0].Substring(1).Replace('.', ',') + ",0"
|
||||
}
|
||||
Else {
|
||||
$VersionString = 'unknown'
|
||||
$VersionNumber = '0,0,0,0'
|
||||
}
|
||||
|
||||
$FileContent = @"
|
||||
#define VERSION_NUMBER $VersionNumber
|
||||
#define VERSION_STRING "$VersionString"
|
||||
"@
|
||||
|
||||
Try {
|
||||
$PrevFileContent = [System.IO.File]::ReadAllText($VersionFile).Trim()
|
||||
}
|
||||
Catch [System.IO.FileNotFoundException] {
|
||||
}
|
||||
|
||||
If ( $FileContent -eq $PrevFileContent ) {
|
||||
Write-Host "Version: $VersionString (same as previous build)"
|
||||
}
|
||||
Else {
|
||||
Write-Host "Version: $VersionString (differs from previous build)"
|
||||
$FileContent | Out-File -FilePath $VersionFile
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user