Code::Blocks Forums
User forums => Help => Topic started by: filofel on April 02, 2008, 02:47:46 pm
-
Hi,
I use a workspace as a way to group several related projects.
And so far, I didn't find a foolproof way to create a pre-build and/or a post-build workspace script that would execute when I do a "workspace build" or "workspace rebuild".
I could of course attach a pre-build script to the project that I assume will occur first, and a post-build script to the project that I assume would occur last, but this is unsafe, as a later modification in the projects dependencies could end up silently altering the order of the builds.
Is there a trick that I'm missing, or does something like that belong to the "Features request" section?
TIA,
Phil
-
I don't think there is a way, nor that there will be one any time soon, since workspaces are not more than a collection of projects in Code::Blocks. There is no concept for something like a pre-build script, or compile options in them, no dialog where one could enter such a thing. So, implementing any such thing wouldn't be trivial.
-
Thomas,
Bad news.
Workspaces are actually a little bit more than just "a collection of projects in Code::Blocks", since the build system offers to select "project dependencies" among the projects in a workspace, and apparently organizes the project builds inside the workspace in the right order: Having that, the execution position of the "pre-workspace-build" and "post-workspace-build" scripts become obvious.
The problem of workspace build (or compile) parameters is certainly more complex, but adding user-defined workspace-level variables could possibly provide an acceptable work around.
For any project that implies several distinct and/or intermediate targets, that could be really useful.
-
I'm not saying it isn't useful, it is very useful. But I don't think it will be trivial to implement.
-
Don't forget that you can control a whole build process from the command line. Thus if you need pre- post-build steps for a workspace, just write a script (batch) file with an automised build process. This can include any pre- or post-build steps for a workspace step you like. I for myself use this before building the C::B workspace. I do a source code sync before and file movement afterwards (if the build succeeded).
-
Thomas,
Then we agree on all counts. I'm very new to Code::Blocks, but I don't consider anything it does or could do to be trivial either! :)
MortenMacFly,
Good point, thank you.
I assume I could also create a phony project that would depend on all others as a post-build, and one that is a dependency of all others for a pre-build?
That would work automatically without getting out of C::B...
-
That would work automatically without getting out of C::B...
In fact, that's possible, too. Good point! :D