From 5ba0735d92fa10234e81c24d2157cd1c3771c37b Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Fri, 16 Jun 2006 17:44:50 +0000 Subject: Added flag to disable linking with CPP --- src/net/sf/antcontrib/cpptasks/CCTask.java | 6 ++++++ .../sf/antcontrib/cpptasks/compiler/LinkType.java | 11 +++++++++++ src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java | 20 ++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/net/sf/antcontrib/cpptasks/CCTask.java b/src/net/sf/antcontrib/cpptasks/CCTask.java index d4b0db2..60f7883 100644 --- a/src/net/sf/antcontrib/cpptasks/CCTask.java +++ b/src/net/sf/antcontrib/cpptasks/CCTask.java @@ -1072,6 +1072,12 @@ public class CCTask extends Task { public void setLink(OutputTypeEnum outputType) { linkType.setOutputType(outputType); } + +// FREEHEP added method to link with cpp + public void setLinkCPP(boolean linkCPP) { + linkType.setLinkCPP(linkCPP); + } + /** * Enables or disables generation of multithreaded code * diff --git a/src/net/sf/antcontrib/cpptasks/compiler/LinkType.java b/src/net/sf/antcontrib/cpptasks/compiler/LinkType.java index 31348f2..2ab5380 100644 --- a/src/net/sf/antcontrib/cpptasks/compiler/LinkType.java +++ b/src/net/sf/antcontrib/cpptasks/compiler/LinkType.java @@ -27,6 +27,9 @@ public class LinkType { private OutputTypeEnum outputType = new OutputTypeEnum(); private boolean staticRuntime = false; private SubsystemEnum subsystem = new SubsystemEnum(); +// FREEHEP + private boolean linkCPP = true; + /** * Constructor * @@ -156,6 +159,14 @@ public class LinkType { return subsystem.getValue(); } + public void setLinkCPP(boolean linkCPP) { + this.linkCPP = linkCPP; + } + + public boolean linkCPP() { + return linkCPP; + } + // FREEHEP: flag public boolean callAddLibrarySets = false; } diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java index 6248e00..c8d1da0 100644 --- a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java @@ -72,16 +72,20 @@ public class GppLinker extends AbstractLdLinker { args.addElement("-mwindows"); } } - if (linkType.isStaticRuntime()) { - String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"}; - String[] cmdout = CaptureStreamHandler.run(cmdin); - if (cmdout.length > 0) { - runtimeLibrary = cmdout[0]; +// FREEHEP, avoid stdc++ if requested + runtimeLibrary = null; + if (linkType.linkCPP()) { + if (linkType.isStaticRuntime()) { + String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"}; + String[] cmdout = CaptureStreamHandler.run(cmdin); + if (cmdout.length > 0) { + runtimeLibrary = cmdout[0]; + } else { + runtimeLibrary = null; + } } else { - runtimeLibrary = null; + runtimeLibrary = "-lstdc++"; } - } else { - runtimeLibrary = "-lstdc++"; } // FREEHEP: set flag linkType.callAddLibrarySets = true; -- cgit v1.2.3