Possible Bug - Passing Environment Variables to Resource buildCommand with option '-m64'
I am having some trouble figuring out why I cannot seem to get Code::Blocks to pass my environment variables to my resource file build commands when compiling targeting a 64 bit exe.
I have 2 environment variables defined in each target that are meant to be passed to the resource file, WINDRES_DEFINE and WINDRES_TARGET. 32 bit builds using the MinGW 32 bit that comes with Code::Blocks works fine as they get passed, but when I compile the 64bit targets they show up as a blank space.
My environment variable for each target is shown below:
// Main exe env vars:
<Environment>
<Variable name="WINDRES_DEFINE" value="" />
<Variable name="WINDRES_TARGET" value="pe-i386" />
</Environment>
<Environment>
<Variable name="WINDRES_DEFINE" value="" />
<Variable name="WINDRES_TARGET" value="pe-x86-64" />
</Environment>
// Server exe env vars:
<Environment>
<Variable name="WINDRES_DEFINE" value="-DSTANDALONE" />
<Variable name="WINDRES_TARGET" value="pe-i386" />
</Environment>
<Environment>
<Variable name="WINDRES_DEFINE" value="-DSTANDALONE" />
<Variable name="WINDRES_TARGET" value="pe-x86-64" />
</Environment>
// Master Server exe env vars:
<Environment>
<Variable name="WINDRES_DEFINE" value="-DMASTER -DSTANDALONE" />
<Variable name="WINDRES_TARGET" value="pe-i386" />
</Environment>
<Environment>
<Variable name="WINDRES_DEFINE" value="-DMASTER -DSTANDALONE" />
<Variable name="WINDRES_TARGET" value="pe-x86-64" />
</Environment>
My resource file is configured as follows:
// Resource File in cbp:
<Unit filename="../../projects/novafide/resources/project.rc">
<Option compilerVar="WINDRES" />
<Option compiler="gcc" use="1" buildCommand="$rescomp -F $WINDRES_TARGET $WINDRES_DEFINE -i $file -J rc -o $resource_output -O coff $res_includes" />
<Option target="main-32bit" />
<Option target="main-64bit" />
<Option target="server-32bit" />
<Option target="server-64bit" />
<Option target="master-32bit" />
<Option target="master-64bit" />
</Unit>
To get an idea of the issue I am having I am providing the lines for the windres.exe of each target below.
// .res Build Log Output for 32 bit (pe-i386) builds:
(main.exe) windres.exe -F pe-i386 -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -J rc -o .objs\novafide\main-32bit\projects\novafide\resources\project.rc.res -O coff
(server.exe) windres.exe -F pe-i386 -DSTANDALONE -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -J rc -o .objs\novafide\server-32bit\projects\novafide\resources\project.rc.res -O coff
(master.exe) windres.exe -F pe-i386 -DMASTER -DSTANDALONE -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -J rc -o .objs\novafide\master-32bit\projects\novafide\resources\project.rc.res -O coff
// .res Build Log Output for 64 bit (pe-x86-64) builds:
(main.exe) windres.exe -J rc -O coff -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -o .objs\novafide\main-64bit\projects\novafide\resources\project.rc.res
(server.exe) windres.exe -J rc -O coff -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -o .objs\novafide\server-64bit\projects\novafide\resources\project.rc.res
(master.exe) windres.exe -J rc -O coff -i "G:\Cure Interactive\Projects\Video Games\Logic Game Engine\logicgameengine\src\projects\novafide\resources\project.rc" -o .objs\novafide\master-64bit\projects\novafide\resources\project.rc.res
As you can see "-DSTANDALONE" and "-DMASTER -DSTANDALONE" are missing from the resource file build commands in the 64 bit builds. Is this a bug, a feature, or did I write the build command incorrectly? At this time I am not certain.
It is worth noting that I used TGM-GCC-64 as my compiler in the affected builds, and also that when using a different compiler (MinGW64) I also got this issue.
The projects compile fine, exept that some define dependant options in my resource file do not display the correct information in the properties of the EXE files.
To test some things I decided to take a 64-bit project and cnage the options to build it in 32-bit using the same compiler. Of course this failed to build but I got the variables passed to the resource file! This lends me to beleive this a Code::Blocks issue rather than a compiler issue.
Does Code::Blocks not allow variable passing of this type for third party compilers? I still wonder if I formatted my build command incorrectly. Any help would be very welcome!
I'll attach the full cbp file so that if anyone wants to see the full file they can. I tried to include all the important information but I know sometimes theres never enough info.
I did try to google this issue and spent over a week every day trying to find an answer but I might be the first to experience this problem, not sure.