btc-ag / service-idl

Xtext-based Service IDL (Interface Definition Language) and Code Generators for Protobuf, C++, Java and .NET
Eclipse Public License 2.0
8 stars 8 forks source link

Generate resource files #160

Closed sigiesec closed 6 years ago

sigiesec commented 6 years ago

Resource files must be generated to ensure that the built C++ binaries contain the correct metadata.

For each IDL file, the a file res/sharedVersion.h must be generated with the following content (version numbers must be adapted):

// ==================================
// version information
// ==================================
// define version numbers
#define VER_MAJOR 1
#define VER_MINOR 10
#define VER_BUILD 0
#define VER_BUILD_ID 0
#define VER_REVISION_INFO ""
#define VER_SUFFIX ""

// build default file and product version
#define FILE_VER VER_MAJOR,VER_MINOR,VER_BUILD,VER_BUILD_ID
#define PROD_VER FILE_VER

// special macros that convert numerical version tokens into string tokens
// can't use actual int and string types because they won't work in the RC files
#define STRINGIZE2(x) #x
#define STRINGIZE(x) STRINGIZE2(x)

// build file and product version as string
#define STR_FILE_VER STRINGIZE(VER_MAJOR) "." STRINGIZE(VER_MINOR) "." STRINGIZE(VER_BUILD) "." STRINGIZE(VER_BUILD_ID) STRINGIZE2(VER_SUFFIX) "+" STRINGIZE2(VER_REVISION_INFO)
#define STR_PROD_VER STR_FILE_VER

// ==================================
// company information
// ==================================
#define STR_COMPANY             "BTC Business Technology Consulting AG"

// ==================================
// copyright information
// ==================================
#define STR_COPYRIGHT_INFO      "Copyright (C) BTC Business Technology Consulting AG 2018"

For each shared library and executable module (not static library module), the following files must be generated (names and paths must be adapted):

// Next default values for new objects //

ifdef APSTUDIO_INVOKED

ifndef APSTUDIO_READONLY_SYMBOLS

define _APS_NEXT_RESOURCE_VALUE 102

define _APS_NEXT_COMMAND_VALUE 40001

define _APS_NEXT_CONTROL_VALUE 1001

define _APS_NEXT_SYMED_VALUE 101

endif

endif

* res/version.rc with the following content:

// Microsoft Visual C++ generated resource script. //

include "resource.h"

define APSTUDIO_READONLY_SYMBOLS

///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. //

include "windows.h"

/////////////////////////////////////////////////////////////////////////////

undef APSTUDIO_READONLY_SYMBOLS

///////////////////////////////////////////////////////////////////////////// // Deutsch (Deutschland) resources

if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)

LANGUAGE LANG_GERMAN, SUBLANG_GERMAN

ifdef APSTUDIO_INVOKED

///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE //

1 TEXTINCLUDE BEGIN "resource.h\0" END

2 TEXTINCLUDE BEGIN "\r\n" "\0" END

endif // APSTUDIO_INVOKED

///////////////////////////////////////////////////////////////////////////// // // Version //

include <Commons/res/sharedVersion.h>

VS_VERSION_INFO VERSIONINFO FILEVERSION FILE_VER PRODUCTVERSION PROD_VER FILEFLAGSMASK 0x3fL

ifdef _DEBUG

FILEFLAGS 0x1L

else

FILEFLAGS 0x0L

endif

FILEOS 0x40004L FILETYPE 0x0L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040704b0" BEGIN VALUE "CompanyName", STR_COMPANY VALUE "LegalCopyright", STR_COPYRIGHT_INFO VALUE "FileDescription", "Dynamic Link Library" VALUE "FileVersion", STR_FILE_VER VALUE "InternalName", "BTC.CAB.Commons.Core" VALUE "OriginalFilename", "BTC.CAB.Commons.Core" VALUE "ProductName", "BTC.CAB.Commons.Core" VALUE "ProductVersion", STR_PROD_VER END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x407, 1200 END END

endif // German (Germany) resources

/////////////////////////////////////////////////////////////////////////////

ifndef APSTUDIO_INVOKED

///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. //

/////////////////////////////////////////////////////////////////////////////

endif // not APSTUDIO_INVOKED



The generated CMakeLists.txt already contains references to these files.