do I need to change something on the autoversioning plugin? I don't get it quite well :?
I'm not sure what you mean.... the autoversioning plugin works great. I needed to setup an rc file so I could have version info for my executable so I did the following:
///////////////////////////////////////////////////////////////////////
//
// Version
//
#ifdef __MY_DEBUG__
#include "static_version.h"
#define RC_COMMENTS_STRING "This executable is a debug release. Not intended for non-developmental use.\0"
#define RC_INTERNAL_NAME_STRING "my_debug\0"
#define RC_ORIGINAL_FILE_NAME_STRING "MY_debug.EXE\0"
#define RC_PRODUCT_NAME_STRING "MY_DEBUG\0"
#define RC_DESCRIPTION_STRING "DEBUG VERSION: My Program name\0"
#define RC_COMPANY_STRING "Debug Version: My Name Here\0"
#define RC_COPYRIGHT_STRING "Debug Copyright (C) 2008. All Rights Reserved.\0"
#else
#include "version.h"
#define RC_COMMENTS_STRING "For licensed-commercial use only. Unlicensed use is unlawful.\0"
#define RC_INTERNAL_NAME_STRING "MY\0"
#define RC_ORIGINAL_FILE_NAME_STRING "MY.EXE\0"
#define RC_PRODUCT_NAME_STRING "MY\0"
#define RC_DESCRIPTION_STRING "My Program Here\0"
#define RC_COMPANY_STRING "My Name Here\0"
#define RC_COPYRIGHT_STRING "Copyright (C) 2008. All Rights Reserved.\0"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_FILEVERSION
PRODUCTVERSION RC_FILEVERSION
FILEFLAGSMASK 0x3fL
#ifdef __MY_DEBUG__
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", RC_COMMENTS_STRING
VALUE "CompanyName", RC_COMPANY_STRING
VALUE "FileDescription", RC_DESCRIPTION_STRING
VALUE "FileVersion", RC_FILEVERSION_STRING
VALUE "InternalName", RC_INTERNAL_NAME_STRING
VALUE "LegalCopyright", RC_COPYRIGHT_STRING
VALUE "OriginalFilename", RC_ORIGINAL_FILE_NAME_STRING
VALUE "ProductName", RC_PRODUCT_NAME_STRING
VALUE "ProductVersion", RC_FILEVERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
And then I have the version.h that is created by auto-version and use it for the RC_FILEVERSION_STRING when I'm not debugging. BUT when I AM debugging, I use a static-copy of version.h so that other dependencies in other parts of the program can easily recognize that we are debugging.
So no, the auto-versioning plugin is great. My problem is exactly how I'm using this. It depends on a "user-defined" symbol... __MY_DEBUG__ and currently code::blocks doesn't pass any compiler defines to windres... thus windres NEVER sees __MY_DEBUG__ as defined. So it always uses the version.h and not static_version.h.
This is why I need a way to pass options to windres from the IDE. Otherwise i have to figure out how to get a custom build command scripted to detect the target as either Debug or not Debug and then pass the option (-D __MY_DEBUG__) to windres or not.
Hope this helps give reasoning to why I need to be able to send options (defines especially) to the resource compiler. And again, no the auto-versioning plugin is (arguably) perfect.
OK, here's a temporary workaround.
Luckily, I don't have to deal with .rc files too much as I'm a little... maybe old-school isn't the world.... perhaps anal is more like it.... I just use c++ and C for everything.... meaning I have a harder time testing and getting my resources worked out, but then my rc files stay simple. Just a few icons perhaps and of course, version info.
Thus, you'll have to open the properties of EACH rc file, go the the Advanced tab, and check "Use Custom Command to build this file:"
Then, in the command box, enter the following:
$rescomp [[ if(GetProjectManager().GetActiveProject().GetActiveBuildTarget().Matches(_T("Debug"))) {print(_T("-D __MY_DEBUG__ -v --use-temp-file"));} ]] -i $file -J rc -o $resource_output -O coff $res_includes
And of course, you will have to substitute the _T("Debug") with whatever your debugging target name is, AND the _T("-D __MY_DEBUG__") with the symbols that you want to define.
If you have more than one target to debug, then do it like this:
$rescomp [[ if(GetProjectManager().GetActiveProject().GetActiveBuildTarget().Matches(_T("Debug")) || GetProjectManager().GetActiveProject().GetActiveBuildTarget().Matches(_T("Debug2"))) {print(_T("-D __MY_DEBUG__ -v --use-temp-file"));} ]] -i $file -J rc -o $resource_output -O coff $res_includes
(I think the Logical OR works... || ?? Anyone? )
Anyway, with this I did NOT get it to work... until I went into the obj directory and manually looked at the resulting .res files. Then I found my versioninfo was right for one .rc file... but I didn't do the above trick on ALL my rc files. THUS, if I were you, I would just do it to ALL of them. Then it should work. (My_APP.rc has a #include VersionInfo.rc and so I just did the above trick for VersionInfo.rc. BUT, since I didn't do it for My_App.rc the executable still had wrong info in it. Thus, you need to just do this custom command for all .rc files and viola. You should have it.)