Skip to content
Navigation Menu
{{ message }}
forked from microsoft/VCSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.htm
More file actions
266 lines (229 loc) · 9.48 KB
/
Copy pathREADME.htm
File metadata and controls
266 lines (229 loc) · 9.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<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> </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> </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> </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> </o:p></p>
<p class=MsoNormal>The code in the sample is written in standard C++. </p>
<p class=MsoNormal><o:p> </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> </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"'> </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"'> </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"'> </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"'> </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> </o:p></p>
<p class=MsoNormal>The syntax for the configuration file is:</p>
<p class=MsoNormal><<span class=GramE>original</span> switch> *** <<span
class=SpellE>vc</span> switch> !!!<span style='mso-spacerun:yes'> </span>(<st1:City><st1:place>Normal</st1:place></st1:City>
mapped option)</p>
<p class=MsoNormal><<span class=GramE>original</span> switch> *** <<span
class=SpellE>vc</span> switch> ### (No space option)</p>
<p class=MsoNormal><span style='mso-spacerun:yes'> </span><<span
class=GramE>original</span> switch> *** <<span class=SpellE>vc</span>
switch> ^^^<span style='mso-spacerun:yes'> </span>(Warning option)</p>
<p class=MsoNormal><<span class=GramE>original</span> switch> *** <<span
class=SpellE>vc</span> switch> EEE (Fatal Error option)</p>
<p class=MsoNormal>@@@ <comment line> </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> </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> </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>
You can’t perform that action at this time.
