News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Pre-"workspace build" and post-"workspace build" scripts?

Started by filofel, April 02, 2008, 02:47:46 PM

Previous topic - Next topic

filofel

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

thomas

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

filofel

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.


thomas

I'm not saying it isn't useful, it is very useful. But I don't think it will be trivial to implement.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MortenMacFly

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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

filofel

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...

MortenMacFly

Quote from: filofel on April 04, 2008, 11:00:27 AM
That would work automatically without getting out of C::B...
In fact, that's possible, too. Good point! :D
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]