summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-12 01:57:45 +0200
committerSven Gothel <[email protected]>2013-09-12 01:57:45 +0200
commit2cdd1070056c0f7e9dc7f40de19c2bfdfef0432a (patch)
treeaacbd861bf10565505e710ce693bf2e3cbc35e3b
parent2603158cb1a0ff29f5a23de4c0ba2ce759f574cf (diff)
Add 'clang' and 'clang++' support (compiler/linker)
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java18
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java4
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java22
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java7
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java7
5 files changed, 49 insertions, 9 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java
index 0233050..28eebda 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java
@@ -53,10 +53,18 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
* <td>GCC C++ compiler</td>
* </tr>
* <tr>
+ * <td>clang</td>
+ * <td>clang / llvm C compiler</td>
+ * </tr>
+ * <tr>
* <td>g++</td>
* <td>GCC C++ compiler</td>
* </tr>
* <tr>
+ * <td>clang++</td>
+ * <td>clang++ / llvm C++ compiler</td>
+ * </tr>
+ * <tr>
* <td>c++</td>
* <td>GCC C++ compiler</td>
* </tr>
@@ -182,23 +190,23 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
* </tr>
* </table>
*
- * @author Curt Arnold
+ * @author Curt Arnold, et.al.
*
*/
public class CompilerEnum extends EnumeratedAttribute {
private final static ProcessorEnumValue[] compilers = new ProcessorEnumValue[]{
new ProcessorEnumValue("gcc", GccCCompiler.getInstance()),
new ProcessorEnumValue("g++", GccCCompiler.getGppInstance()),
+ new ProcessorEnumValue("clang", GccCCompiler.getCLangInstance()),
+ new ProcessorEnumValue("clang++", GccCCompiler.getCPPLangInstance()),
new ProcessorEnumValue("c++", GccCCompiler.getCppInstance()),
new ProcessorEnumValue("g77", GccCCompiler.getG77Instance()),
new ProcessorEnumValue("msvc", DevStudioCCompiler.getInstance()),
new ProcessorEnumValue("msvc8", DevStudio2005CCompiler.getInstance()),
new ProcessorEnumValue("bcc", BorlandCCompiler.getInstance()),
- new ProcessorEnumValue("msrc", DevStudioResourceCompiler
- .getInstance()),
+ new ProcessorEnumValue("msrc", DevStudioResourceCompiler.getInstance()),
new ProcessorEnumValue("brc", BorlandResourceCompiler.getInstance()),
- new ProcessorEnumValue("df", CompaqVisualFortranCompiler
- .getInstance()),
+ new ProcessorEnumValue("df", CompaqVisualFortranCompiler.getInstance()),
new ProcessorEnumValue("midl", DevStudioMIDLCompiler.getInstance()),
new ProcessorEnumValue("icl", IntelWin32CCompiler.getInstance()),
new ProcessorEnumValue("ecl", IntelWin64CCompiler.getInstance()),
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java
index df96723..7421923 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java
@@ -41,13 +41,15 @@ import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranLinker;
/**
* Enumeration of supported linkers
*
- * @author Curt Arnold
+ * @author Curt Arnold, et.al.
*
*/
public class LinkerEnum extends EnumeratedAttribute {
private final static ProcessorEnumValue[] linkers = new ProcessorEnumValue[]{
new ProcessorEnumValue("gcc", GccLinker.getInstance()),
new ProcessorEnumValue("g++", GppLinker.getInstance()),
+ new ProcessorEnumValue("clang", GccLinker.getCLangInstance()),
+ new ProcessorEnumValue("clang++", GppLinker.getCLangInstance()),
new ProcessorEnumValue("ld", LdLinker.getInstance()),
new ProcessorEnumValue("ar", GccLibrarian.getInstance()),
new ProcessorEnumValue("msvc", DevStudioLinker.getInstance()),
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
index ba88d46..fb831e1 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
@@ -33,7 +33,7 @@ import net.sf.antcontrib.cpptasks.OptimizationEnum;
/**
* Adapter for the GCC C/C++ compiler
*
- * @author Adam Murdoch
+ * @author Adam Murdoch, et.al.
*/
public final class GccCCompiler extends GccCompatibleCCompiler {
private final static String[] sourceExtensions = new String[]{".c", /* C */
@@ -67,6 +67,14 @@ public final class GccCCompiler extends GccCompatibleCCompiler {
sourceExtensions, headerExtensions, false,
new GccCCompiler("gcc", sourceExtensions, headerExtensions, true,
null, false, null), false, null);
+ private static final GccCCompiler clangInstance = new GccCCompiler("clang",
+ sourceExtensions, headerExtensions, false,
+ new GccCCompiler("clang", sourceExtensions, headerExtensions, true,
+ null, false, null), false, null);
+ private static final GccCCompiler cpplangInstance = new GccCCompiler("clang++",
+ sourceExtensions, headerExtensions, false,
+ new GccCCompiler("clang++", sourceExtensions, headerExtensions, true,
+ null, false, null), false, null);
/**
* Gets c++ adapter
*/
@@ -91,6 +99,18 @@ public final class GccCCompiler extends GccCompatibleCCompiler {
public static GccCCompiler getInstance() {
return instance;
}
+ /**
+ * Gets clang adapter
+ */
+ public static GccCCompiler getCLangInstance() {
+ return clangInstance;
+ }
+ /**
+ * Gets clang++ adapter
+ */
+ public static GccCCompiler getCPPLangInstance() {
+ return cpplangInstance;
+ }
private String identifier;
private File[] includePath;
private boolean isPICMeaningful = true;
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
index c1e9786..f02dd64 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
@@ -26,7 +26,7 @@ import net.sf.antcontrib.cpptasks.compiler.Linker;
/**
* Adapter for the GCC linker
*
- * @author Adam Murdoch
+ * @author Adam Murdoch, et.al.
*/
public class GccLinker extends AbstractLdLinker {
private static final String[] discardFiles = new String[0];
@@ -44,6 +44,8 @@ public class GccLinker extends AbstractLdLinker {
discardFiles, "lib", ".so", true, null));
private static final GccLinker instance = new GccLinker("gcc", objFiles,
discardFiles, "", "", false, null);
+ private static final GccLinker clangInstance = new GccLinker("clang", objFiles,
+ discardFiles, "", "", false, null);
private static final GccLinker machBundleLinker = new GccLinker("gcc",
objFiles, discardFiles, "lib", ".bundle", false, null);
private static final GccLinker machDllLinker = new GccLinker("gcc",
@@ -51,6 +53,9 @@ public class GccLinker extends AbstractLdLinker {
public static GccLinker getInstance() {
return instance;
}
+ public static GccLinker getCLangInstance() {
+ return clangInstance;
+ }
private File[] libDirs;
protected GccLinker(String command, String[] extensions,
String[] ignoredExtensions, String outputPrefix,
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
index f3bc174..4dfe771 100644
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
@@ -27,7 +27,7 @@ import net.sf.antcontrib.cpptasks.types.LibrarySet;
/**
* Adapter for the g++ variant of the GCC linker
*
- * @author Stephen M. Webb <[email protected]>
+ * @author Stephen M. Webb <[email protected]>, et.al.
*/
public class GppLinker extends AbstractLdLinker {
protected static final String[] discardFiles = new String[0];
@@ -44,6 +44,8 @@ public class GppLinker extends AbstractLdLinker {
"-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"};
private static final GppLinker instance = new GppLinker("gcc", objFiles,
discardFiles, "", "", false, null);
+ private static final GppLinker clangInstance = new GppLinker("clang", objFiles,
+ discardFiles, "", "", false, null);
private static final GppLinker machDllLinker = new GppLinker("gcc",
objFiles, discardFiles, "lib", ".dylib", false, null);
private static final GppLinker machPluginLinker = new GppLinker("gcc",
@@ -51,6 +53,9 @@ public class GppLinker extends AbstractLdLinker {
public static GppLinker getInstance() {
return instance;
}
+ public static GppLinker getCLangInstance() {
+ return clangInstance;
+ }
private File[] libDirs;
private String runtimeLibrary;
protected GppLinker(String command, String[] extensions,