Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: ironhead on July 26, 2007, 06:01:49 pm

Title: Virtual Targets at the Workspace Level
Post by: ironhead on July 26, 2007, 06:01:49 pm
I have a Workspace that contains several projects.  I'd like to define a virtual target that includes a specific target from each of the projects.  I would then like to execute a post build process to archive everything in to a zip file.  Basically re-create a 'make dist' type scenario.

Is this possible?
Title: Re: Virtual Targets at the Workspace Level
Post by: mariocup on July 26, 2007, 08:48:34 pm
Hi ironhead,

in the manual of Codeblocks http://www.codeblocks.org/manual.shtml you find a small example how to build virtual target and how to zip project files e.g.

zip -j9 $(PROJECT_NAME)_$(TODAY).zip src h obj $(PROJECT_NAME).cbp

You can have a virtual target 'All' that includes the build target default (see codeblocks.workspace). If all projects contain the virtual target 'All' and you select build workspace then all projects/targets will be built. Add a post build step with cb variables (see example above) or attach a script to a built target.

Title: Re: Virtual Targets at the Workspace Level
Post by: ironhead on July 26, 2007, 10:24:03 pm
That works for an individual project, but I have a workspace that contains 8 projects.  I'd like to create a Virtual Target that contains build targets from all 8 projects.  Is this possible?
Title: Re: Virtual Targets at the Workspace Level
Post by: mariocup on July 27, 2007, 09:31:04 am
Well there a  two possibilities in CB to something like that (or perhaps I do not understand what you want to do):

1) Dependencies: In a workspace you may have so called dependencies. For example project 1 depends on project 2, project 3 etc. then building that project will build all project with their dependencies. The last project of the dependency could zip all projects.
2) All 8 projects contain the same build target All. Then building the workspace (not the project) will build all project with the corresponding target.

Is that what you are thinking about?
Title: Re: Virtual Targets at the Workspace Level
Post by: MortenMacFly on July 27, 2007, 03:47:33 pm
I'd like to create a Virtual Target that contains build targets from all 8 projects.  Is this possible?
1..n projects contain a (virtual) target called "subset" (for example). Then C::B will offer at workspace level to compile this very target "subset". Select the "subset" target from the choicebox, hit "compile workspace". C::B will warn you if there are projects *not* containing this (virtual) target. Those who contain such a target will be compiled (this target of the project will be compiled to be precise). Notice the target must not neccesarily be virtual for that purpose. "Virtual" means a set of 1..n targets within a project.
So yes, C::B can handle such.
With regards, Morten.