Author Topic: Active workspace project from command line?  (Read 4383 times)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Active workspace project from command line?
« on: July 03, 2014, 12:54:27 am »
Hi,

I have figured out how to build a C::B workspace containing several inter-dependent projects from the command line:
$ codeblocks --build --target=GCC_Release prototype.workspace
It looks like it simply is building ALL projects in the workspace, fair enough.

Sometimes, I would like to build only an "Active" project in the workspace, including the projects it depends on, as specified in the workspace file. But there seems to be no command line option for that?  I mean, something like below (suggested option in green)

$ codeblocks --build --project=prototype_app.cbp --target=GCC_Release prototype.workspace
This would build only the projects that prototype_app depends on, as specified in the given workspace file, plus build prototype_app itself of course. It is exactly the same concept at building the "active" project in the GUI IDE, but I have found no way to say what the "active" project is from the command line, hence the above suggestion.

The above is very different from simply building the project file directly:
$ codeblocks --build --target=GCC_Release prototype_app.cbp
because this will not build the dependencies of the prototype_app project, since the dependencies are only described in the .workspace file.

I am exploring this because I want to build using C::B command line on the Raspberry PI, the IDE is too slow on PI to be practical. However, building from command line is less painful, but access to some additional functionality that already exists when building from withing the GUI IDE would be nice to have.

Is this perhaps already possible in some other way?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Active workspace project from command line?
« Reply #1 on: July 03, 2014, 06:54:13 am »
Is this perhaps already possible in some other way?
Sure. Setup a virtual target that includes only the prototype and the dependencies.

Virtual targets group 1..n projects within a workspace. You can have as many virtual targets as you want.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Active workspace project from command line?
« Reply #2 on: July 03, 2014, 02:35:25 pm »
Hmmm.... thank you.

I tried to look at Virtual targets now, and I don't understand how that answers the question raised. Virtual targets seem to be a collection of build targets within a project. I was looking for a direct analogy with active project in the GUI IDE (as stored on .workspace.layout file). I have a large number of projects and I don't want to create virtual targets for all of them (do I have to?), just because I want a one-off custom build from the command line. I just want to be able to say which project is the last in the build chain right now, everything else is already defined.

Maybe there is something about virtual targets I don't get...