Author Topic: Creating Version Info  (Read 9605 times)

Shlaklava

  • Guest
Creating Version Info
« on: August 25, 2007, 08:04:33 am »
When compiling my project in other IDEs such as Bloodshed DevC++ I was able to attach version info to the executable description. Is there any way to do that in Code::Blocks?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9614
Re: Creating Version Info
« Reply #1 on: August 25, 2007, 01:00:32 pm »
Is there any way to do that in Code::Blocks?
Sure. You only need to the version info part to your RC file (assuming you already have one, for icons or similar). If not: Create a new RC file and add the part. C::B will compile and link it for you if you just add the RC file to your project. There is VersionInfo plugin for C::B that might help you to fill the resource content automatically... but I never tried that -> but it sounds interesting though...
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Shlaklava

  • Guest
Re: Creating Version Info
« Reply #2 on: August 25, 2007, 04:38:02 pm »
Thank you very much. Now it will be much easier to my Beta Testers what version they have.


Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Creating Version Info
« Reply #4 on: August 25, 2007, 06:09:36 pm »
The autoversioning plugin that I did may help you with that, it generate a version.h with various variable declarations and two defines to use on rc files. I haven't tested it with rc files but it should be something like this:

Code
#include "version.h" //File generated by the plugin with the 
//AutoVersion::RC_FILEVERSION and
//AutoVersion::RC_FILEVERSION_STRING
//defines.

aaaa ICON "app.ico"


1 VERSIONINFO
FILEVERSION AutoVersion::RC_FILEVERSION
PRODUCTVERSION AutoVersion::RC_FILEVERSION

FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
  FILEFLAGS 0x1L
#else
  FILEFLAGS 0x0L
#endif

FILEOS 0x4L
FILETYPE 0x1L    // 0x1L = EXE, 0x2L = DLL
FILESUBTYPE 0x0L

BEGIN
   BLOCK "StringFileInfo"
   BEGIN

      BLOCK "040904e4"
      BEGIN
         VALUE "CompanyName", "My Company"
         VALUE "LegalCopyright", "(c) 2007 My Copyrights"
         VALUE "FileDescription", "Blah"
         VALUE "FileVersion", AutoVersion::RC_FILEVERSION_STRING
         VALUE "InternalName", "AppName"
         VALUE "OriginalFilename", "app.exe"
         VALUE "ProductName", "Appname blahh"
         VALUE "ProductVersion", AutoVersion::RC_FILEVERSION_STRING
         VALUE "Comments", "This is a beta app"
      END
   END

   BLOCK "VarFileInfo"
   BEGIN
      VALUE "Translation", 0x409, 1252
   END

END

If you want to test it follow the links on my signature for mor info on the forum and downloads. I have created also a berlios account for it. If something goes wrong or goes fine I will appreciate if you report it :D. I think that the plugin should also generate an rc file under windows, that should be a feature maybe. :roll:
« Last Edit: August 26, 2007, 03:52:19 pm by JGM »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9614
Re: Creating Version Info
« Reply #5 on: August 25, 2007, 07:30:45 pm »
I think that the plugin should also generate an rc file under windows, that should be a feature maybe. :roll:
Definitely. In fact the version info I use is even more detailed than the one you have just shown. Here is how it looks like:
Code
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

VS_VERSION_INFO    VERSIONINFO
  FILEVERSION      1,0,0,1
  PRODUCTVERSION   1,0,0,1
  FILEFLAGSMASK    0x3fL // VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
  FILEFLAGS        0x1L  // VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
#else
  FILEFLAGS        0x0L  // final version
#endif
  FILEOS           VOS_NT_WINDOWS32
  FILETYPE         VFT_APP
  FILESUBTYPE      VFT2_UNKNOWN // not used
{
  BLOCK "StringFileInfo"
  {
    BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
    {
      VALUE "Build",            "August 2007\0"
      VALUE "Comments",         "Free for personal use only.\0"
      VALUE "CompanyName",      "Fake Company\0"
      VALUE "Developer",        "The Developer\0"
      VALUE "FileDescription",  "Application implementing something\0"
      VALUE "FileVersion",      "1.0.000\0"
      VALUE "InternalName",     "AppInternalName\0"
      VALUE "LegalCopyright",   "Copyright (C) 2007 Fake Company\0"
      VALUE "LegalTrademarks",  "All rights reserved.\0"
      VALUE "OriginalFilename", "TheEXE.exe\0"
      VALUE "PrivateBuild",     "\0"
      VALUE "ProductName",      "The EXE\0"
      VALUE "ProductVersion",   "1.0.000\0"
      VALUE "SpecialBuild",     "\0"
      VALUE "Support",          "TheEXE at fake-domain.com\0"
      VALUE "Users",            "Unlimited.\0"
    } // BLOCK "040904E4"
  } // BLOCK "StringFileInfo"
  BLOCK "VarFileInfo"
  {
    VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4
  } // BLOCK "VarFileInfo"
}
As you can see - a file version plugin (windows only) should offer a lot more than you describe. And a lot of it has nothing to do with versioning. So honestly: I think it's better to handle these things in another plugin (for Windows only). Hence this one *might* use the macros of the autoversioning plugin... (IMHO).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Creating Version Info
« Reply #6 on: August 25, 2007, 07:47:35 pm »
I think it's better to handle these things in another plugin (for Windows only). Hence this one *might* use the macros of the autoversioning plugin... (IMHO).
With regards, Morten.

Ok I will do the plugin, as I will benefit from it also :) I will also follow your opinion of using the autoversioning plugin when available for the macros.

What name you think it should be for the plugin? I doesn't have any idea :?.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9614
Re: Creating Version Info
« Reply #7 on: August 25, 2007, 07:59:53 pm »
Ok I will do the plugin, as I will benefit from it also :)
I honestly didn't mean to push you to that step - but I'm looking forward to it... ;-)

What name you think it should be for the plugin?
VersionInfo plugin? ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Creating Version Info
« Reply #8 on: August 25, 2007, 08:31:18 pm »
I honestly didn't mean to push you to that step - but I'm looking forward to it... ;-)

Thats okay :)

VersionInfo plugin? ;-)

OK, now I'm going to work on my car to change the oil, filter and sparks. When I finish that and the every day tasks of the home, I will start on it. Is good to improve my programming skills and exercise my mind. :D

THe plugin should be something easy.

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: Creating Version Info
« Reply #9 on: August 25, 2007, 09:19:20 pm »
One step further would mean to build some kind of ResourceBuilder plugin.
It would be able to
- customize application executable icon
- add icons, bitmaps, binary files to executable
- add version info
- add menus, string tables, accelerators
thus creating the .rc file automatically.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Creating Version Info
« Reply #10 on: August 25, 2007, 10:53:10 pm »
I finished my daily tasks. :D

One step further would mean to build some kind of ResourceBuilder plugin.
It would be able to
- .. bitmaps, binary files to executable
- add menus, string tables, accelerators
thus creating the .rc file automatically.

Whooo!! I will have to read some documentation of microsoft rc files and create some small parser for all that (may be regular explressions) :idea:.

Well, and create some GUI with a data grid to edit all that resources by type. This is not so easy now for a novice like me jeje, but is a good idea and good for learning. :)

raph:

Could you point me to good documentation of rc files, because I have never used:
- menus,
- string tables,
- accelerators,
- binary files
- And I don't remember if Bitmaps
inside rc files.

I will start this when I get a bath, I smell to oil  :shock:
« Last Edit: August 25, 2007, 10:54:41 pm by JGM »

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: Creating Version Info
« Reply #11 on: August 25, 2007, 11:22:36 pm »
You really want to do this? cool :)

You will get all you want from the msdn here.
I don't know whether windres (mingw resource compiler) does have the very same syntax like Microsoft's rc.
Quick reference about windres syntax.
A very nice and comfortable way to understand the windows resource system is to play around with ResourceHacker (or change some existing application interfaces you don't like  :D).

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Creating Version Info
« Reply #12 on: August 26, 2007, 05:53:41 am »
Does it exist some equivalent for linux?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Creating Version Info
« Reply #13 on: August 26, 2007, 06:18:21 am »
Does it exist some equivalent for linux?

No. On Linux, RC files are not necessary.
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9614
Re: Creating Version Info
« Reply #14 on: August 26, 2007, 09:57:08 am »
One step further would mean to build some kind of ResourceBuilder plugin.
It would be able to
- customize application executable icon
- add icons, bitmaps, binary files to executable
- add version info
- add menus, string tables, accelerators
thus creating the .rc file automatically.
Wait, wait... I don't think this is an easy tasks. A complete resource editor is far more complex than just a file version plugin. JGM: Watch out! In addition I think it's not even necessary. There are *very* good free resource editors around (e.g. ResEd) which you can easily connect to *.RC files within C::B as external tool. So why make another resource editor? I don't see a good reason for it. In addition C::B is a cross-platform tool and there is no "RC" under Linux. There are other cross-platform requirements around that are more important than Windows-only tasks IMHO.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ