| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | |
| 3 | <html> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 6 | <meta http-equiv="Content-Style-Type" content="text/css"> |
| 7 | <link rel="STYLESHEET" href="MakeProjectCreator.css" charset="ISO-8859-1" |
| 8 | type="text/css"> |
| 9 | |
| 10 | <title>MPC: CDT6 Project Type</title> |
| 11 | </head> |
| 12 | |
| 13 | <body> |
| 14 | <div> |
| 15 | <h1 class="Head1">CDT6 Project Type documentation</h1> |
| 16 | |
| 17 | <div> |
| 18 | <h3 class="Head2">Background/Abstract</h3> |
| 19 | <li class="body">The <em>CDT6 Project Type</em> generates project files utilizable |
| 20 | by Eclipse's CDT plugin, version 6. This is the version |
| 21 | generally available/compatible with the Eclipse "Galileo" release. |
| 22 | The project type generates eclipse projects from generic mpc |
| 23 | files. These Eclipse/CDT projects can then be imported into a user's |
| 24 | workspace and built using CDT's internal builder.</li> |
| 25 | |
| 26 | <li class="body">MPC's CDT6 Project Type currently supports Linux |
| 27 | and Windows as both host and target platforms.</li> |
| 28 | </div> |
| 29 | |
| 30 | <div> |
| 31 | <h3 class="Head2">Pre-requisites</h3> |
| 32 | <ul> |
| 33 | <li class="body">The following software items are required and |
| 34 | in the execution path (as well as any of their respective dependencies): |
| 35 | <dl> |
| 36 | <dt>Eclipse Galileo</dt> |
| 37 | <dd>Standard download from <a href="http://www.eclipse.org/downloads">http://www.eclipse.org/downloads</a>.</dd> |
| 38 | <dt>CDT 6.0</dt> |
| 39 | <dd>This comes packaged together with Eclipse Galileo in the |
| 40 | <a |
| 41 | href="http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliosr">Eclipse |
| 42 | IDE for C/C++ Development</a>.</dd> |
| 43 | <dt>Eclipse-compatible toolchain</dt> |
| 44 | <dd>On linux platforms, this should just be the standard |
| 45 | installation of the GNU toolchain for that linux distribution. On |
| 46 | Windows, Eclipse uses the <a href="http://www.mingw.org">MinGW</a> |
| 47 | toolchain, available for download. Suggested tool set is <a |
| 48 | href="http://sourceforge.net/downloads/mingw/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/">Automated |
| 49 | MinGW Installer</a>.</dd> |
| 50 | <dt>a compatible <tt>make</tt> tool</dt> |
| 51 | <dd>This does not need to be a full-featured GNU make, but it |
| 52 | must be in the PATH as an executable named <em>make</em>. On |
| 53 | Linux, the standard GNU make suffices. On Windows, <a |
| 54 | href="http://gnuwin32.sourceforge.net/packages/make.htm">the |
| 55 | <em>make</em> package from GNUWin32</a> is a good choice.</dd> |
| 56 | </dl> |
| 57 | |
| 58 | <li class="body">The default value of 256Mb for Eclipse's Java |
| 59 | VM heap size is insufficient for building projects the size of |
| 60 | ACE/TAO/CIAO. A minimum of 768Mb or more is suggested. This can be |
| 61 | done on the command line launch of eclipse, or in the |
| 62 | <em class="Code">eclipse.ini</em> file.</li> |
| 63 | |
| 64 | </ul> |
| 65 | </div> |
| 66 | |
| 67 | <div> |
| 68 | <h3 class="Head2">Usage</h3> |
| 69 | <p class="Body"> |
| 70 | For every <em class="Code">project <var>myprojname</var> { }</em> in mpc files, the CDT6 project type |
| 71 | generates a corresponding "eclipse project" directory of the form |
| 72 | <em class="Code">cdt_<var>myprojname</var></em>. The CDT6 Project Type |
| 73 | uses Eclipse's <em>linked resource</em> feature to work around |
| 74 | Eclipse's usual requirement that source files reside inside the Eclipse project |
| 75 | directory. However, the linked resource feature also comes with |
| 76 | restrictions; see <a href="#fullpath">the note</a> for details. |
| 77 | </p> |
| 78 | <h4 class="Head5">Generic workflow</h4> |
| 79 | <p class="Body"> |
| 80 | Presuming .mpc files already exist: |
| 81 | </p> |
| 82 | <ol> |
| 83 | <li><p class="Body">Generate projects using <em class="Code">-type cdt6</em>.</p></li> |
| 84 | <li><p class="Body">Import projects into an Eclipse workspace.</p></li> |
| 85 | </ol> |
| 86 | |
| 87 | <h4 class="Head5">Workflow for building ACE/TAO</h4> |
| 88 | <ol> |
| 89 | <li><p class="Body">Check out a copy of ACE/TAO.</p></li> |
| 90 | |
| 91 | <li><p class="Body">Configure ACE/TAO for your target(s) by setting up |
| 92 | <em class="Code">config.h</em>.</p> |
| 93 | </li> |
| 94 | |
| 95 | <li><p class="Body">Set up environment variables (<var>ACE_ROOT</var>, |
| 96 | <var>TAO_ROOT</var>, etc.), <var>PATH</var>, |
| 97 | <var>LD_LIBRARY_PATH</var> (or similar), etc.</p> |
| 98 | </li> |
| 99 | |
| 100 | <li><p class="Body">Verify settings in <em class="Code">global.features</em> and, if changes |
| 101 | are necessary, make appropriate changes in |
| 102 | <em class="Code">default.features</em>.</p> |
| 103 | </li> |
| 104 | |
| 105 | <li><p class="Body">Generate projects using <em class="Code">-type cdt6</em> insuring the |
| 106 | use of <em class="Code">mwc.pl</em> from within ACE, e.g.,</p> |
| 107 | <blockquote> |
| 108 | <p class="Code">$ cd $TAO_ROOT</p> |
| 109 | <p class="Code">$ mwc.pl -type cdt6 TAO_ACE.mwc</p> |
| 110 | </blockquote> |
| 111 | <p class="Body"><em class="Code">mwc.pl</em> will churn for awhile.</p> |
| 112 | </li> |
| 113 | |
| 114 | <li><p class="Body"><em>Suggestion:</em> Verify that <strong>Project->Build |
| 115 | Automatically</strong> is unchecked (has no checkmark to its |
| 116 | immediate left). If this is left on, then the build will start as |
| 117 | soon as the import in the next step begins, and it will build everything.</p></li> |
| 118 | |
| 119 | <li><p class="Body">From within Eclipse (preferably an otherwise-empty workspace) select |
| 120 | <strong>File->Import...</strong> and perform the following actions:</p> |
| 121 | <ol type="a"> |
| 122 | <li><p class="Body">Choose <strong>General->Existing Projects Into |
| 123 | Workspace</strong> and click <strong>Next</strong></p></li> |
| 124 | <li><p class="Body">In "Select Root Directory:" text field, enter the full path |
| 125 | to the directory <em>above</em> ACE, TAO, etc. (you can also use |
| 126 | the "Browse" feature to select the directory from the GUI). For |
| 127 | example, if you checked everything out into |
| 128 | <em class="Code">/home/joedeveloper/acetao</em> and ACE and TAO are in a |
| 129 | peer layout under that directory, you would enter |
| 130 | <em class="Code">/home/joedeveloper/acetao</em> in the text field. |
| 131 | </p></li> |
| 132 | <li><p class="Body">Eclipse will scan all the subdirectories looking for existing |
| 133 | projects; this can take a few minutes for something as large as |
| 134 | TAO or CIAO. <strong>NOTE:</strong> If you have previously run |
| 135 | MPC to generate CDT projects with one workspace |
| 136 | (<em class="Code">.mwc</em> file) and then ran it later with a different |
| 137 | workspace without removing the projects from the first |
| 138 | generation, Eclipse will still find those projects for import. |
| 139 | See <a href="#remove_projects">the note on removing generated |
| 140 | projects</a> for information on how to do that.</p></li> |
| 141 | |
| 142 | <li><p class="Body"><strong>Be sure that the checkbox next to <em>Copy projects |
| 143 | into workspace</em> is <em>UN</em>checked.</strong> Copying projects into |
| 144 | the workspace unnecessarily duplicates files, plus we have found |
| 145 | that Eclipse can get confused with file paths sometimes (though |
| 146 | sometimes it will work).</p></li> |
| 147 | |
| 148 | <li><p class="Body">Feel free to use <em>Working Sets</em> or not. You may also |
| 149 | choose to import a subset of the discovered projects by |
| 150 | manipulating them in the list, however, experience suggests that |
| 151 | the list is ignorant of dependency interactions between projects, |
| 152 | so you must manage that manually (<em>i.e.</em>, you could import |
| 153 | a project, but not projects upon which the first depends, and |
| 154 | that first project would then fail to build).</p></li> |
| 155 | |
| 156 | <li><p class="Body">Click <strong>Finish</strong> to proceed with the import.</p></li> |
| 157 | </ol> |
| 158 | <p class="Body"> |
| 159 | Eclipse will now start populating the <em>Projects</em> pane with |
| 160 | projects. If you didn't uncheck <strong>Build |
| 161 | Automatically</strong>, then builds will start. Regardless, the |
| 162 | C++ indexer will run in the background across the source of all projects.</p></li> |
| 163 | </ol> |
| 164 | |
| 165 | <h4 class="Head5">Building A Project</h4> |
| 166 | <p class="Body"> |
| 167 | To build a project or set of projects, select the project (or |
| 168 | projects) in the <em>Project</em> pane, then select |
| 169 | <strong>Project->Build Project</strong>. Eclipse will evaluate |
| 170 | <em>ALL</em> dependencies automatically, though not necessarily |
| 171 | quickly. |
| 172 | </p> |
| 173 | <p class="Body"> |
| 174 | <em>Hint:</em> a good choice to get all of ACE/TAO built is to |
| 175 | choose the <em>Naming Service</em> project. |
| 176 | </p> |
| 177 | </div> |
| 178 | |
| 179 | <div> |
| 180 | <h3 class="Head2">Multiple Platforms</h3> |
| 181 | <p class="Body"> |
| 182 | Just as a project created within CDT can be set up to support |
| 183 | multiple platforms, so too can projects generated via MPC. To the |
| 184 | extent possible, the platforms are represented in generated projects |
| 185 | in the same way as they are in "native" projects (though there will |
| 186 | be some differences). |
| 187 | </p> |
| 188 | <h4 class="Head5">Generating Projects with Multiple Platform Support</h4> |
| 189 | <p class="Body"> |
| 190 | Platforms are named in a list called <em class="Code">platforms</em> in the |
| 191 | CDT6 template (much like other MPC templates). The list defaults to |
| 192 | the platform on which <em class="Code">mwc.pl</em> is run. To generate for |
| 193 | another platforms, or for additional platforms, you must provide |
| 194 | <em class="Code">platforms</em> with the list of platforms to generate. |
| 195 | </p> |
| 196 | <p class="Body"> |
| 197 | Generate projects using a similar incantation to the default (from |
| 198 | above) using <em class="Code">-type cdt6</em> and <em class="Code">-value_template |
| 199 | platform="<platform_list>"</em>, insuring the |
| 200 | use of <em class="Code">mwc.pl</em> from within ACE, e.g., |
| 201 | <blockquote> |
| 202 | <p class="Code">$ cd $TAO_ROOT</p> |
| 203 | <p class="Code">$ mwc.pl -type cdt6 -value_template platforms="linux cellppu" TAO_ACE.mwc</p> |
| 204 | </blockquote> |
| 205 | </p> |
| 206 | <p class="Body"> |
| 207 | Platforms are defined as scopes in <tt>templates/cdt6platforms.mpt</tt>. |
| 208 | </p> |
| 209 | |
| 210 | <h4 class="Head5">Cross-Compilation</h4> |
| 211 | <p class="Body"> |
| 212 | Cross-compilation is handled the same as a platform; the target is |
| 213 | the platform. If you want to generate for cross-compilation, the |
| 214 | cross-compiler information must be defined in a scope (typically |
| 215 | named for the target type) in |
| 216 | <tt>templates/cdt6platforms.mpt</tt>. If a scope does not exist for |
| 217 | the target, follow <a href="#addplatform">the instructions for adding |
| 218 | a new platform.</a> |
| 219 | </p> |
| 220 | <p class="Body"> |
| 221 | In the example given above, <em class="Code">cellppu</em> is the name of the |
| 222 | platform for cross-compilation. |
| 223 | </p> |
| 224 | |
| 225 | <h4 class="Head5">Adding a New Platform<a name="addplatform"></a></h4> |
| 226 | <p class="Body"> |
| 227 | To add a new platform, particularly one for cross-compilation, it's |
| 228 | probably easiest to start from an existing scope, e.g., |
| 229 | <em class="Code">cellppu</em>. For cross-compilation where the cross-compiler |
| 230 | toolchain is GNU Compiler-based, you will need to provide the names |
| 231 | of the various executables in the toolchain in the values |
| 232 | <em class="Code">as</em>, <em class="Code">ar</em>, <em class="Code">cc</em>, and |
| 233 | <em class="Code">cxx</em>. And, optionally, <em class="Code">ccld</em> and/or |
| 234 | <em class="Code">cxxld</em> if the linker used for linking C and C++ |
| 235 | executables, respectively, is different from the respective |
| 236 | compiler. CDT expects these to be in the path. |
| 237 | </p> |
| 238 | </div> |
| 239 | <div> |
| 240 | <h3 class="Head2">Notes</h3> |
| 241 | <ol> |
| 242 | <li><p class="Body"> |
| 243 | There is no generated workspace. Eclipse's concept of workspace is |
| 244 | very different from MPC's, and there is no way to generate a |
| 245 | workspace. Eclipse's workspace concept doesn't permit sharing |
| 246 | among machines or developers or even checking a workspace into |
| 247 | version control. |
| 248 | </p></li> |
| 249 | |
| 250 | <li><p class="Body">The Eclipse "workspace" and MPC project + source must not be in the |
| 251 | same directory hierarchy. For example, if you chose to have |
| 252 | Eclipse store its workspace in |
| 253 | <em class="Code">/home/joedeveloper/workspace</em>, you may not put your |
| 254 | MPC project+source under that directory. However, putting the |
| 255 | MPC project+source under <em class="Code">/home/joedeveloper/acetao</em> |
| 256 | or similar, <em>i.e.</em>, as a <em>peer</em> to the workspace |
| 257 | directory, is fine. |
| 258 | </p></li> |
| 259 | |
| 260 | <li><p class="Body"><a name="fullpath"></a>CDT6 uses Eclipse's <em>linked |
| 261 | resource</em> feature to work around the usual requirement that |
| 262 | all source code reside in Eclipse project directories. These |
| 263 | act similar to Unix symbolic links. While convenient so that a |
| 264 | developer is not required to conform to Eclipse's directory |
| 265 | layout, it comes at a price: the target of the link must be |
| 266 | specified as a full path. The consequence of this restriction is |
| 267 | that, once the CDT6 projects get generated, the source should |
| 268 | not move in the filesystem.</p></li> |
| 269 | |
| 270 | <li><p class="Body"><a name="remove_projects"></a>MPC's CDT Project Generator |
| 271 | creates directories named <em class="Code">cdt_*</em> for projects, similar |
| 272 | to how the GNUACE generator generates makefiles of the form |
| 273 | <em class="Code">GNUmakefile.*</em>. To remove all CDT projects from a |
| 274 | directory hierarchy, on Linux you can use a command such as:</p> |
| 275 | <blockquote> |
| 276 | <p class="Code">$ find . -name 'cdt_*' -print | xargs rm -rf</p> |
| 277 | </blockquote> |
| 278 | </li> |
| 279 | |
| 280 | <li><p class="Body">Perfect hash generation using the IDL compiler is not |
| 281 | currently working because the IDL compiler cannot find the |
| 282 | <em class="Code">gperf</em> executable. This may be a <em class="Code">PATH</em> |
| 283 | issue, "installation" issue, or an mpc file dependency issue. The |
| 284 | IDL compiler works but does not generate perfect hash lookups.</p></li> |
| 285 | </ol> |
| 286 | </div> |
| 287 | |
| 288 | </div> |
| 289 | |
| 290 | </body> </html> |