Thread overview
Compiling in windows resources (and DSSS)
Nov 17, 2007
Bill Baxter
Nov 17, 2007
Derek Parnell
Nov 18, 2007
Bill Baxter
Nov 18, 2007
Derek Parnell
Nov 18, 2007
BLS
Nov 18, 2007
Lutger
November 17, 2007
What's the best way to compile in .ico and .rc stuff?
Does dmd on Windows do any of that for you?

I found that I could call  "rcc resources.rc" and then add the resulting .res file to the dmd command.  Is there a better way?

And for using DSSS how would I add that rc step?  Anything better than this?:

[main.d]
   prebuild = echo "Compiling resources..."; rcc main.rc
   buildflags += main.res
November 17, 2007
On Sun, 18 Nov 2007 06:53:59 +0900, Bill Baxter wrote:

> What's the best way to compile in .ico and .rc stuff?
> Does dmd on Windows do any of that for you?
> 
> I found that I could call  "rcc resources.rc" and then add the resulting .res file to the dmd command.  Is there a better way?
> 
> And for using DSSS how would I add that rc step?  Anything better than this?:
> 
> [main.d]
>     prebuild = echo "Compiling resources..."; rcc main.rc
>     buildflags += main.res

I know you were not after Bud's way of doing this but here it is anyhow ...

First you have these lines in the 'Rule Definition File' (default.rdf) ...

  ----- Windows Resource Compiler --------
  This uses pragma( build, "<sourcefile>.rc");
  ----------------
  rule=Resources
  in=rc
  out=res
  tool=rc /r {@IN} /fo {@OUT}

Then in your source code you would have something like ...

  version(build) pragma(build, "main.rc");

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
November 18, 2007
Derek Parnell wrote:
> On Sun, 18 Nov 2007 06:53:59 +0900, Bill Baxter wrote:
> 
>> What's the best way to compile in .ico and .rc stuff?
>> Does dmd on Windows do any of that for you?
>>
>> I found that I could call  "rcc resources.rc" and then add the resulting .res file to the dmd command.  Is there a better way?
>>
>> And for using DSSS how would I add that rc step?  Anything better than this?:
>>
>> [main.d]
>>     prebuild = echo "Compiling resources..."; rcc main.rc
>>     buildflags += main.res
> 
> I know you were not after Bud's way of doing this but here it is anyhow ...
> 
> First you have these lines in the 'Rule Definition File' (default.rdf) ...
> 
>   ----- Windows Resource Compiler --------
>   This uses pragma( build, "<sourcefile>.rc");
>   ----------------
>   rule=Resources
>   in=rc
>   out=res
>   tool=rc /r {@IN} /fo {@OUT}
> 
> Then in your source code you would have something like ...
> 
>   version(build) pragma(build, "main.rc");

Thanks.  Why does bud need to have such a verbose setup?  Compared to that I feel pretty happy with the 2-line config for dsss.  I see bud also some other useful pragmas for doing Windows things like build_def to set the gui/console flavor.

But yeh, I kind of gave up on bud sometime in 2006 when I sent you that patch for supporting environment variables, you told me thanks, but you already implemented it, and then no new release of bud with that feature ever materialized.

--bb
November 18, 2007
On Sun, 18 Nov 2007 09:59:01 +0900, Bill Baxter wrote:

> Derek Parnell wrote:
>> On Sun, 18 Nov 2007 06:53:59 +0900, Bill Baxter wrote:
>> 
>>> What's the best way to compile in .ico and .rc stuff?
>>> Does dmd on Windows do any of that for you?
>>>
>>> I found that I could call  "rcc resources.rc" and then add the resulting .res file to the dmd command.  Is there a better way?
>>>
>>> And for using DSSS how would I add that rc step?  Anything better than this?:
>>>
>>> [main.d]
>>>     prebuild = echo "Compiling resources..."; rcc main.rc
>>>     buildflags += main.res
>> 
>> I know you were not after Bud's way of doing this but here it is anyhow ...
>> 
>> First you have these lines in the 'Rule Definition File' (default.rdf) ...
>> 
>>   ----- Windows Resource Compiler --------
>>   This uses pragma( build, "<sourcefile>.rc");
>>   ----------------
>>   rule=Resources
>>   in=rc
>>   out=res
>>   tool=rc /r {@IN} /fo {@OUT}
>> 
>> Then in your source code you would have something like ...
>> 
>>   version(build) pragma(build, "main.rc");
> 
> Thanks.  Why does bud need to have such a verbose setup?

Because.

The stuff in the RDF file is a once off. Then each program that is dependant on a resource just has the single line of code. Too complex for you? Okay, I can live with that.

>  Compared to
> that I feel pretty happy with the 2-line config for dsss.  I see bud
> also some other useful pragmas for doing Windows things like build_def
> to set the gui/console flavor.
> 
> But yeh, I kind of gave up on bud sometime in 2006 when I sent you that patch for supporting environment variables, you told me thanks, but you already implemented it, and then no new release of bud with that feature ever materialized.

I'm dead lazy I guess. I have done all that environment stuff and more, but no one's paying me enough to drop more important things to finalise the docs etc... I've actually be done a couple of 36-hour days recently to meet paying deadlines and I'm actually just taking a break now (9:30pm Sunday) in what's looking like another all nighter. But hey! life's good right?! Especially when considering the alternative.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
November 18, 2007
Sorry Bill, no help. Just a question / Can you please publish a sample dsss.conf for a Windows GUI application ? Gregor is afaik not really a fanatic Win user...
Bjoern

Bill Baxter schrieb:
> What's the best way to compile in .ico and .rc stuff?
> Does dmd on Windows do any of that for you?
> 
> I found that I could call  "rcc resources.rc" and then add the resulting ..res file to the dmd command.  Is there a better way?
> 
> And for using DSSS how would I add that rc step?  Anything better than this?:
> 
> [main.d]
>    prebuild = echo "Compiling resources..."; rcc main.rc
>    buildflags += main.res
November 18, 2007
BLS wrote:
> Sorry Bill, no help. Just a question / Can you please publish a sample dsss.conf for a Windows GUI application ? Gregor is afaik not really a fanatic Win user...
> Bjoern

[winapp.d]
buildflags = -gui