Usage
For every
project myprojname { }
in mpc files, the CDT6 project type
generates a corresponding "eclipse project" directory of the form
cdt_myprojname. The CDT6 Project Type
uses Eclipse's
linked resource feature to work around
Eclipse's usual requirement that source files reside inside the Eclipse project
directory. However, the linked resource feature also comes with
restrictions; see
the note for details.
Generic workflow
Presuming .mpc files already exist:
- Generate projects using -type cdt6.
- Import projects into an Eclipse workspace.
Workflow for building ACE/TAO
- Check out a copy of ACE/TAO.
- Configure ACE/TAO for your target(s) by setting up
config.h.
- Set up environment variables (ACE_ROOT,
TAO_ROOT, etc.), PATH,
LD_LIBRARY_PATH (or similar), etc.
- Verify settings in global.features and, if changes
are necessary, make appropriate changes in
default.features.
- Generate projects using -type cdt6 insuring the
use of mwc.pl from within ACE, e.g.,
$ cd $TAO_ROOT
$ mwc.pl -type cdt6 TAO_ACE.mwc
mwc.pl will churn for awhile.
- Suggestion: Verify that Project->Build
Automatically is unchecked (has no checkmark to its
immediate left). If this is left on, then the build will start as
soon as the import in the next step begins, and it will build everything.
- From within Eclipse (preferably an otherwise-empty workspace) select
File->Import... and perform the following actions:
- Choose General->Existing Projects Into
Workspace and click Next
- In "Select Root Directory:" text field, enter the full path
to the directory above ACE, TAO, etc. (you can also use
the "Browse" feature to select the directory from the GUI). For
example, if you checked everything out into
/home/joedeveloper/acetao and ACE and TAO are in a
peer layout under that directory, you would enter
/home/joedeveloper/acetao in the text field.
- Eclipse will scan all the subdirectories looking for existing
projects; this can take a few minutes for something as large as
TAO or CIAO. NOTE: If you have previously run
MPC to generate CDT projects with one workspace
(.mwc file) and then ran it later with a different
workspace without removing the projects from the first
generation, Eclipse will still find those projects for import.
See the note on removing generated
projects for information on how to do that.
- Be sure that the checkbox next to Copy projects
into workspace is UNchecked. Copying projects into
the workspace unnecessarily duplicates files, plus we have found
that Eclipse can get confused with file paths sometimes (though
sometimes it will work).
- Feel free to use Working Sets or not. You may also
choose to import a subset of the discovered projects by
manipulating them in the list, however, experience suggests that
the list is ignorant of dependency interactions between projects,
so you must manage that manually (i.e., you could import
a project, but not projects upon which the first depends, and
that first project would then fail to build).
- Click Finish to proceed with the import.
Eclipse will now start populating the Projects pane with
projects. If you didn't uncheck Build
Automatically, then builds will start. Regardless, the
C++ indexer will run in the background across the source of all projects.
Building A Project
To build a project or set of projects, select the project (or
projects) in the
Project pane, then select
Project->Build Project. Eclipse will evaluate
ALL dependencies automatically, though not necessarily
quickly.
Hint: a good choice to get all of ACE/TAO built is to
choose the Naming Service project.
Multiple Platforms
Just as a project created within CDT can be set up to support
multiple platforms, so too can projects generated via MPC. To the
extent possible, the platforms are represented in generated projects
in the same way as they are in "native" projects (though there will
be some differences).
Generating Projects with Multiple Platform Support
Platforms are named in a list called platforms in the
CDT6 template (much like other MPC templates). The list defaults to
the platform on which mwc.pl is run. To generate for
another platforms, or for additional platforms, you must provide
platforms with the list of platforms to generate.
Generate projects using a similar incantation to the default (from
above) using -type cdt6 and -value_template
platform="<platform_list>", insuring the
use of mwc.pl from within ACE, e.g.,
$ cd $TAO_ROOT
$ mwc.pl -type cdt6 -value_template platforms="linux cellppu" TAO_ACE.mwc
Platforms are defined as scopes in templates/cdt6platforms.mpt.
Cross-Compilation
Cross-compilation is handled the same as a platform; the target is
the platform. If you want to generate for cross-compilation, the
cross-compiler information must be defined in a scope (typically
named for the target type) in
templates/cdt6platforms.mpt. If a scope does not exist for
the target, follow the instructions for adding
a new platform.
In the example given above, cellppu is the name of the
platform for cross-compilation.
Adding a New Platform
To add a new platform, particularly one for cross-compilation, it's
probably easiest to start from an existing scope, e.g.,
cellppu. For cross-compilation where the cross-compiler
toolchain is GNU Compiler-based, you will need to provide the names
of the various executables in the toolchain in the values
as,
ar,
cc, and
cxx. And, optionally,
ccld and/or
cxxld if the linker used for linking C and C++
executables, respectively, is different from the respective
compiler. CDT expects these to be in the path.