VCSamples/VC2010Samples/Unix/ccWrapper at master · abascalufe/VCSamples · GitHub
Skip to content

Latest commit

 

History

History
 
 
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="README_files/filelist.xml">
<title>cc Wrapper Sample Utility</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Kang Gatlin</o:Author>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>Kang Su Gatlin</o:LastAuthor>
  <o:Revision>2</o:Revision>
  <o:TotalTime>50</o:TotalTime>
  <o:Created>2002-06-03T18:58:00Z</o:Created>
  <o:LastSaved>2002-08-15T19:06:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>345</o:Words>
  <o:Characters>1970</o:Characters>
  <o:Company>Microsoft Corporation</o:Company>
  <o:Lines>16</o:Lines>
  <o:Paragraphs>4</o:Paragraphs>
  <o:CharactersWithSpaces>2311</o:CharactersWithSpaces>
  <o:Version>10.3501</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]><object
 classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:1487555532;
	mso-list-type:hybrid;
	mso-list-template-ids:1851683122 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-text:"%1\)";
	mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div style='border:none;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:
solid windowtext .75pt;padding:0in 0in 1.0pt 0in'>

<p class=MsoNormal style='border:none;mso-border-bottom-alt:solid windowtext .75pt;
padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'>cc Wrapper Sample Utility</p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>This sample utility demonstrates how one could write a
wrapper that maps a good number of flags from one compiler to the Microsoft
Visual C++ compiler (cl.exe).<span style='mso-spacerun:yes'>  </span>In this
sample we give some mappings from Sun Forte and from <span class=SpellE>gcc</span>.<span
style='mso-spacerun:yes'>  </span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The main goals of this sample are to be useful, readable,
extensible, and usable.<span style='mso-spacerun:yes'>  </span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The code in the sample is written in standard C++. </p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The sample works by reading a configuration file (the
configuration file isn’t necessary though; see below for how to compile so the
configuration file is not necessary) that contains the mappings.<span
style='mso-spacerun:yes'>  </span>This file must be named “<span class=SpellE>ccFile.cfg</span>”.
It then applies these mappings to the command line and executes cl.exe with the
result of applying these mappings.<span style='mso-spacerun:yes'> 
</span>Options that don’t have a mapping in the configuration are passed
through.<span style='mso-spacerun:yes'>  </span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>There are four kinds of options:</p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Normal
mapped options – these options are mapped to the VC option.<span
style='mso-spacerun:yes'>  </span>For example cc –O2 –c <span class=SpellE>test.cpp</span>
maps to cl.exe /O2 /c</p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>No
space options – these options are mapped to the VC option as before, but their
arguments are appended immediately following the option, with no spaces.<span
style='mso-spacerun:yes'>  </span>For example cc –I<span class=GramE>..</span>\include
maps to cl.exe \I<span class=GramE>..</span></p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Warning
option – if this option is on the command line, issue a warning, apply the
mapping, and proceed.</p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>4)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Fatal
Error <span class=GramE>option – if this option is on the command line, issue</span>
a fatal error and then cease execution.</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The syntax for the configuration file is:</p>

<p class=MsoNormal>&lt;<span class=GramE>original</span> switch&gt; *** &lt;<span
class=SpellE>vc</span> switch&gt; !!!<span style='mso-spacerun:yes'>   </span>(<st1:City><st1:place>Normal</st1:place></st1:City>
mapped option)</p>

<p class=MsoNormal>&lt;<span class=GramE>original</span> switch&gt; *** &lt;<span
class=SpellE>vc</span> switch&gt; ### (No space option)</p>

<p class=MsoNormal><span style='mso-spacerun:yes'> </span>&lt;<span
class=GramE>original</span> switch&gt; *** &lt;<span class=SpellE>vc</span>
switch&gt; ^^^<span style='mso-spacerun:yes'>   </span>(Warning option)</p>

<p class=MsoNormal>&lt;<span class=GramE>original</span> switch&gt; *** &lt;<span
class=SpellE>vc</span> switch&gt; EEE (Fatal Error option)</p>

<p class=MsoNormal>@@@ &lt;comment line&gt; </p>

<p class=MsoNormal>~~~ <span style='mso-tab-count:1'>    </span>(End of <span
class=SpellE>config</span> file)</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>We should note that the configuration file given (<span
class=SpellE>ccFile.cfg</span>) is an example configuration file that has flags
for two different compilers in one file.<span style='mso-spacerun:yes'> 
</span>Often this will be broken out to two different files, since there can
only be one mapping from each switch.</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>If not using the configuration file:</p>

<p class=MsoNormal><span style='mso-spacerun:yes'> </span>There are two options
to compile with: (1) with the CCMEMORY defined (/DCCMEMORY) or (2) without it
defined (the default).<span style='mso-spacerun:yes'>  </span>If CCMEMORY is
defined it doesn’t use a configuration and rather builds the set of mappings
directly from the source code.<span style='mso-spacerun:yes'>  </span>See the
method <span class=SpellE>Input::<span class=GramE>CreatePairsFromCode</span></span><span
class=GramE>(</span>).</p>

</div>

</body>

</html>