diff options
author | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2009-11-30 09:11:43 +0100 |
---|---|---|
committer | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2009-11-30 09:11:43 +0100 |
commit | 82b3d2e292355c7b30f35e68e9506ccbd3c48a34 (patch) | |
tree | 4e3972614993e8eafd6d0cb4f404f2b7f6211ea5 | |
parent | 97c4b6bd774960fe9301829cf2d1ac23882e8958 (diff) | |
download | cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.gz cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.bz2 cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.tar.xz cpptasks-parallel-82b3d2e292355c7b30f35e68e9506ccbd3c48a34.zip |
Fixed NAR-112
-rw-r--r-- | README.txt | 1 | ||||
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/CCTask.java | 3 | ||||
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java | 11 | ||||
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java | 21 |
4 files changed, 34 insertions, 2 deletions
@@ -4,6 +4,7 @@ Modified version of ant contrib cpptasks, used in the freehep/maven-nar-plugin. * cpptasks-1.0-beta-5-parallel-1-SNAPSHOT +- added linkFortranMain option to link with gfortranbegin, see NAR-112 - added compileOrder to the compilerDef (and thus changed most Hashtables into Maps), see NAR-109 - added .f90 as extension for the fortran compiler, see NAR-108 - merged with cpptasks-1.0b5.tar.gz diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java index fec91af..2e2065f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java @@ -1389,6 +1389,9 @@ public class CCTask extends Task { linkType.setLinkFortran(linkFortran); } + public void setLinkFortranMain(boolean linkFortranMain) { + linkType.setLinkFortranMain(linkFortranMain); + } // ENDFREEHEP /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java index 67d7e6b..aae520d 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java @@ -31,6 +31,7 @@ public class LinkType { // BEGINFREEHEP private boolean linkCPP = true; private boolean linkFortran = false; + private boolean linkFortranMain = false; // ENDFREEHEP /** @@ -176,6 +177,14 @@ public class LinkType { public boolean linkFortran() { return linkFortran; } -// ENDFREEHEP + + public void setLinkFortranMain(boolean linkFortranMain) { + this.linkFortranMain = linkFortranMain; + } + + public boolean linkFortranMain() { + return linkFortranMain; + } + // ENDFREEHEP } 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 043720d..ce9f2fb 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java @@ -63,7 +63,7 @@ public class GppLinker extends AbstractLdLinker { private File[] libDirs; private String runtimeLibrary; // FREEEHEP - private String gccLibrary, gfortranLibrary; + private String gccLibrary, gfortranLibrary, gfortranMainLibrary; protected GppLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, @@ -97,6 +97,22 @@ public class GppLinker extends AbstractLdLinker { gfortranLibrary = "-lgfortran"; } } + + gfortranMainLibrary = null; + if (linkType.linkFortran()) { + if (linkType.isExecutable() && linkType.linkFortranMain() && !isDarwin()) { + if (linkType.isStaticRuntime()) { + String[] cmdin = new String[] { "gfortran", + "-print-file-name=libgfortranbegin.a" }; + String[] cmdout = CaptureStreamHandler.run(cmdin); + if ((cmdout.length > 0) && (cmdout[0].indexOf('/') >= 0)) { + gfortranMainLibrary = cmdout[0]; + } + } else { + gfortranMainLibrary = "-lgfortranbegin"; + } + } + } runtimeLibrary = null; if (linkType.linkCPP()) { @@ -137,6 +153,9 @@ public class GppLinker extends AbstractLdLinker { if (gfortranLibrary != null) { endargs.addElement(gfortranLibrary); } + if (gfortranMainLibrary != null) { + endargs.addElement(gfortranMainLibrary); + } if (gccLibrary != null) { endargs.addElement(gccLibrary); } |