User forums > Using Code::Blocks
Sending defines to windres
XayC:
Hello, is there any way to use the defines (set in "Compiler options" -> "#defines") also for the resource files?
Currently those values are correctly defined in every source file, but not in the resource files. Windres supports it (using -D) but seems that the default command line used to call it it's not, and i could not find any easy way to get the project defines (which are target dependent) as a command macro.
The reason is that i need to define specific resources based on the presence of the DEBUG define, which is defined in my project only for some targets.
Regards, XayC.
Biplab:
This is not possible at the moment. But we'll be upgrading the compiler system in future and we'll add it then. :)
jmason1182:
Wow... that should be a priority.... you have the auto_version plugin which keeps up your version.h file... but now way to add any #ifndef type statements to test if you are debugging or not?
I use #ifdef __MY_DEBUG__ to determine if I'll use the version.h auto-updated by the plugin, or if I'll use a static static_version.h which has some debug info, warning messages, etc. Also, my resources are a little different. I just switched my project (going on... sadly... for 2 years so far) to a Code::Blocks project and I love it. It's just hard to keep track of what version/debug/release/etc. I am working on when I have to MANUALLY go add -D __MY_DEBUG__ to a CUSTOM command to EACH resource file just to get a define to the windres program.
So when is this gonna be fixed?
JGM:
do I need to change something on the autoversioning plugin? I don't get it quite well :?
jmason1182:
--- Quote from: JGM on May 08, 2008, 07:08:43 am ---do I need to change something on the autoversioning plugin? I don't get it quite well :?
--- End quote ---
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:
--- Code: ---///////////////////////////////////////////////////////////////////////
//
// 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
--- End code ---
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.
Navigation
[0] Message Index
[#] Next page
Go to full version