Author Topic: Can I create a project with multiple targets?  (Read 7918 times)

Offline twotaters

  • Single posting newcomer
  • *
  • Posts: 4
Can I create a project with multiple targets?
« on: September 28, 2008, 11:29:52 pm »
Hi. I'm trying to convert a project that currently uses Peter Miller's cook. The cook file creates a shared library, and bin programs for the server plus a couple of clients. The directory layout for the project is
  root
    bin
      compiled binaries go here
    lib
      compiled libraries go here
    src
      lib
        library sources
      bin
        server
          server sources
        client 1
          client 1 sources
        client 2
           client 2 sources

Can a C::B project create the multiple outputs or do I need to create multiple projects, each with one target (eg, a project for the lib, a project for the server, projects for the clients)? If so, can you point me to instructions? I looked at the project properties and see that I can create Debug and Release targets, but those look like they're just the same set of sources compiled/linked with different options. I'm looking at multiple sets of sources.

Thanks
Mike

Offline twotaters

  • Single posting newcomer
  • *
  • Posts: 4
Re: Can I create a project with multiple targets?
« Reply #1 on: September 28, 2008, 11:41:43 pm »
Hmm. After looking at the .cbp for a project, I think that I'll have to use multiple projects. From the xml in the .cbp file, it looks like a project contains targets and units. Targets contain compiler/linker options. They don't have a way to limit the units used to build the target.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can I create a project with multiple targets?
« Reply #2 on: September 28, 2008, 11:54:35 pm »
You should have a look at C::B's own project file.
It's one project file, that uses multiple targets, and three virtual targets.

Each target only uses a part of the projects source files and has it's own build options.

The virtual targets contain some (or all) of the "real" targets to make compiling easier.
E.g. virtual target "all" contains ...    ... yes all other targets.

It's a good example for what you want to do (if I understand right).

Offline twotaters

  • Single posting newcomer
  • *
  • Posts: 4
Re: Can I create a project with multiple targets?
« Reply #3 on: September 29, 2008, 12:02:02 am »
That is what I meant. I see that the Unit can be tied to a target (Option target="sdk"). And now I understand how that is related to the Build tab on the source file. It seems like I can create the targets. Then I have to go into each source file and do the right-click | Properties to tie the unit to the target. Or just vi the .cbp file and copy+paste the Option in.

UPDATE - or i could learn to use the scripting engine. Sounds like it will do all of the drone work for me.

Thanks!
Mike
« Last Edit: September 29, 2008, 12:08:23 am by twotaters »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can I create a project with multiple targets?
« Reply #4 on: September 29, 2008, 12:22:55 am »
Go into the projects properties dialog (where you have created the targets), chose the target you want to edit, and check all the files that should belong to it under "Build target files:"
That works of course only if they are yet part of the project.

If you create a new project you can use "add files recurively..." from projects context menu.
First chose the parent directory of the files that should become member of a target, in the next step chose the files itself and in the last chose the target they should belong to.
Do that for every target.

You should (normally) never work on the cbp file manually. It can break your project if you make any errors.