Author Topic: More Macros for External Tools (or perhaps Custom Build Targets and Tools)  (Read 4280 times)

Offline JFalcon

  • Single posting newcomer
  • *
  • Posts: 7
Greets,

   This may be an existing feature that I have overlooked (with the exception of the macros since I cheated and looked at the code!  :)) however, I've recently started working with Trolltech's QT package and was hoping for a way to integrate their UI compiler with Code::Blocks.

   While I understand there is a default QT project configuration, I have set up the QT designer as an external tool.  Also, I've configured the UIC.EXE (QT UI Compiler) as an external tool as well; I've configured the following command line:

   ${ACTIVE_EDITOR_FILENAME} -o ${ACTIVE_EDITOR_FILENAME}.h

   While it accomplishes what I want to do, it would be nice to provide an "ACTIVE_EDITOR_FILENAME_PREFIX" and "ACTIVE_EDITOR_FILENAME_SUFFIX" macro --the first gives you all characters up to, but not including the last dot '.'; and the second gives you all characters after the last dot.  That way, I could name my files "SomeDialog.h" instead of "SomeDialog.ui.h".

   Alternatively, it would be nice (and it may exist, I just haven't found it yet) a provision in which a new 'program' can be added to the "Global Compiler Settings" area, most specifically the 'Programs' outer tab and the 'Program Files' inner tab which: a) associates a file extension for a file in the project to a command line program outside of those which already exist (perhaps this is configurable?); b) allows the command line to use macro expansion when those files are being 'built' (or perhaps adds that to its internal 'make' facility); and c) allows for the output extension to be provided to note the build target in any generated makefiles.

   I noticed there was a "file extension handling" area of configuration, but it wasn't apparent if that was tied to a build.  Ideally though, it would be more ideal to go with the second suggestion and allow it to be configured as an actual program used at compile-time instead of going the external tool route.

   One more note:  I did notice the post/build steps, but I don't know if they are easily adapted to running the command line tool against items that are included in the project.  With regards to build targets added to a project and having the ability to add a new program and command line specification, I think the variables for macro expansion for the currently processed file which would be most useful are: project directly, currently processed filename (as well as its prefix/suffix).

   If I'm missing something here (or there's a better way to do this I haven't yet found) please correct my ignorance.

Regards,

Falcon

Madster

  • Guest
Re: More Macros for External Tools (or perhaps Custom Build Targets and Tools)
« Reply #1 on: December 01, 2006, 10:41:06 pm »
I've also been using a "compiler" that reads in text files and outputs binary files.
I use the CodeBlocks IDE to edit them, and since they are part of a project I like to keep them together, so they're included in the project.

I could tell CodeBlocks to open the files which have particular extensions, but I couldn't tell it to compile all given files using a parametrised command line. I can do that for each individual file, but this will quickly lead into errors, as these files could easily go into the hundreds.
Currently I have a Tool with it and I call it individually for each file. I am also missing a parameter that points to where the compiled binaries are being stored, so that debug and release build outputs get piped to their own folders as needed (currently moving by hand also, which leads into confusion now and then).

This is a similar issue to the above so I post as a reply =)

So what I'm saying in one line is:
Feature request: add default compile method for file extension options, add binary output folder to file extension and tool parameters.

CodeBlocks rocks and I'm getting my faculty to drop DevCpp in favor of it (I got em running DevCpp 2 years ago, they were using Turbo C++!!! OLD!!! )

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: More Macros for External Tools (or perhaps Custom Build Targets and Tools)
« Reply #2 on: December 03, 2006, 07:55:02 pm »
No need for that feature request, this can already be done with a recent development version. :)

http://wiki.codeblocks.org/index.php?title=Variable_expansion#Script_expansion
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Madster

  • Guest
Re: More Macros for External Tools (or perhaps Custom Build Targets and Tools)
« Reply #3 on: December 06, 2006, 06:44:07 am »
oh cool...

Though I'm utterly confused with all the avaiable options.
Should I attempt a build script?

Edit: found the parameter I needed in the wiki, but I'd still need a way to choose the build method automatically based on its extension
« Last Edit: December 06, 2006, 06:49:41 am by Madster »