Author Topic: Compiling xrc files  (Read 4014 times)

Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Compiling xrc files
« on: October 24, 2006, 03:35:46 am »
Hi everybody,

I need advice on how to better use xrc files with C::B. I want to use wxrc to generate cpp files which I then include in my project.
Currently I add the xrc files to my project, activate the compilation in their properties and give them a custom compilation command line like this:
Code
wxrc --extra-cpp-code --cpp-code --output=xrc_effect.cpp --function=InitXmlEffect $file
I added the resulting cpp files to my project and they are compiled normally.

Unfortunately this approach leads to two problems:
  • The xrc files are always compiled
  • Once the build runs, it doesn't detect that the resulting cpp files were updated and are therefore they are not compiled on the first run.
Any help appreciated...
« Last Edit: October 24, 2006, 03:38:34 am by Belgabor »

Offline Charon

  • Multiple posting newcomer
  • *
  • Posts: 49
  • fnord
    • charon - where mental illness meets chronic nonsense
Re: Compiling xrc files
« Reply #1 on: October 24, 2006, 11:50:59 am »
You could create 2 projects in one workspace.
The first project should only contain your xrc's while your second projects contains the cpp's.

Now create a virtual target that contains both these projects.
When you build this new target both projects get built. The project with the xrc's should be compiled first of course so that the second project has the new cpp's.

There may be better solutions through dependencies but i never worked with them (and don't have the time right now to try them out). This was just the first thing that came to my mind.

Good luck
Markus
hi, i am a signature virus. please copy me into your sig!
Wish list : no root-node for workspaces, open files and symbols; world domination

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Compiling xrc files
« Reply #2 on: October 24, 2006, 11:59:09 am »
even better: use different targets in your project,

target xrc-precompiling
 - set external dependencies to your .xrc's (e.g. to controls.xrc)
 - process your xrc's with wxrc there  ( e.g. controls.xrc --> control.cpp / controls.h )

target build-myapp
 - put your precompiled .cpp / .h files ( e.g. controls.cpp / controls.h ) in this target
   and it will be compiled if any changes happened


Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Re: Compiling xrc files
« Reply #3 on: October 24, 2006, 08:05:33 pm »
Works great, thanks! :D

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Compiling xrc files
« Reply #4 on: October 25, 2006, 08:01:13 am »
I being used Priority and special build command for analogical situations.
For example, I did include filename.yac and set priority 20 for him. Also special command for compile only this file.
After compile was created file filename.yy.c. I did include this file to my project and set him priority 90.

Compile sequence:
filename.yac
.. another files of my project ..
filename.yy.c

May be this method help you too.
Good luck!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen