From c2713d458c5475f72463e0c171cc7ec8fb0534c7 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Wed, 25 Jul 2007 21:16:04 +0000 Subject: Fixed NARPLUGIN-72 --- PATCHES | 7 ++++++ .../cpptasks/compiler/AbstractProcessor.java | 7 ++++++ src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java | 26 ++++++++-------------- src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java | 26 ++++++++-------------- 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/PATCHES b/PATCHES index 17bb7bc..f4a485e 100644 --- a/PATCHES +++ b/PATCHES @@ -27,6 +27,13 @@ - [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java] limit command line length to 32000. - [src/net/sf/antcontrib/cpptasks/devstudio/VisualStudioNETProjectWriter.java] limit command line length to 32000. +** dll for g++ on windows changes +- [src/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java] Added isWindows() +- [src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java] refactored dllLinker to soLinker +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] refactored dllLinker to soLinker +- [src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java] added dllLinker for windows +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] added dllLinker for windows + ** -fno-rtti changes - [src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java] removed -fno-rtti flag - [src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java] only add -fno-rtti for g++ and c++ diff --git a/src/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java b/src/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java index d0cd77b..045f1ff 100644 --- a/src/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java +++ b/src/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java @@ -123,6 +123,13 @@ public abstract class AbstractProcessor implements Processor, Cloneable { String osName = getOSName(); return "Mac OS X".equals(osName); } +// BEGINFREEHEP + protected boolean isWindows() { + String osName = getOSName(); + return (osName != null) && osName.startsWith("Windows"); + } +// ENDFREEHEP + public final String toString() { return getIdentifier(); } diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java index ed1a052..a551bfa 100644 --- a/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java +++ b/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java @@ -38,7 +38,8 @@ public class GccLinker extends AbstractLdLinker { "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker", "--export-all-symbols", "-static-libgcc",}; - private static final GccLinker dllLinker = new GccLinker("gcc", objFiles, +// FREEHEP refactored dllLinker to soLinker + private static final GccLinker soLinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", true, null)); private static final GccLinker instance = new GccLinker("gcc", objFiles, @@ -49,6 +50,9 @@ public class GccLinker extends AbstractLdLinker { objFiles, discardFiles, "lib", ".dylib", false, null); private static final GccLinker machJNILinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".jnilib", false, null); +// FREEHEP added dllLinker for windows + private static final GccLinker dllLinker = new GccLinker("gcc", + objFiles, discardFiles, "", ".dll", false, null); public static GccLinker getInstance() { return instance; } @@ -197,27 +201,15 @@ public class GccLinker extends AbstractLdLinker { } // BEGINFREEHEP if (type.isJNIModule()) { - if (isDarwin()) { - return machJNILinker; - } else { - return dllLinker; - } + return isDarwin() ? machJNILinker : isWindows() ? dllLinker : soLinker; } -// ENDFREEHEP if (type.isPluginModule()) { - if (isDarwin()) { - return machBundleLinker; - } else { - return dllLinker; - } + return isDarwin() ? machBundleLinker : isWindows() ? dllLinker : soLinker; } if (type.isSharedLibrary()) { - if (isDarwin()) { - return machDllLinker; - } else { - return dllLinker; - } + return isDarwin() ? machDllLinker : isWindows() ? dllLinker : soLinker; } +// ENDFREEHEP return instance; } } diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java index c57845e..fa6b77c 100644 --- a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java @@ -33,7 +33,8 @@ public class GppLinker extends AbstractLdLinker { protected static final String[] discardFiles = new String[0]; protected static final String[] objFiles = new String[]{".o", ".a", ".lib", ".dll", ".so", ".sl"}; - private static final GppLinker dllLinker = new GppLinker("gcc", objFiles, +// FREEHEP refactored dllLinker into soLinker + private static final GppLinker soLinker = new GppLinker("gcc", objFiles, discardFiles, "lib", ".so", false, new GppLinker("gcc", objFiles, discardFiles, "lib", ".so", true, null)); private final static String libPrefix = "libraries: ="; @@ -53,6 +54,9 @@ public class GppLinker extends AbstractLdLinker { // FREEHEP private static final GppLinker machJNILinker = new GppLinker("gcc", objFiles, discardFiles, "lib", ".jnilib", false, null); + // FREEHEP added dllLinker for windows + private static final GppLinker dllLinker = new GppLinker("gcc", + objFiles, discardFiles, "", ".dll", false, null); public static GppLinker getInstance() { return instance; } @@ -219,27 +223,15 @@ public class GppLinker extends AbstractLdLinker { } // BEGINFREEHEP if (type.isJNIModule()) { - if (GccProcessor.getMachine().indexOf("darwin") >= 0) { - return machJNILinker; - } else { - return dllLinker; - } + return isDarwin() ? machJNILinker : isWindows() ? dllLinker : soLinker; } -// ENDFREEHEP if (type.isPluginModule()) { - if (GccProcessor.getMachine().indexOf("darwin") >= 0) { - return machPluginLinker; - } else { - return dllLinker; - } + return isDarwin() ? machPluginLinker : isWindows() ? dllLinker : soLinker; } if (type.isSharedLibrary()) { - if (GccProcessor.getMachine().indexOf("darwin") >= 0) { - return machDllLinker; - } else { - return dllLinker; - } + return isDarwin() ? machDllLinker : isWindows() ? dllLinker : soLinker; } +// ENDFREEHEP return instance; } } -- cgit v1.2.3