View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.github.maven_nar.cpptasks;
21  
22  import org.apache.tools.ant.types.EnumeratedAttribute;
23  
24  import com.github.maven_nar.cpptasks.arm.ADSCCompiler;
25  import com.github.maven_nar.cpptasks.borland.BorlandCCompiler;
26  import com.github.maven_nar.cpptasks.borland.BorlandResourceCompiler;
27  import com.github.maven_nar.cpptasks.compaq.CompaqVisualFortranCompiler;
28  import com.github.maven_nar.cpptasks.compiler.Compiler;
29  import com.github.maven_nar.cpptasks.gcc.GccCCompiler;
30  import com.github.maven_nar.cpptasks.gcc.WindresResourceCompiler;
31  import com.github.maven_nar.cpptasks.hp.aCCCompiler;
32  import com.github.maven_nar.cpptasks.ibm.VisualAgeCCompiler;
33  import com.github.maven_nar.cpptasks.intel.IntelLinux32CCompiler;
34  import com.github.maven_nar.cpptasks.intel.IntelLinux32Compiler;
35  import com.github.maven_nar.cpptasks.intel.IntelLinux64CCompiler;
36  import com.github.maven_nar.cpptasks.intel.IntelLinux64Compiler;
37  import com.github.maven_nar.cpptasks.intel.IntelLinuxFortranCompiler;
38  import com.github.maven_nar.cpptasks.intel.IntelWin32CCompiler;
39  import com.github.maven_nar.cpptasks.intel.IntelWin64CCompiler;
40  import com.github.maven_nar.cpptasks.mozilla.XpidlCompiler;
41  import com.github.maven_nar.cpptasks.msvc.Msvc2005CCompiler;
42  import com.github.maven_nar.cpptasks.msvc.MsvcCCompiler;
43  import com.github.maven_nar.cpptasks.msvc.MsvcMIDLCompiler;
44  import com.github.maven_nar.cpptasks.msvc.MsvcMessageCompiler;
45  import com.github.maven_nar.cpptasks.msvc.MsvcResourceCompiler;
46  import com.github.maven_nar.cpptasks.openwatcom.OpenWatcomCCompiler;
47  import com.github.maven_nar.cpptasks.openwatcom.OpenWatcomFortranCompiler;
48  import com.github.maven_nar.cpptasks.os390.OS390CCompiler;
49  import com.github.maven_nar.cpptasks.os400.IccCompiler;
50  import com.github.maven_nar.cpptasks.sun.C89CCompiler;
51  import com.github.maven_nar.cpptasks.sun.ForteCCCompiler;
52  import com.github.maven_nar.cpptasks.sun.ForteCCompiler;
53  import com.github.maven_nar.cpptasks.sun.ForteF77Compiler;
54  import com.github.maven_nar.cpptasks.ti.ClxxCCompiler;
55  import com.github.maven_nar.cpptasks.trolltech.MetaObjectCompiler;
56  import com.github.maven_nar.cpptasks.trolltech.UserInterfaceCompiler;
57  
58  /**
59   * Enumeration of supported compilers
60   *
61   * <table width="100%" border="1">
62   * <thead>Supported compilers </thead>
63   * <tr>
64   * <td>gcc (default)</td>
65   * <td>GCC C++ compiler</td>
66   * </tr>
67   * <tr>
68   * <td>g++</td>
69   * <td>GCC C++ compiler</td>
70   * </tr>
71   * <tr>
72   * <td>c++</td>
73   * <td>GCC C++ compiler</td>
74   * </tr>
75   * <tr>
76   * <td>clang</td>
77   * <td>clang / llvm C compiler</td>
78   * </tr>
79   * <tr>
80   * <td>clang++</td>
81   * <td>clang++ / llvm C++ compiler</td>
82   * </tr>
83   * <tr>
84   * <tr>
85   * <td>g77</td>
86   * <td>GNU FORTRAN compiler</td>
87   * </tr>
88   * <tr>
89   * <td>msvc</td>
90   * <td>Microsoft Visual C++</td>
91   * </tr>
92   * <tr>
93   * <td>msvc8</td>
94   * <td>Microsoft Visual C++ 8</td>
95   * </tr>
96   * <tr>
97   * <td>bcc</td>
98   * <td>Borland C++ Compiler</td>
99   * </tr>
100  * <tr>
101  * <td>msrc</td>
102  * <td>Microsoft Resource Compiler</td>
103  * </tr>
104  * <tr>
105  * <td>brc</td>
106  * <td>Borland Resource Compiler</td>
107  * </tr>
108  * <tr>
109  * <td>df</td>
110  * <td>Compaq Visual Fortran Compiler</td>
111  * </tr>
112  * <tr>
113  * <td>midl</td>
114  * <td>Microsoft MIDL Compiler</td>
115  * </tr>
116  * <tr>
117  * <td>icl</td>
118  * <td>Intel C++ compiler for Windows (IA-32)</td>
119  * </tr>
120  * <tr>
121  * <td>ecl</td>
122  * <td>Intel C++ compiler for Windows (IA-64)</td>
123  * </tr>
124  * <tr>
125  * <td>icc</td>
126  * <td>Intel C++ compiler for Linux (IA-32)</td>
127  * </tr>
128  * <tr>
129  * <td>ifort</td>
130  * <td>Intel Fortran compiler for Linux (IA-32)</td>
131  * </tr>
132  * <tr>
133  * <td>ecc</td>
134  * <td>Intel C++ compiler for Linux (IA-64)</td>
135  * </tr>
136  * <tr>
137  * <td>CC</td>
138  * <td>Sun ONE C++ compiler</td>
139  * </tr>
140  * <tr>
141  * <td>aCC</td>
142  * <td>HP aC++ C++ Compiler</td>
143  * </tr>
144  * <tr>
145  * <td>os390</td>
146  * <td>OS390 C Compiler</td>
147  * </tr>
148  * <tr>
149  * <td>os400</td>
150  * <td>Icc Compiler</td>
151  * </tr>
152  * <tr>
153  * <td>sunc89</td>
154  * <td>Sun C89 C Compiler</td>
155  * </tr>
156  * <tr>
157  * <td>xlC</td>
158  * <td>VisualAge C Compiler</td>
159  * </tr>
160  * <tr>
161  * <td>cl6x</td>
162  * <td>TI TMS320C6000 Optimizing Compiler</td>
163  * </tr>
164  * <tr>
165  * <td>cl55</td>
166  * <td>TI TMS320C55x Optimizing C/C++ Compiler</td>
167  * </tr>
168  * <tr>
169  * <td>armcpp</td>
170  * <td>ARM 32-bit C++ compiler</td>
171  * </tr>
172  * <tr>
173  * <td>armcc</td>
174  * <td>ARM 32-bit C compiler</td>
175  * </tr>
176  * <tr>
177  * <td>tcpp</td>
178  * <td>ARM 16-bit C++ compiler</td>
179  * </tr>
180  * <tr>
181  * <td>tcc</td>
182  * <td>ARM 16-bit C compiler</td>
183  * </tr>
184  * *
185  * <tr>
186  * <td>uic</td>
187  * <td>Qt user interface compiler</td>
188  * </tr>
189  * <tr>
190  * <td>moc</td>
191  * <td>Qt meta-object compiler</td>
192  * </tr>
193  * <tr>
194  * <td>xpidl</td>
195  * <td>Mozilla xpidl compiler (creates .h and .xpt files).</td>
196  * </tr>
197  * <tr>
198  * <td>wcl</td>
199  * <td>OpenWatcom C/C++ compiler (experimental)</td>
200  * </tr>
201  * <tr>
202  * <td>wfl</td>
203  * <td>OpenWatcom FORTRAN compiler (experimental)</td>
204  * </tr>
205  * <tr>
206  * <td>windres</td>
207  * <td>GNU windres resource compiler</td>
208  * </tr>
209  * </table>
210  *
211  * @author Curt Arnold
212  * 
213  */
214 public class CompilerEnum extends EnumeratedAttribute {
215   private final static ProcessorEnumValue[] compilers = new ProcessorEnumValue[] {
216       new ProcessorEnumValue("gcc", GccCCompiler.getInstance()),
217       new ProcessorEnumValue("g++", GccCCompiler.getGppInstance()),
218       new ProcessorEnumValue("clang", GccCCompiler.getCLangInstance()),
219       new ProcessorEnumValue("clang++", GccCCompiler.getCLangppInstance()),
220       new ProcessorEnumValue("c++", GccCCompiler.getCppInstance()),
221       new ProcessorEnumValue("g77", GccCCompiler.getG77Instance()),
222       // FREEHEP
223       new ProcessorEnumValue("gfortran", GccCCompiler.getGFortranInstance()),
224       new ProcessorEnumValue("msvc", MsvcCCompiler.getInstance()),
225       new ProcessorEnumValue("msvc8", Msvc2005CCompiler.getInstance()),
226       new ProcessorEnumValue("bcc", BorlandCCompiler.getInstance()),
227       new ProcessorEnumValue("msrc", MsvcResourceCompiler.getInstance()),
228       new ProcessorEnumValue("msmc", MsvcMessageCompiler.getInstance()),
229       new ProcessorEnumValue("brc", BorlandResourceCompiler.getInstance()),
230       new ProcessorEnumValue("df", CompaqVisualFortranCompiler.getInstance()),
231       new ProcessorEnumValue("midl", MsvcMIDLCompiler.getInstance()),
232       new ProcessorEnumValue("icl", IntelWin32CCompiler.getInstance()),
233       new ProcessorEnumValue("ecl", IntelWin64CCompiler.getInstance()),
234       // BEGINFREEHEP
235       new ProcessorEnumValue("icc", IntelLinux32CCompiler.getInstance()),
236       new ProcessorEnumValue("ecc", IntelLinux64CCompiler.getInstance()),
237       new ProcessorEnumValue("icpc", IntelLinux32Compiler.getInstance()),
238       new ProcessorEnumValue("ecpc", IntelLinux64Compiler.getInstance()),
239       new ProcessorEnumValue("ifort", IntelLinuxFortranCompiler.getInstance()),
240       // ENDFREEHEP
241       new ProcessorEnumValue("CC", ForteCCCompiler.getInstance()),
242       // BEGINFREEHEP
243       new ProcessorEnumValue("suncc", ForteCCompiler.getInstance()),
244       new ProcessorEnumValue("sunf77", ForteF77Compiler.getInstance()),
245       // ENDFREEHEP
246       new ProcessorEnumValue("aCC", aCCCompiler.getInstance()),
247       new ProcessorEnumValue("os390", OS390CCompiler.getInstance()),
248       new ProcessorEnumValue("os400", IccCompiler.getInstance()),
249       new ProcessorEnumValue("sunc89", C89CCompiler.getInstance()),
250       new ProcessorEnumValue("xlC", VisualAgeCCompiler.getInstance()),
251       new ProcessorEnumValue("cl6x", ClxxCCompiler.getCl6xInstance()),
252       new ProcessorEnumValue("cl55", ClxxCCompiler.getCl55Instance()),
253       new ProcessorEnumValue("armcc", ADSCCompiler.getArmCC()),
254       new ProcessorEnumValue("armcpp", ADSCCompiler.getArmCpp()),
255       new ProcessorEnumValue("tcc", ADSCCompiler.getThumbCC()),
256       new ProcessorEnumValue("tcpp", ADSCCompiler.getThumbCpp()),
257       // GCC Cross Compilers
258       new ProcessorEnumValue("sparc-sun-solaris2-gcc",
259           com.github.maven_nar.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler.getInstance()),
260       new ProcessorEnumValue("sparc-sun-solaris2-g++",
261           com.github.maven_nar.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler.getGppInstance()),
262       new ProcessorEnumValue("sparc-sun-solaris2-c++",
263           com.github.maven_nar.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler.getCppInstance()),
264       new ProcessorEnumValue("sparc-sun-solaris2-g77",
265           com.github.maven_nar.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler.getG77Instance()),
266       // GCC Cross Compilers
267       new ProcessorEnumValue("gcc-cross", com.github.maven_nar.cpptasks.gcc.cross.GccCCompiler.getInstance()),
268       new ProcessorEnumValue("g++-cross", com.github.maven_nar.cpptasks.gcc.cross.GccCCompiler.getGppInstance()),
269       new ProcessorEnumValue("c++-cross", com.github.maven_nar.cpptasks.gcc.cross.GccCCompiler.getCppInstance()),
270       new ProcessorEnumValue("g77-cross", com.github.maven_nar.cpptasks.gcc.cross.GccCCompiler.getG77Instance()),
271       new ProcessorEnumValue("uic", UserInterfaceCompiler.getInstance()),
272       new ProcessorEnumValue("moc", MetaObjectCompiler.getInstance()),
273       new ProcessorEnumValue("xpidl", XpidlCompiler.getInstance()),
274       new ProcessorEnumValue("wcl", OpenWatcomCCompiler.getInstance()),
275       new ProcessorEnumValue("wfl", OpenWatcomFortranCompiler.getInstance()),
276       new ProcessorEnumValue("windres", WindresResourceCompiler.getInstance())
277   };
278 
279   public Compiler getCompiler() {
280     return (Compiler) compilers[getIndex()].getProcessor();
281   }
282 
283   @Override
284   public String[] getValues() {
285     return ProcessorEnumValue.getValues(compilers);
286   }
287 }