Using our own resource file?


#1

Hello all/Jules,

Is there any way to let us use our own resource file on 'doze, i.e. just not inlcude your resource file in the project. A checkbox “Don’t generate resource file” would suffice…
Our version numbers etc are a bit different from yours (1.2.3rc13) and we already have a whole macro system in place to define our version, app type, copyright message etc in one place per app. Our resource files use that info.

grts,

  • bram

#2

Not something I’ve ever considered… If you want to suggest code-changes to the introjucer that let you do want you want without messing-up anybody else’s build, then I’d consider it.


#3

hey Jules,

Before I dive into the code: just not generating the resource file should be enough right?

I.e. Generate Resource File: checkbox (default on):

  • bram

#4

That’d be fine, but it would also remove any reference to it from the project, so how would you add a reference to your own file?


#5

Just by including the resource file in the introjucer?

As long as it’s compiled it should be fine, no?

  • bram

#6

Probably not, I think it’d need special handling.


#7

Just check and you are right…

What about something like this? It doesn’t mess up your code and leaves space for people to add more (or less) things to their rc’s.

#ifndef JUCE_USER_DEFINED_RC

#undef  WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION  1,0,0rc2,0
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904E4"
    BEGIN
      VALUE "CompanyName",  "SampleSumo\0"
      VALUE "FileDescription",  "CPGuiExample\0"
      VALUE "FileVersion",  "1.0.0rc2\0"
      VALUE "ProductName",  "CPGuiExample\0"
      VALUE "ProductVersion",  "1.0.0rc2\0"
    END
  END

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

#else
#include JUCE_USER_DEFINED_RC
#endif

IDI_ICON1 ICON DISCARDABLE "icon.ico"

#8

That’s a really good idea! Sure, I’ll add something like that, thanks!


#9

Huzzah!

  • bram

#10

Hey Jules,

got some bad news: the resource compiler lives completely separate from the C++ compiler/linker and has its own preprocessor defines etc… That means that setting the include paths in the C++ compiler options doesn’t work (it just doesn’t see them)…

For vc2010:

    <ResourceCompile>
      <PreprocessorDefinitions>JUCE_USER_DEFINED_RC_FILE="\"VersionInfo.rc"\";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>../../../../Codebase;../../Source;</AdditionalIncludeDirectories>
    </ResourceCompile>

For vc2008:

			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;JUCE_USER_DEFINED_RC_FILE=&quot;\&quot;VersionInfo.rc\&quot;&quot;"
				AdditionalIncludeDirectories="../../../../Codebase;../../Source"
			/>

Without these my proposed hack is useless… I’m not sure what to propose now! Adding these would open up things more again, but maybe not entirely what you want to add…

Let me know what u think,

  • bram

#11

bump ?

  • bram

#12

Can’t you just use an absolute path for your include file?


#13

Mmmm, nope, because our RC file is shared among all our projects, which might be at different levels…
Or you mean absolute as in “c:/…”? Because that would definitely not work with different developers…

  • bram

#14

Too overloaded to look at it right now… If you’re in a hurry, it might be worth having a look in the introjucer, it’s probably only a few lines of code to add that.


#15

Hi! I don’t know if this is still of interests… I tried the same: change the version infos created by the resource.rc.
The macro JUCE_USER_DEFINED_RC_FILE does not work because the resource-compiler has no configurable defines in the projucer.
I have solved this problem by replacing the resource.rc file by an own one:
Simply create an own .rc file like “userdefinedrcfile.rc” at the same location as resources.rc (in builds\VisualStudioxxx) and add the folowing into the “pre-build command” of each configuration:
"copy userdefinedrcfile.rc resources.rc"
In your own .rc file you can use #includes etc to use defines also.
In my case something like that:

#include <windows.h>
#include "…/…/Info.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJ, VERSION_MIN, 0, VERSION_BUILDNR
PRODUCTVERSION VERSION_MAJ, VERSION_MIN, 0, VERSION_BUILDNR
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE “FileVersion”, VERSIONINFO_VERSION_STRING "\0"
VALUE “ProductVersion”, VERSIONINFO_VERSION_STRING "\0"
VALUE “OriginalFilename”, VERSIONINFO_FILENAME "\0"
VALUE “FileDescription”, VERSIONINFO_FILEDESCR "\0"
VALUE “InternalName”, EFFECT_NAME VERSIONINFO_VERSION_STRING "\0"
VALUE “ProductName”, EFFECT_NAME "\0"
VALUE “CompanyName”, VERSIONINFO_COMPANYNAME "\0"
VALUE “LegalCopyright”, VERSIONINFO_COPYRIGHT "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE “Translation”, 0x409, 1252
END
END

Each time you use the projucer the .rc file will be overwritten but on build, the right .rc file is used for the binary.

Frank.