Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Inject product version to Windows resource files from outside
Browse files Browse the repository at this point in the history
This simplifies version change a bit: no more "n,n,n,n" formats for
FILEVERSION and PRODUCTVERSION required.

Ideally, we could get version from Makefile into MSBuild system, but
that would not work well with Visual Studio IDE.

Signed-off-by: Simon Rozman <simon@rozman.si>
  • Loading branch information
rozmansi committed Apr 12, 2023
1 parent 4278a74 commit 307dd70
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Default.Cpp.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>VERSION=3.3.9;VERSION_ARRAY=$([System.String]::Copy('3.3.9').Replace('.',','));%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>VERSION=3.3.9;VERSION_ARRAY=$([System.String]::Copy('3.3.9').Replace('.',','));%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
Expand Down
11 changes: 7 additions & 4 deletions eduVPN.Resources/Resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
#include <winres.h>
#undef APSTUDIO_READONLY_SYMBOLS

#define STRINGIZE(x) #x
#define EXPAND(x) STRINGIZE(x)

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,3,9,0
PRODUCTVERSION 3,3,9,0
FILEVERSION VERSION_ARRAY
PRODUCTVERSION VERSION_ARRAY
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE | VS_FF_PATCHED | VS_FF_PRIVATEBUILD | VS_FF_SPECIALBUILD
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -31,11 +34,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "SURF"
VALUE "FileDescription", "eduVPN Native Resources"
VALUE "FileVersion", "3.3.9"
VALUE "FileVersion", EXPAND(VERSION)
VALUE "LegalCopyright", "Copyright © 2017-2023 The Commons Conservancy"
VALUE "OriginalFilename", "eduVPN.Resources.dll"
VALUE "ProductName", "eduVPN"
VALUE "ProductVersion", "3.3.9"
VALUE "ProductVersion", EXPAND(VERSION)
END
END
BLOCK "VarFileInfo"
Expand Down
11 changes: 7 additions & 4 deletions eduWGSvcHost/Resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@

#include <Messages.rc>

#define STRINGIZE(x) #x
#define EXPAND(x) STRINGIZE(x)

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,3,9,0
PRODUCTVERSION 3,3,9,0
FILEVERSION VERSION_ARRAY
PRODUCTVERSION VERSION_ARRAY
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE | VS_FF_PATCHED | VS_FF_PRIVATEBUILD | VS_FF_SPECIALBUILD
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -33,11 +36,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "SURF"
VALUE "FileDescription", "WireGuard Service Host for eduVPN Client"
VALUE "FileVersion", "3.3.9"
VALUE "FileVersion", EXPAND(VERSION)
VALUE "LegalCopyright", "Copyright © 2022-2023 The Commons Conservancy"
VALUE "OriginalFilename", "eduWGSvcHost.exe"
VALUE "ProductName", "eduVPN"
VALUE "ProductVersion", "3.3.9"
VALUE "ProductVersion", EXPAND(VERSION)
END
END
BLOCK "VarFileInfo"
Expand Down

0 comments on commit 307dd70

Please sign in to comment.