-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set metadata in SRT DLL on Windows (#639)
- Loading branch information
Showing
7 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Script for reading generated version values and updating metadata properties | ||
|
||
#read major / minor version values from version.h (generated by cmake via version.h.in) | ||
$majorVer=99 | ||
$minorVer=99 | ||
$patchVer=0 | ||
$buildNum=0 | ||
|
||
#define regular expressions to be used when checking for #define statements | ||
$versionSniffingRegex = "(\s*#define\s+(\S+)\s+)(\d+)" | ||
|
||
#read generated file, load values from this with regular expression | ||
Get-Content ".\version.h" | Where-Object { $_ -match $versionSniffingRegex } | ForEach-Object { | ||
switch ($Matches[2]) | ||
{ | ||
"SRT_VERSION_MAJOR" { $majorVer = $Matches[3] } | ||
"SRT_VERSION_MINOR" { $minorVer = $Matches[3] } | ||
"SRT_VERSION_PATCH" { $patchVer = $Matches[3] } | ||
"SRT_VERSION_BUILD" { $buildNum = $Matches[3] } | ||
} | ||
} | ||
|
||
$FileDescriptionBranchCommitValue = "SRT Local Build" | ||
|
||
if($Env:APPVEYOR){ | ||
#make AppVeyor update with this new version number | ||
Update-AppveyorBuild -Version "$majorVer.$minorVer.$patchVer.$buildNum" | ||
$FileDescriptionBranchCommitValue = "$Env:APPVEYOR_REPO_NAME - $($Env:APPVEYOR_REPO_BRANCH) ($($Env:APPVEYOR_REPO_COMMIT.substring(0,8)))" | ||
} | ||
|
||
#find C++ resource files and update file description with branch / commit details | ||
$FileDescriptionStringRegex = '(\bVALUE\s+\"FileDescription\"\s*\,\s*\")([^\"]*\\\")*[^\"]*(\")' | ||
|
||
Get-ChildItem -Path "./srtcore/srt_shared.rc" | ForEach-Object { | ||
$fileName = $_ | ||
Write-Host "Processing metadata changes for file: $fileName" | ||
|
||
$FileLines = Get-Content -path $fileName | ||
|
||
for($i=0;$i -lt $FileLines.Count;$i++) | ||
{ | ||
$FileLines[$i] = $FileLines[$i] -Replace $FileDescriptionStringRegex, "`${1}$FileDescriptionBranchCommitValue`${3}" | ||
} | ||
|
||
[System.IO.File]::WriteAllLines($fileName.FullName, $FileLines) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,9 @@ threadname.h | |
utilities.h | ||
window.h | ||
|
||
SOURCES WIN32 SHARED | ||
srt_shared.rc | ||
|
||
PRIVATE HEADERS WIN32 SHARED | ||
../version.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "version.h" | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Version | ||
// | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
#ifdef SRT_VERSION_BUILD | ||
FILEVERSION SRT_VERSION_MAJOR, SRT_VERSION_MINOR, SRT_VERSION_PATCH, SRT_VERSION_BUILD | ||
#else | ||
FILEVERSION SRT_VERSION_MAJOR, SRT_VERSION_MINOR, SRT_VERSION_PATCH | ||
#endif | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x2L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "080904b0" | ||
BEGIN | ||
VALUE "CompanyName", "SRT Alliance" | ||
VALUE "FileDescription", "SRT Local Build" | ||
VALUE "InternalName", "srt.dll" | ||
VALUE "LegalCopyright", "" | ||
VALUE "OriginalFilename", "srt.dll" | ||
VALUE "ProductName", "SRT" | ||
VALUE "ProductVersion", SRT_VERSION_STRING | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x809, 1200 | ||
END | ||
END | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters