diff options
61 files changed, 3874 insertions, 504 deletions
@@ -0,0 +1,4 @@ +To deploy use something like this: + +mvn -Darguments=-DaltDeploymentRepository=releases::default::http://localhost:8081/nexus/content/repositories/releases/ release:perform + @@ -2,3 +2,5 @@ This product includes software developed by The Ant-Contrib project (http://ant-contrib.sourceforge.net) This product includes software developed by The Apache Software Foundation (http://www.apache.org/). +This product was changed by FreeHEP + The FreeHEP project (http://java.freehep.org/). diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..6a65766 --- /dev/null +++ b/README.txt @@ -0,0 +1,119 @@ +Modified version of ant contrib cpptasks, used in the freehep/maven-nar-plugin. + +*** ALL Changes marked with FREEHEP or BEGINFREEHEP-ENDFREEHEP. + +* cpptasks-1.0-beta-5-parallel-1-SNAPSHOT + +- merged with cpptasks-1.0b5.tar.gz ++++ some problems with tests may occur on other platforms than MacOS X. + +* cpptasks-1.0-beta-4-parallel-5 + +- moved src to src/main/java, and some resource files to src/main/resources for easy merge with cpptasks-1.0b5 +- [src/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker] use absolute paths for all paths to overcome windows file length limit. + +* cpptasks-1.0-beta-4-parallel-4 + +- Added fake <distributionManagement> section to pom to avoid MDEPLOY-50. One can now deploy + this artifact using altDeploymentRepository + +* cpptasks-1.0-beta-4-parallel-3 + +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinuxFortranCompiler.java] added ifort. +- [src/net/sf/antcontrib/cpptasks/CompilerEnum.java] added ifort. + +* cpptasks-1.0-beta-4-parallel-2 + +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] g++ handles gfortran static linking. +- [src/net/sf/antcontrib/cpptasks/compiler/LinkType.java] g++ handles gfortran static linking. +- [src/net/sf/antcontrib/cpptasks/CCTask.java] g++ handles gfortran static linking. +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] g++ puts runtime library at the end. + +* cpptasks-1.0-beta-4-parallel-1 + +** Misc. +- [src/net/sf/antcontrib/cpptasks/SubsystemEnum.java] changed default subsystem from "gui" into "console" +- [src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java] no more need for -prebind as of 10.4 +- [src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java] removed trailing space after "-framework" to avoid quoting +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] added -shared-libgcc/-static-libgcc for linking gcc and c++. +- [src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java] added -dynamic as a valid option to GccLinker +- [src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java] no -Bstatic for Darwin and no -Bdynamic for framework +- [src/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java] removed addition of quotes. +- [src/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java] added missing code for -fno-exceptions +- [src/net/sf/antcontrib/cpptasks/CCTask.java] added log statement to identify linker and compiler +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] g++ linking now includes option -fexceptions +- [src/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker] use absolute paths for filenames if they are shorter than relative paths to overcome windows file length limit. +- [src/net/sf/antcontrib/cpptasks/CCTask.java] added thread to keep progress + +** Parallel running change +- [src/net/sf/antcontrib/cpptasks/CCTask.java] fork of a process per core/cpu available. +- [src/net/sf/antcontrib/cpptasks/TargetHistoryTable.java] protect against multi-threaded updates. +- [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java] replaced /Zi flag with /Z7 to disable writing debug database file (.pdb). +- [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java] limit command line length to 32000. +- [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java] limit command line length to 32000. +- [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java] limit command line length to 32000. +- [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java] limit command line length to 32000. +- [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. +- [src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java] limit command line for Windows to 20000. +- [src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java] limit command line for Windows to 20000. + + +** 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++ + +** Launch process change +- [src/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java] rewrote the launching of subprocesses (NARPLUGIN-71). +- [src/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java] added protection against null return of run() method. + +** libstdc++ linking +- [src/net/sf/antcontrib/cpptasks/CCTask.java] added method to link with CPP +- [src/net/sf/antcontrib/cpptasks/compiler/LinkType.java] added method to link with CPP +- [src/net/sf/antcontrib/cpptasks/compiler/gcc/GppLinker.java] link with or without CPP + +** jni libraries (MacOS X) +- [src/net/sf/antcontrib/cpptasks/OutputTypeEnum.java] added jni +- [src/net/sf/antcontrib/cpptasks/compiler/LinkType] add jni as type +- [src/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker] added jni +- [src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java] add jni as type and special linker for MacOS X to output jnilib files. +- [src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java] add jni as type and special linker for MacOS X to output jnilib files. + +** gfortran compiler +- [src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java] added gfortran compiler +- [src/net/sf/antcontrib/cpptasks/CompilerEnum.java] added gfortran compiler + +** intel compilers name change +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux32CLinker.java] added (icpc) +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux32Compiler.java] added (icpc) +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux64CLinker.java] added (ecpc) +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux64Compiler.java] added (ecpc) +- [src/net/sf/antcontrib/cpptasks/LinkerEnum.java] added and changed linkers +- [src/net/sf/antcontrib/cpptasks/CompilerEnum.java] added and changed compilers. +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java] links to IntelLinux32CLinker. +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java] links to IntelLinux64CLinker. +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java] changed linker name from icc to icpc for version 8.1 of Intel Compilers. +- [src/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java] changed linker name from ecc to ecpc for version 8.1 of Intel Compilers. + +** sun c and fortran compiles +- [src/net/sf/antcontrib/cpptasks/sun/ForteCCompiler.java] added (suncc) +- [src/net/sf/antcontrib/cpptasks/sun/ForteF77Compiler.java] added (sunf77) +- [src/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java] changed -static into -staticlib=%all +- [src/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java] if last was -Bstatic reset it to -Bdynamic so that libc and libm can be found as shareables +- [src/net/sf/antcontrib/cpptasks/CompilerEnum] Added the above (suncc, sunf77). + +** bug [ 1109917 ] g++ linker does not add runtime w/o other libs referenced +- [src/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker] always call addLibrarySets + +** bug [ 795683 ] cpptasks speedup +- [src/net/sf/antcontrib/cpptasks/DependencyTable.java] cpptasks speedup +- [src/net/sf/antcontrib/cpptasks/DependencyInfo.java] cpptasks speedup + + @@ -1,40 +1,17 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>ant-contrib</groupId> - <artifactId>cpptasks</artifactId> - <packaging>jar</packaging> - <name>cpptasks</name> - <version>1.0b5</version> - <description>Compile tasks for Apache Ant</description> - <url>http://ant-contrib.sourceforge.net:80/cpptasks</url> - <issueManagement> - <system>SourceForge Tracker</system> - <url>http://sourceforge.net/tracker/?group_id=36177/</url> - </issueManagement> - <ciManagement> - <system>Gump</system> - <url>http://vmgump.apache.org/gump/public/cpptasks/index.html</url> - </ciManagement> + + <groupId>net.sf.antcontrib</groupId> + <artifactId>cpptasks-parallel</artifactId> + <version>1.0-beta-5-parallel-1-SNAPSHOT</version> + + <name>CPPTasks (parallel)</name> + <description> + Library to call native compilers and linkers. + </description> + <url>http://github.com/duns/cpptasks-parallel</url> + <inceptionYear>2001</inceptionYear> - <mailingLists> - <mailingList> - <name>ant-contrib-cvs</name> - <subscribe>https://lists.sourceforge.net/lists/listinfo/ant-contrib-cvs</subscribe> - <unsubscribe>https://lists.sourceforge.net/lists/listinfo/ant-contrib-cvs</unsubscribe> - <archive>http://sourceforge.net/mailarchive/forum.php?forum_name=ant-contrib-cvs</archive> - </mailingList> - <mailingList> - <name>ant-contrib-developers</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/ant-contrib-developers</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/ant-contrib-developers</unsubscribe> - <post>ant-contrib-developers@lists.sourceforge.net</post> - <archive>http://sourceforge.net/mailarchive/forum.php?forum_name=ant-contrib-developers</archive> - </mailingList> - </mailingLists> - <organization> - <name>Ant-Contrib Project</name> - <url>http://ant-contrib.sourceforge.net</url> - </organization> <licenses> <license> <name>The Apache Software License, Version 2.0</name> @@ -42,215 +19,89 @@ <distribution>repo</distribution> </license> </licenses> + <scm> - <connection>scm:svn:https://ant-contrib.svn.sourceforge.net/svnroot/ant-contrib/cpptasks/tags/cpptasks-1.0b5</connection> - <developerConnection>scm:svn:https://ant-contrib.svn.sourceforge.net/svnroot/ant-contrib/cpptasks/tags/cpptasks-1.0b5</developerConnection> - <url>http://ant-contrib.svn.sourceforge.net/viewvc/ant-contrib/cpptasks/tags/cpptasks-1.0b5</url> + <connection>scm:git:git://github.com/duns/cpptasks-parallel.git</connection> + <developerConnection>scm:git:git://github.com/duns/cpptasks-parallel.git</developerConnection> + <url>http://github.com/duns/cpptasks-parallel</url> </scm> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + +<!-- to avoid MDEPLOY-50 --> +<distributionManagement> + <repository> + <id>repo</id> + <name>Repository Name</name> + <url>scp://host/path/to/repo</url> + </repository> + <snapshotRepository> + <id>repo</id> + <name>Repository Name</name> + <url>scp://host/path/to/repo</url> + </snapshotRepository> +</distributionManagement> + <build> + <defaultGoal>install</defaultGoal> <plugins> <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.4.1</version> - <configuration> - <reportFormat>plain</reportFormat> - <excludes> - <exclude>**/TestInstalledDevStudioLinker.java</exclude> - <exclude>**/TestMetaObjectCompiler.java</exclude> - <exclude>**/TestAbstract*.java</exclude> - </excludes> - </configuration> - </plugin> - <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <source>1.3</source> - <target>1.1</target> - <optimize>true</optimize> + <source>1.4</source> + <target>1.4</target> + <optimize>true</optimize> </configuration> </plugin> - <plugin> + <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> - <manifestSections> - <manifestSection> - <name>net.sf.antcontrib.cpptasks</name> - <manifestEntries> - <Implementation-Title>cpptasks: Compiler Tasks for Apache Ant.</Implementation-Title> - <Implementation-Version>${project.version}</Implementation-Version> - <Implementation-Vendor>Ant-Contrib Project</Implementation-Vendor> - </manifestEntries> - </manifestSection> - </manifestSections> + <manifestSections> + <manifestSection> + <name>net.sf.antcontrib.cpptasks</name> + <manifestEntries> + <Implementation-Title>cpptasks: Compiler Tasks for Apache Ant.</Implementation-Title> + <Implementation-Version>${project.version}</Implementation-Version> + <Implementation-Vendor>Ant-Contrib Project</Implementation-Vendor> + </manifestEntries> + </manifestSection> + </manifestSections> </archive> </configuration> </plugin> <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <!-- release builds will put SVN tags into the SCM page, this changes it back to a branch --> - <execution> - <phase>pre-site</phase> - <id>pre-site</id> - <configuration> - <tasks> - <mkdir dir="target/taskdocs-classes" /> - <javac srcdir="src/taskdocs/java" destdir="target/taskdocs-classes" debug="true" /> - <mkdir dir="src/site/xdoc/antdocs" /> - <javadoc sourcepath="src/main/java" doclet="net.sf.antcontrib.taskdocs.TaskDoclet" docletPath="target/taskdocs-classes" classpath="${user.home}/.m2/repository/ant/ant/1.6.5/ant-1.6.5.jar"> - <fileset dir="src/main/java" includes="**/*.java" /> - </javadoc> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <phase>site</phase> - <id>untag-site</id> - <configuration> - <tasks> - <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" /> - <replaceregexp file="target/site/source-repository.html" match="/tags/[^ "'<]*" replace="/trunk" flags="g" /> - <replaceregexp match="Generated on .* for " replace="Generated for " flags="g"> - <fileset dir="target/site/apidocs" includes="**/*.html" /> - </replaceregexp> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>ant</groupId> - <artifactId>ant-nodeps</artifactId> - <version>1.6.5</version> - </dependency> - <dependency> - <groupId>ant</groupId> - <artifactId>ant-trax</artifactId> - <version>1.6.5</version> - </dependency> - </dependencies> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/bin.xml</descriptor> - </descriptors> - <appendAssemblyId>false</appendAssemblyId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <reportFormat>plain</reportFormat> + <excludes> + <exclude>**/TestInstalledDevStudioLinker.java</exclude> + <exclude>**/TestMetaObjectCompiler.java</exclude> + <exclude>**/TestAbstract*.java</exclude> + </excludes> </configuration> - <executions> - <execution> - <goals> - <goal>assembly</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> </plugin> - <plugin> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>clirr-maven-plugin</artifactId> - <configuration> - <comparisonVersion>1.0b3</comparisonVersion> - </configuration> - </plugin> - </plugins> -</build> -<dependencies> - <dependency> - <groupId>ant</groupId> - <artifactId>ant</artifactId> - <version>1.6.5</version> - </dependency> + </plugins> + </build> + + <dependencies> <dependency> - <groupId>xerces</groupId> - <artifactId>xercesImpl</artifactId> - <version>2.8.1</version> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>1.6.5</version> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> -</dependencies> - <reporting> - <excludeDefaults>true</excludeDefaults> - <plugins> - <plugin> - <artifactId>maven-project-info-reports-plugin</artifactId> - <reportSets> - <reportSet> - <reports> - <report>scm</report> - <report>cim</report> - <report>javadoc</report> - <report>issue-tracking</report> - <report>mailing-list</report> - <report>license</report> - </reports> - </reportSet> - </reportSets> - </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <goals>site-deploy</goals> - </configuration> - </plugin> - <plugin> - <artifactId>maven-changes-plugin</artifactId> - <reportSets> - <reportSet> - <reports> - <report>changes-report</report> - </reports> - </reportSet> - </reportSets> - <configuration> - <issueLinkTemplate>http://sourceforge.net/tracker/index.php?func=detail&aid=%ISSUE%&group_id=36177&atid=416920</issueLinkTemplate> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - </plugins> - </reporting> - <distributionManagement> - <repository> - <id>ant-contrib.repo</id> - <url>file:///${user.dir}/target/m2-repo</url> - </repository> - <site> - <id>cpptasks.site</id> - <url>file:///${user.dir}/target/site-deploy</url> - </site> - </distributionManagement> -</project>
\ No newline at end of file + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.8.1</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/samples/.cvsignore b/samples/.cvsignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/samples/.cvsignore @@ -0,0 +1 @@ +build diff --git a/samples/blas.ant b/samples/blas.ant new file mode 100644 index 0000000..c1a28f5 --- /dev/null +++ b/samples/blas.ant @@ -0,0 +1,185 @@ +<?xml version="1.0"?> +<!-- + +Copyright 2004 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + + build file for generic FORTRAN 77 Basic Linear Algebra Subprograms library + (http://www.netlib.org/blas/blas.tgz) and double precision tests + + targets test-dblat2 and test-dblat3 require Ant 1.6 + + + +--> +<project name="blas" default="test-all"> + +<property name="base.dir" value="."/> +<property name="debug" value="true"/> +<property name="compiler" value="g77"/> +<property name="src.dir" location="${base.dir}/src"/> +<property name="tests.dir" location="${base.dir}/tests"/> +<property name="build.dir" location="build"/> +<property name="libtype" value="static"/> + +<taskdef resource="cpptasks.tasks"/> +<typedef resource="cpptasks.types"/> + +<target name="usage"> + <echo message="Builds BLAS (http://www.netlib.org/blas)."/> + <echo message="Usage:"/> + <echo message="ant -f blas.ant -Dsrc.dir=c:/blas -Dtests.dir=c:/blas-tests"/> + <echo message=" -Dcompiler=[g77 | df ...]"/> + <echo message=" -Dlibtype=[static | shared ...]"/> +</target> + +<target name="get-blas"> + <get src="http://www.netlib.org/blas/blas.tgz" usetimestamp="true" + dest="${base.dir}/blas.tgz"/> + <untar src="${base.dir}/blas.tgz" dest="${src.dir}" compression="gzip" overwrite="true"/> + <mkdir dir="${tests.dir}"/> + <get src="http://www.netlib.org/blas/dblat1" usetimestamp="true" + dest="${tests.dir}/dblat1.f"/> + <get src="http://www.netlib.org/blas/dblat2" usetimestamp="true" + dest="${tests.dir}/dblat2.f"/> + <get src="http://www.netlib.org/blas/dblat2d" usetimestamp="true" + dest="${tests.dir}/dblat2d"/> + <get src="http://www.netlib.org/blas/dblat3" usetimestamp="true" + dest="${tests.dir}/dblat3.f"/> + <get src="http://www.netlib.org/blas/dblat3d" usetimestamp="true" + dest="${tests.dir}/dblat3d"/> +</target> + +<target name="init"> + <mkdir dir="${build.dir}"/> + <property name="obj.dir" value="${build.dir}/obj"/> + <mkdir dir="${obj.dir}"/> + <property environment="env"/> + <!-- in case not set in environment, use an insignificant value --> + <property name="env.LD_LIBRARY_PATH" value="."/> + <condition property="is-shared"><equals arg1="${libtype}" arg2="shared"/></condition> + <condition property="is-gcc"> + <or> + <equals arg1="${compiler}" arg2="gcc"/> + <equals arg1="${compiler}" arg2="g77"/> + </or> + </condition> +</target> + +<target name="clean"> + <delete dir="${build.dir}"/> +</target> + + +<target name="build-lib" depends="init"> + <cc subsystem="console" + outfile="${build.dir}/blas" + objdir="${obj.dir}" + outtype="${libtype}" + debug="${debug}" + warnings="diagnostic" + optimize="speed" + name="${compiler}"> + <fileset dir="${src.dir}" includes="*.f"/> + </cc> +</target> + +<target name="build-dblat1" depends="build-lib"> + <cc outfile="${build.dir}/dblat1" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="dblat1.exe"> + <fileset dir="${tests.dir}" includes="dblat1.f"/> + <!-- the following line is undesirable and will hopefully be made unnecessary shortly --> + <libset libs="g2c, frtbegin" if="is-gcc"/> + <libset dir="${build.dir}" type="${libtype}" libs="blas"/> + </cc> +</target> + + +<target name="test-dblat1" depends="build-dblat1"> + <exec dir="${build.dir}" + executable="${dblat1.exe}" + failonerror="true"/> +</target> + +<target name="build-dblat2" depends="build-lib"> + <cc outfile="${build.dir}/dblat2" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="dblat2.exe"> + <fileset dir="${tests.dir}" includes="dblat2.f"/> + <!-- the following line is undesirable and will hopefully be made unnecessary shortly --> + <syslibset libs="g2c, frtbegin" if="is-gcc"/> + <libset dir="${build.dir}" type="${libtype}" libs="blas"/> + </cc> +</target> + + +<target name="test-dblat2" depends="build-dblat2"> + <delete file="${build.dir}/DBLAT2.SUMM"/> + <!-- requires Ant 1.6 due to the input attribute --> + <exec dir="${build.dir}" + executable="${dblat2.exe}" + failonerror="true" + input="${tests.dir}/dblat2d"/> + <concat><fileset dir="${build.dir}" includes="DBLAT2.SUMM"/></concat> +</target> + + +<target name="build-dblat3" depends="build-lib"> + <cc outfile="${build.dir}/dblat3" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="dblat3.exe"> + <fileset dir="${tests.dir}" includes="dblat3.f"/> + <!-- the following line is undesirable and will hopefully be made unnecessary shortly --> + <syslibset libs="g2c, frtbegin" if="is-gcc"/> + <libset dir="${build.dir}" type="${libtype}" libs="blas"/> + </cc> +</target> + + +<target name="test-dblat3" depends="build-dblat3"> + <delete file="${build.dir}/DBLAT3.SUMM"/> + <!-- requires Ant 1.6 due to the input attribute --> + <exec dir="${build.dir}" + executable="${dblat3.exe}" + failonerror="true" + input="${tests.dir}/dblat3d"/> + <concat><fileset dir="${build.dir}" includes="DBLAT3.SUMM"/></concat> +</target> + + + +<target name="all" depends="build-dblat1, build-dblat2, build-dblat3"/> + +<target name="test-all" depends="test-dblat1, test-dblat2, test-dblat3"/> + +</project>
\ No newline at end of file diff --git a/samples/check.ant b/samples/check.ant new file mode 100644 index 0000000..f0e1c14 --- /dev/null +++ b/samples/check.ant @@ -0,0 +1,206 @@ +<?xml version="1.0"?> +<!-- + +Copyright 2004 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + + build file for check 0.9.3 (http://check.sourceforge.net) + a C unit test framework for POSIX-like OS. + +--> +<project name="check" default="test-all"> + +<property name="base.dir" value="."/> +<property name="debug" value="true"/> +<property name="compiler" value="gcc"/> +<property name="src.dir" location="${base.dir}/src"/> +<property name="tests.dir" location="${base.dir}/tests"/> +<property name="money.dir" location="${base.dir}/doc/money"/> +<property name="build.dir" location="build"/> +<property name="major" value="0"/> +<property name="minor" value="9"/> +<property name="build" value="3"/> +<!-- specify api="unix" or api="win32" override platform default --> +<property name="api" value="default"/> + +<taskdef resource="cpptasks.tasks"/> +<typedef resource="cpptasks.types"/> + +<target name="usage"> + <echo message="Builds check (http://check.sourceforge.net)."/> + <echo message="Usage:"/> + <echo message="ant -f cppunit.ant -Dbase.dir=c:/check-0.9.3"/> + <echo message=" -Dcompiler=[gcc | icc ...]"/> +</target> + + <target name="init"> + <mkdir dir="${build.dir}"/> + <property name="obj.dir" value="${build.dir}/obj"/> + <mkdir dir="${obj.dir}"/> + <condition property="is-gcc"> + <or> + <equals arg1="${compiler}" arg2="gcc"/> + <equals arg1="${compiler}" arg2="g++"/> + </or> + </condition> + <condition property="is-msvc"> + <or> + <equals arg1="${compiler}" arg2="msvc"/> + </or> + </condition> + <property environment="env"/> + <!-- in case not set in environment, use an insignificant value --> + <property name="env.LD_LIBRARY_PATH" value="."/> + <available property="configure-available" + file="${base.dir}/configure"/> + <available property="config-available" + file="${base.dir}/config.h"/> + </target> + +<target name="autogen" + depends="init" + unless="configure-available"> + <exec dir="${base.dir}" executable="bash"> + <arg value="autogen.sh"/> + </exec> +</target> + + +<target name="configure" + depends="autogen" + unless="config-available"> + <exec dir="${base.dir}" executable="bash"> + <arg value="configure"/> + </exec> +</target> + +<target name="clean"> + <delete dir="${build.dir}"/> +</target> + + +<target name="static-lib" depends="configure"> + <mkdir dir="${obj.dir}"/> + <cc subsystem="console" + outfile="${build.dir}/check" + objdir="${obj.dir}" + outtype="static" + debug="${debug}" + warnings="diagnostic" + optimize="speed" + name="${compiler}"> + <fileset dir="${src.dir}" includes="*.c"/> + <includepath path="${base.dir};${src.dir}"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="HAVE_CONFIG_H"/> + <versioninfo refid="check-version"/> + </cc> +</target> + +<target name="build-money" depends="static-lib"> + <cc outfile="${build.dir}/money" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="money.exe"> + <fileset dir="${money.dir}" includes="*.c"/> + <includepath path="${src.dir}"/> + <libset dir="${build.dir}" libs="check"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo refid="check-version"/> + </cc> +</target> + + +<target name="test-money" depends="build-money"> + <exec dir="${build.dir}" + executable="${money.exe}" + failonerror="false"/> +</target> + +<target name="build-check_check" depends="static-lib"> + + <!-- test expected file of test failure not to include + path, this change checks that the last 17 characters + of the file are check_check_sub.c --> + <replace file="${tests.dir}/check_check_master.c" + token='strcmp(tr_lfile(tr_fail_array[i])' + value="strcmp(strchr(tr_lfile(tr_fail_array[i]), 0) - 17"/> + + <!-- multiple tests expected error message not to include + path to source file, changed hardcoded "check_check_fixture.c" + to __FILE__ --> + <replace file="${tests.dir}/check_check_fixture.c" + token='"check_check_fixture.c:' + value='__FILE__ ":'/> + + <cc outfile="${build.dir}/check_check" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="check_check.exe"> + <fileset dir="${tests.dir}" includes="check_check*.c, check_list.c"/> + <includepath path="${src.dir};${tests.dir}"/> + <libset dir="${build.dir}" libs="check"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo refid="check-version"/> + </cc> +</target> + + +<target name="test-check_check" depends="build-check_check"> + <exec dir="${tests.dir}" + executable="${check_check.exe}" + failonerror="true"/> +</target> + +<target name="build-check_stress" depends="static-lib"> + <cc outfile="${build.dir}/check_stress" + outtype="executable" + subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + warnings="diagnostic" + name="${compiler}" + outputfileproperty="check_stress.exe"> + <fileset dir="${tests.dir}" includes="check_stress.c"/> + <includepath path="${src.dir};${tests.dir}"/> + <libset dir="${build.dir}" libs="check"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo refid="check-version"/> + </cc> +</target> + + +<target name="test-check_stress" depends="build-check_stress"> + <exec dir="${tests.dir}" + executable="${check_stress.exe}" + failonerror="true"/> +</target> + + +<target name="all" depends="build-money, build-check_check, build-check_stress"/> + +<target name="test-all" depends="test-money, test-check_check, test-check_stress"/> + +</project>
\ No newline at end of file diff --git a/samples/cppunit.ant b/samples/cppunit.ant new file mode 100644 index 0000000..9b0938b --- /dev/null +++ b/samples/cppunit.ant @@ -0,0 +1,583 @@ +<?xml version="1.0"?> +<!-- + +Copyright 2004-2006 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project name="cppunit" default="test-all-but-qt"> + +<property name="base.dir" value="."/> +<property name="debug" value="true"/> +<property name="compiler" value="gcc"/> +<property name="src.dir" location="${base.dir}/src"/> +<property name="examples.dir" location="${base.dir}/examples"/> +<property name="build.dir" location="build"/> +<property name="projects.dir" location="${build.dir}"/> +<property name="include.dir" location="${base.dir}/include"/> +<property name="config.dir" location="${base.dir}/config"/> +<property name="qt.dir" location="/usr/lib/qt3"/> +<property name="major" value="1"/> +<property name="minor" value="10"/> +<property name="build" value="2"/> +<!-- specify api="unix" or api="win32" override platform default --> +<property name="api" value="default"/> + +<taskdef resource="cpptasks.tasks"/> +<typedef resource="cpptasks.types"/> + +<target name="usage"> + <echo message="Builds cppunit (http://cppunit.sf.net)."/> + <echo message="Usage:"/> + <echo message="ant -f cppunit.ant -Dbase.dir=c:\cppunit-1.10.2"/> + <echo message=" -Dcompiler=[gcc | msvc | icc | bcc ...]"/> + <echo message="Status:"/> + <echo message="test-all will pass for gcc and icc on Linux"/> + <echo message="test-all-but-qt will pass for gcc on Mac OS/X"/> + <echo message="test-all-but-qt will pass for msvc on Windows"/> + <echo message="all-but-qt will pass for bcc but test that divide by zero will fail"/> + <echo message="test-all-but-qt will pass for gcc and CC on Solaris,"/> + <echo message="but may be necessary to add /usr/ccs/bin so "ar" may be found and"/> + <echo message="add the location of libstdc++ to LD_LIBRARY_PATH"/> +</target> + +<!-- + sample versioninfo, targetplatform and distributer to check + if definitions are processed, not functional at this time +--> +<versioninfo id="cppunit-version" + fileversion="${major}.${minor}.${build}" + productversion="${major}.${minor}.${build}" + compatibilityversion="1" + legalcopyright="Copyright © 1996-2000 by Michael Feathers <mfeathers@objectmentor.com>" + productname="cppunit" + companyname="Cppunit project <http://cppunit.sourceforge.net>" + /> + +<target name="init"> + <mkdir dir="${build.dir}"/> + <property name="obj.dir" value="${build.dir}/obj"/> + <mkdir dir="${obj.dir}"/> + <condition property="is-gcc"> + <or> + <equals arg1="${compiler}" arg2="gcc"/> + <equals arg1="${compiler}" arg2="g++"/> + </or> + </condition> + <condition property="is-msvc"> + <or> + <equals arg1="${compiler}" arg2="msvc"/> + </or> + </condition> + <condition property="is-windows"><os family="windows"/></condition> + <condition property="not-windows"> + <not> + <isset property="is-windows"/> + </not> + </condition> + <condition property="is-win32"> + <or> + <equals arg1="${api}" arg2="win32"/> + <and> + <equals arg1="${api}" arg2="default"/> + <isset property="is-windows"/> + </and> + </or> + </condition> + <property environment="env"/> + <!-- in case not set in environment, use an insignificant value --> + <property name="env.LD_LIBRARY_PATH" value="."/> + <available property="configure-available" + file="${base.dir}/configure"/> + <available property="config-auto-available" + file="${include.dir}/cppunit/config-auto.h"/> + <condition property="use-brc"> + <equals arg1="${compiler}" arg2="bcc"/> + </condition> +</target> + + <target name="autogen" + depends="init" + if="not-windows" unless="configure-available"> + <exec dir="${base.dir}" executable="bash"> + <arg value="autogen.sh"/> + </exec> + </target> + + + <target name="configure" + depends="autogen" + if="not-windows" unless="config-available"> + <exec dir="${base.dir}" executable="bash"> + <arg value="configure"/> + </exec> + </target> + + + + <target name="clean"> + <delete dir="${build.dir}"/> + <delete dir="${projects.dir}"/> + </target> + + +<target name="shared-lib" depends="configure"> + <mkdir dir="${obj.dir}/cppunit_shared"/> + <mkdir dir="${build.dir}/lib"/> + <mkdir dir="${projects.dir}"/> + <cc subsystem="console" + objdir="${obj.dir}/cppunit_shared" + debug="${debug}" + outtype="shared" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outfile="${build.dir}/lib/cppunit"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/cppunit" + includes="*.cpp" excludes="DllMain.cpp"/> + <fileset dir="${src.dir}/cppunit" + includes="DllMain.cpp" + if="is-windows"/> + <fileset dir="${include.dir}/cppunit" includes="**/*.h" excludes="**/MfcTestRunner.h"/> + <includepath path="${include.dir}"/> + <libset libs="dl" unless="is-win32"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="CPPUNIT_BUILD_DLL"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo extends="cppunit-version" filedescription="Cppunit shared library"/> + <project outfile="${projects.dir}/shared" type="cbuilderx" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/shared" type="msvc6" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/shared" type="msvc8" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/shared" type="xcode" name="cppunit" failonerror="false"/> + </cc> +</target> + +<target name="static-lib" depends="configure"> + <mkdir dir="${obj.dir}/cppunit_static"/> + <mkdir dir="${projects.dir}"/> + <cc subsystem="console" + outfile="${build.dir}/cppunit" + objdir="${obj.dir}/cppunit_static" + outtype="static" + debug="${debug}" + exceptions="true" + rtti="true" + optimize="speed" + name="${compiler}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/cppunit" + includes="*.cpp" excludes="DllMain.cpp"/> + <fileset dir="${include.dir}/cppunit" includes="**/*.h" excludes="**/MfcTestRunner.h"/> + <includepath path="${include.dir}"/> + <defineset define="WIN32" if="is-win32"/> + <libset libs="stdc++" if="is-gcc"/> + <versioninfo extends="cppunit-version" filedescription="Cppunit static library"/> + <project outfile="${projects.dir}/static" type="cbuilderx" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/static" type="msvc6" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/static" type="msvc8" name="cppunit" failonerror="false"/> + <project outfile="${projects.dir}/static" type="xcode" name="cppunit" failonerror="false"/> + </cc> +</target> + +<target name="compile-static-test" depends="static-lib"> + <mkdir dir="${obj.dir}/cppunittestmain_static"/> + <cc outfile="${build.dir}/cppunittestmain_static" + outtype="executable" + subsystem="console" + objdir="${obj.dir}/cppunittestmain_static" + debug="${debug}" + exceptions="true" + rtti="true" + optimize="speed" + name="${compiler}" + outputfileproperty="test-static.exe"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${examples.dir}/cppunittest" + includes="*.cpp, *.h" excludes="CppUnitTestPlugIn.cpp, MockProtector.h"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}" libs="cppunit"/> + <defineset define="WIN32" if="is-win32"/> + <libset libs="stdc++" if="is-gcc"/> + <versioninfo extends="cppunit-version" filedescription="Self tests using static library"/> + <project outfile="${projects.dir}/test_static" type="cbuilderx" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_static" type="msvc6" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_static" type="msvc8" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_static" type="xcode" name="unittest" failonerror="false"/> + </cc> +</target> + +<target name="compile-shared-test" depends="shared-lib"> + <mkdir dir="${obj.dir}/cppunittestmain_shared"/> + <cc outfile="${build.dir}/lib/cppunittestmain_shared" + outtype="executable" + subsystem="console" + objdir="${obj.dir}/cppunittestmain_shared" + debug="${debug}" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outputfileproperty="test.exe"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${examples.dir}/cppunittest" + includes="*.cpp, *.h" excludes="CppUnitTestPlugIn.cpp, MockProtector.h"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}/lib" libs="cppunit"/> + <defineset define="CPPUNIT_DLL"/> + <defineset define="WIN32" if="is-win32"/> + <libset libs="stdc++" if="is-gcc"/> + <versioninfo extends="cppunit-version" filedescription="Self tests using shared library"/> + <project outfile="${projects.dir}/test_shared" type="cbuilderx" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_shared" type="msvc6" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_shared" type="msvc8" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test_shared" type="xcode" name="unittest" failonerror="false"/> + </cc> +</target> + +<!-- +compile CPPUnit implementation and unit tests into a single executable +--> +<target name="compile-mono-test" depends="configure"> + <mkdir dir="${obj.dir}/cppunittestmain_mono"/> + <mkdir dir="${build.dir}/lib"/> + <cc outfile="${build.dir}/lib/cppunittestmain" + outtype="executable" + subsystem="console" + objdir="${obj.dir}/cppunittestmain_mono" + debug="${debug}" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outputfileproperty="test.exe"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/cppunit" + includes="*.cpp" excludes="DllMain.cpp"/> + <libset libs="dl" unless="is-win32"/> + <fileset dir="${examples.dir}/cppunittest" + includes="*.cpp, *.h" excludes="CppUnitTestPlugIn.cpp, MockProtector.h"/> + <fileset dir="${include.dir}/cppunit" includes="**/*.h" + excludes="**/MfcTestRunner.h"/> + <includepath path="${include.dir}"/> + <defineset define="WIN32" if="is-win32"/> + <libset libs="stdc++" if="is-gcc"/> + <versioninfo extends="cppunit-version" filedescription="Combined unit tests and implementation"/> + <project outfile="${projects.dir}/test" type="cbuilderx" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test" type="msvc6" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test" type="msvc8" name="unittest" failonerror="false"/> + <project outfile="${projects.dir}/test" type="xcode" name="unittest" failonerror="false"/> + </cc> +</target> + +<target name="test-static" depends="compile-static-test"> + <!-- return value (or Ant's treatment of it) is + inconsistent on Linux --> + <exec dir="${build.dir}" + executable="${test-static.exe}" + failonerror="true"/> +</target> + +<target name="test-shared" depends="compile-shared-test"> + <!-- return value (or Ant's treatment of it) is + inconsistent on Linux --> + <exec dir="${build.dir}" + executable="${build.dir}/lib/cppunittestmain_shared" + failonerror="true"> + <env key="LD_LIBRARY_PATH" value="${build.dir}/lib:${env.LD_LIBRARY_PATH}"/> + </exec> +</target> + +<target name="test-mono" depends="compile-mono-test"> + <exec dir="${build.dir}" + executable="${build.dir}/lib/cppunittestmain" + failonerror="true"/> +</target> + +<target name="qttestrunner" depends="shared-lib"> + <mkdir dir="${obj.dir}/qttestrunner"/> + <mkdir dir="${build.dir}/qttestrunner"/> + <cc outfile="${build.dir}/qttestrunner" + outtype="shared" + subsystem="console" + objdir="${obj.dir}/qttestrunner" + exceptions="true" + name="${compiler}" + rtti="true" + optimize="speed" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/qttestrunner" includes="*.cpp, *.h"/> + <compiler name="uic"> + <fileset dir="${src.dir}/qttestrunner" includes="*.ui"/> + </compiler> + <defineset define="_REENTRANT,QT_NO_DEBUG,QT_THREAD_SUPPORT,QT_SHARED,QT_TABLE_SUPPORT"/> + <includepath path="${include.dir}"/> + <includepath path="${obj.dir}/qttestrunner"/> + <includepath path="${qt.dir}/include"/> + <libset dir="${build.dir}/lib" libs="cppunit"/> + <libset dir="${qt.dir}/lib" libs="qt-mt"/> + <libset libs="pthread"/> + <libset libs="stdc++" if="is-gcc"/> + <versioninfo extends="cppunit-version" filedescription="Qt test runner"/> + <project outfile="${projects.dir}/qttestrunner" type="cbuilderx" name="qttestrunner" failonerror="false"/> + <project outfile="${projects.dir}/qttestrunner" type="msvc6" name="qttestrunner" failonerror="false"/> + <project outfile="${projects.dir}/qttestrunner" type="msvc8" name="qttestrunner" failonerror="false"/> + <project outfile="${projects.dir}/qttestrunner" type="xcode" name="qttestrunner" failonerror="false"/> + </cc> + +</target> + +<target name="plugintester" depends="static-lib"> + <mkdir dir="${obj.dir}/DllPlugInTester"/> + <cc outfile="${build.dir}/DllPlugInTester" + outtype="executable" + subsystem="console" + objdir="${obj.dir}/DllPlugInTester" + exceptions="true" + rtti="true" + optimize="speed" + name="${compiler}" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/DllPlugInTester" + includes="*.cpp, *.h" + excludes="DllPlugInTesterTest.cpp"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="dl" unless="is-windows"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-windows"/> + <versioninfo extends="cppunit-version" fileversion="Dll Plug-in tester"/> + <project outfile="${projects.dir}/plugintester" type="cbuilderx" name="plugintester" failonerror="false"/> + <project outfile="${projects.dir}/plugintester" type="msvc6" name="plugintester" failonerror="false"/> + <project outfile="${projects.dir}/plugintester" type="msvc8" name="plugintester" failonerror="false"/> + <project outfile="${projects.dir}/plugintester" type="xcode" name="plugintester" failonerror="false"/> + </cc> +</target> + + +<target name="plugintestertest" depends="plugintester"> + <mkdir dir="${obj.dir}/DllPlugInTester"/> + <cc outfile="${build.dir}/DllPlugInTesterTest" + outtype="executable" + subsystem="console" + objdir="${obj.dir}/DllPlugInTester" + name="${compiler}" + exceptions="true" + optimize="speed" + rtti="true" + debug="${debug}"> + <fileset dir="${src.dir}/DllPlugInTester" + includes="*.cpp, *.h" + excludes="DllPlugInTester.cpp"/> + <includepath path="${include.dir}"/> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="dl" unless="is-windows"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-windows"/> + <versioninfo extends="cppunit-version" filedescription="Tests for Plugin tester"/> + <project outfile="${projects.dir}/plugintester-test" type="cbuilderx" name="plugintester-test" failonerror="false"/> + <project outfile="${projects.dir}/plugintester-test" type="msvc6" name="plugintester-test" failonerror="false"/> + <project outfile="${projects.dir}/plugintester-test" type="msvc8" name="plugintester-test" failonerror="false"/> + <project outfile="${projects.dir}/plugintester-test" type="xcode" name="plugintester-test" failonerror="false"/> + </cc> +</target> + +<target name="test-plugintestertest" depends="plugintestertest"> + <exec executable="${build.dir}/DllPlugInTesterTest"/> +</target> + +<target name="money" depends="static-lib"> + <mkdir dir="${obj.dir}/money"/> + <cc outfile="${build.dir}/MoneyApp" + outtype="executable" + subsystem="console" + name="${compiler}" + objdir="${obj.dir}/money" + exceptions="true" + rtti="true" + optimize="speed" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${examples.dir}/money" + includes="*.cpp, *.h"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="dl" unless="is-windows"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo extends="cppunit-version" filedescription="Money example"/> + <project outfile="${projects.dir}/money" type="cbuilderx" name="money" failonerror="false"/> + <project outfile="${projects.dir}/money" type="msvc6" name="money" failonerror="false"/> + <project outfile="${projects.dir}/money" type="msvc8" name="money" failonerror="false"/> + <project outfile="${projects.dir}/money" type="xcode" name="money" failonerror="false"/> + </cc> +</target> + +<target name="test-money" depends="money"> + <exec executable="${build.dir}/MoneyApp" + failonerror="true"/> +</target> + +<target name="hierarchy" depends="static-lib"> + <mkdir dir="${obj.dir}/hierarchy"/> + <cc outfile="${build.dir}/hierarchy" + outtype="executable" + subsystem="console" + name="${compiler}" + objdir="${obj.dir}/hierarchy" + exceptions="true" + rtti="true" + optimize="speed" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${examples.dir}/hierarchy" + includes="*.cpp, *.h"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="dl" unless="is-windows"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo extends="cppunit-version" filedescription="Hierarchy example"/> + <project outfile="${projects.dir}/hierarchy" type="cbuilderx" name="hierarchy" failonerror="false"/> + <project outfile="${projects.dir}/hierarchy" type="msvc6" name="hierarchy" failonerror="false"/> + <project outfile="${projects.dir}/hierarchy" type="msvc8" name="hierarchy" failonerror="false"/> + <project outfile="${projects.dir}/hierarchy" type="xcode" name="hierarchy" failonerror="false"/> + </cc> +</target> + +<target name="test-hierarchy" depends="hierarchy"> + <!-- some tests intentionally fail --> + <exec executable="${build.dir}/hierarchy" + resultproperty="hierarchy-result"/> + <condition property="hierarchy-pass"> + <equals arg1="${hierarchy-result}" arg2="0"/> + </condition> + <fail unless="hierarchy-pass" + message="hierarchy erroneously passed all tests"/> +</target> + +<target name="simple" depends="static-lib"> + <mkdir dir="${obj.dir}/simple"/> + <cc outfile="${build.dir}/simple" + outtype="executable" + subsystem="console" + name="${compiler}" + exceptions="true" + optimize="speed" + rtti="true" + objdir="${obj.dir}/simple" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${examples.dir}/simple" + includes="*.cpp, *.h" excludes="SimplePlugIn.cpp"/> + <includepath path="${include.dir}"/> + <!-- original was shared, but changing gives + an error loading library --> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="dl" unless="is-windows"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo extends="cppunit-version" filedescription="Sample plug-in"/> + <project outfile="${projects.dir}/simple" type="cbuilderx" name="simple" failonerror="false"/> + <project outfile="${projects.dir}/simple" type="msvc6" name="simple" failonerror="false"/> + <project outfile="${projects.dir}/simple" type="msvc8" name="simple" failonerror="false"/> + <project outfile="${projects.dir}/simple" type="xcode" name="simple" failonerror="false"/> + </cc> +</target> + +<target name="test-simple" depends="simple"> + <!-- some tests intentionally fail --> + <exec executable="${build.dir}/simple" + resultproperty="simple-result"/> + <condition property="simple-pass"> + <equals arg1="${simple-result}" arg2="0"/> + </condition> + <!-- fail unless="simple-pass" + message="simple erroneously passed all tests"/ --> +</target> + +<target name="dsplugin" depends="static-lib" if="is-windows"> + <mkdir dir="${obj.dir}/DSPlugIn"/> + <!-- DSPlugIn.rc required compiled tlb to be in same directory --> + <cc objdir="${src.dir}/msvc6/DSPlugIn" + name="midl"> + <fileset dir="${src.dir}/msvc6/DSPlugIn" includes="*.idl"/> + </cc> + <cc outfile="${build.dir}/TestRunnerDSPlugIn" + outtype="shared" + subsystem="gui" + objdir="${obj.dir}/DSPlugIn" + exceptions="true" + name="${compiler}" + optimize="speed" + rtti="true" + debug="${debug}"> + <compiler name="brc" if="use-brc"/> + <compiler name="msrc"/> + <fileset dir="${src.dir}/msvc6/DSPlugIn" + includes="*.cpp *.rc, *.h"/> + <compiler name="msrc"/> + <includepath path="${include.dir}"/> + <libset dir="${build.dir}" libs="cppunit"/> + <libset libs="stdc++" if="is-gcc"/> + <defineset define="WIN32" if="is-win32"/> + <versioninfo refid="cppunit-version"/> + <project outfile="${projects.dir}/TestRunnerDSPlugIn" type="cbuilderx" name="TestRunnerDSPlugIn" failonerror="false"/> + <project outfile="${projects.dir}/TestRunnerDSPlugIn" type="msvc6" name="TestRunnerDSPlugIn" failonerror="false"/> + <project outfile="${projects.dir}/TestRunnerDSPlugIn" type="msvc8" name="TestRunnerDSPlugIn" failonerror="false"/> + <project outfile="${projects.dir}/TestRunnerDSPlugIn" type="xcode" name="TestRunnerDSPlugIn" failonerror="false"/> + </cc> +</target> + + + +<target name="all-static" depends="static-lib, + plugintestertest, + money, + hierarchy, + simple"/> + +<target name="test-all-static" depends="test-static, + test-plugintestertest, + test-money, + test-hierarchy, + test-simple"/> + +<target name="all-but-qt" depends="shared-lib,all-static"/> + +<target name="test-all-but-qt" depends="test-shared,test-all-static"/> + +<target name="all-qt" depends="qttestrunner"/> + +<target name="test-all-qt" depends="qttestrunner"/> + +<target name="all" depends="all-but-qt, all-qt"/> + +<target name="test-all" depends="test-all-but-qt, test-all-qt"/> + +</project> diff --git a/samples/qtunit.ant b/samples/qtunit.ant new file mode 100644 index 0000000..fab89ed --- /dev/null +++ b/samples/qtunit.ant @@ -0,0 +1,238 @@ +<?xml version="1.0"?> +<!-- + +Copyright 2004 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + +Build file for qtunit 0.9.8 (http://www.uwyn.com/projects/qtunit/index.html) +A Trolltech Qt based unit testing framework. +--> +<project name="qtunit" default="test-all"> + +<property name="base.dir" value="."/> +<property name="debug" value="true"/> +<property name="compiler" value="gcc"/> +<property name="src.dir" location="${base.dir}/src"/> +<property name="samples.dir" location="${base.dir}/samples"/> +<property name="build.dir" location="build"/> +<property name="include.dir" location="${base.dir}/include"/> +<property name="config.dir" location="${base.dir}/config"/> +<property name="qt.dir" location="/usr/lib/qt3"/> +<property name="major" value="0"/> +<property name="minor" value="9"/> +<property name="build" value="8"/> +<!-- specify api="unix" or api="win32" override platform default --> +<property name="api" value="default"/> + +<taskdef resource="cpptasks.tasks"/> +<typedef resource="cpptasks.types"/> + +<target name="usage"> + <echo message="Builds qtunit 0.9.8 (http://www.uwyn.com/projects/qtunit/index.html)."/> + <echo message="Usage:"/> + <echo message="ant -f qtunit.ant -Dbase.dir=c:/qtunit-0.9.8"/> + <echo message=" -Dcompiler=[gcc | msvc | icc | bcc ...]"/> +</target> + +<target name="init"> + <mkdir dir="${build.dir}"/> + <property name="obj.dir" value="${build.dir}/obj"/> + <mkdir dir="${obj.dir}"/> + <condition property="is-gcc"> + <or> + <equals arg1="${compiler}" arg2="gcc"/> + <equals arg1="${compiler}" arg2="g++"/> + </or> + </condition> + <condition property="is-msvc"> + <or> + <equals arg1="${compiler}" arg2="msvc"/> + </or> + </condition> + <condition property="is-windows"><os family="windows"/></condition> + <condition property="is-win32"> + <or> + <equals arg1="${api}" arg2="win32"/> + <and> + <equals arg1="${api}" arg2="default"/> + <isset property="is-windows"/> + </and> + </or> + </condition> + <property environment="env"/> + <!-- in case not set in environment, use an insignificant value --> + <property name="env.LD_LIBRARY_PATH" value="."/> +</target> + +<target name="clean"> + <delete dir="${build.dir}"/> +</target> + + +<target name="build-libqtunit" depends="init"> + <mkdir dir="${obj.dir}"/> + + <!-- preprocesses .ui and .h files, places generated files on obj.dir --> + <cc objdir="${obj.dir}"> + <!-- runs uic twice and moc once to create *.h, *.cpp and moc_*.cpp files --> + <compiler name="uic" inherit="false"> + <fileset dir="${src.dir}" includes="guirunner/*.ui"/> + </compiler> + <!-- runs moc only on files with Q_OBJECT --> + <compiler name="moc" inherit="false"> + <fileset dir="${src.dir}" includes="guirunner/*.h, framework/*.h"/> + </compiler> + </cc> + + <cc subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + outtype="shared" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outfile="${build.dir}/qtunit"> + <fileset dir="${src.dir}/framework" includes="*.cpp"/> + <fileset dir="${src.dir}/guirunner" includes="*.cpp"/> + <fileset dir="${src.dir}/textrunner" includes="*.cpp"/> + <fileset dir="${obj.dir}" includes="*.cpp"/> + <syslibset libs="pthread"/> + <syslibset dir="${qt.dir}/lib" libs="qt-mt"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="_REENTRANT,QT_THREAD_SUPPORT, QT_SHARED, QT_TABLET_SUPPORT"/> + <defineset define="QT_NO_DEBUG" unless="is-debug"/> + <includepath path="${obj.dir}"/> + <includepath path="${qt.dir}/include"/> + <includepath path="${src.dir};${src.dir}/framework;${src.dir}/guirunner"/> + </cc> +</target> + + +<target name="build-texttestrunner" depends="build-libqtunit"> + <mkdir dir="${obj.dir}"/> + <cc subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + outtype="executable" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outfile="${build.dir}/texttestrunner"> + <fileset dir="${samples.dir}/texttestrunner" includes="*.cpp"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="_REENTRANT,QT_THREAD_SUPPORT, QT_SHARED, QT_TABLET_SUPPORT"/> + <defineset define="QT_NO_DEBUG" unless="is-debug"/> + <includepath path="${obj.dir}"/> + <includepath path="${src.dir};${src.dir}/framework;${src.dir}/textrunner"/> + <includepath path="${qt.dir}/include"/> + <libset dir="${build.dir}" libs="qtunit"/> + </cc> +</target> + +<target name="build-guitestrunner" depends="build-libqtunit"> + <mkdir dir="${obj.dir}"/> + <cc subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + outtype="executable" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outfile="${build.dir}/guitestrunner"> + <fileset dir="${samples.dir}/guitestrunner" includes="*.cpp"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="_REENTRANT,QT_THREAD_SUPPORT, QT_SHARED, QT_TABLET_SUPPORT"/> + <defineset define="QT_NO_DEBUG" unless="is-debug"/> + <includepath path="${obj.dir}"/> + <includepath path="${src.dir};${src.dir}/framework;${src.dir}/guirunner"/> + <includepath path="${qt.dir}/include"/> + <libset dir="${build.dir}" libs="qtunit"/> + </cc> +</target> + + +<target name="build-testmodule" depends="init"> + <mkdir dir="${obj.dir}"/> + <cc subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + outtype="shared" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outputfileproperty="testmodule.so" + outfile="${build.dir}/testmodule"> + <fileset dir="${samples.dir}/testmodule" includes="*.cpp"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="_REENTRANT,QT_THREAD_SUPPORT, QT_SHARED, QT_TABLET_SUPPORT"/> + <defineset define="QT_NO_DEBUG" unless="is-debug"/> + <includepath path="${src.dir};${src.dir}/framework"/> + <includepath path="${qt.dir}/include"/> + <libset dir="${build.dir}" libs="qtunit"/> + </cc> +</target> + +<target name="test-texttestrunner" depends="build-texttestrunner, build-testmodule"> + <echo file="${build.dir}/testproject.qpj" message='<PROJECT NAME="testproject"><MODULE><FILEPATH>${testmodule.so}</FILEPATH><SOURCEPATH>${samples.dir}/testmodule/</SOURCEPATH></MODULE></PROJECT>'/> + <exec dir="${build.dir}" + executable="${build.dir}/texttestrunner" + failonerror="false"> + <env key="LD_LIBRARY_PATH" value="${build.dir}:${env.LD_LIBRARY_PATH}"/> + <arg value="${build.dir}/testproject.qpj"/> + </exec> +</target> + + +<target name="build-standalonerunner" depends="build-libqtunit"> + <mkdir dir="${obj.dir}"/> + <cc subsystem="console" + objdir="${obj.dir}" + debug="${debug}" + outtype="executable" + name="${compiler}" + exceptions="true" + rtti="true" + optimize="speed" + outfile="${build.dir}/standalonerunner"> + <fileset dir="${samples.dir}/standalonerunner" includes="*.cpp"/> + <defineset define="WIN32" if="is-win32"/> + <defineset define="_REENTRANT,QT_THREAD_SUPPORT, QT_SHARED, QT_TABLET_SUPPORT"/> + <defineset define="QT_NO_DEBUG" unless="is-debug"/> + <includepath path="${src.dir};${src.dir}/framework;${src.dir}/textrunner"/> + <includepath path="${qt.dir}/include"/> + <libset dir="${build.dir}" libs="qtunit"/> + </cc> +</target> + + +<target name="test-standalonerunner" depends="build-standalonerunner"> + <exec dir="${build.dir}" + executable="${build.dir}/standalonerunner" + failonerror="false"> + <env key="LD_LIBRARY_PATH" value="${build.dir}:${env.LD_LIBRARY_PATH}"/> + </exec> +</target> + +<target name="all" depends="build-standalonerunner, build-texttestrunner, build-guitestrunner"/> + +<target name="test-all" depends="test-standalonerunner, test-texttestrunner, build-guitestrunner"/> + +</project> diff --git a/samples/xercesc.ant b/samples/xercesc.ant new file mode 100644 index 0000000..b3072de --- /dev/null +++ b/samples/xercesc.ant @@ -0,0 +1,1113 @@ +<?xml version="1.0"?> + +<!-- + +Copyright 2001-2004 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project default="main" basedir="."> + + <!-- Give user a chance to override without editing this file + (and without typing -D each time it compiles it) --> + <property file=".ant.properties" /> + <property file="${user.home}/.ant.properties" /> + + <property name="Name" value="Apache Xerces-C"/> + <property name="name" value="xercesc"/> + <property name="version" value="1.5"/> + + <property name="compiler" value="gcc"/> + <property name="debug" value="true" /> + <property name="chmod.fail" value="true" /> + <property name="platform" value="linux"/> + <property name="messageloader" value="inmem"/> + <property name="netaccessor" value="native"/> + <property name="transcoder" value="iconv"/> + <property name="thread" value="pthread"/> + <property name="subsystem" value="gui"/> + + <!-- property compiler="gcc"/ --> + + <!-- + =================================================================== + Set the properties related to the source tree + =================================================================== + --> + <property name="src.dir" value="."/> + <property name="include.dir" value=".."/> + <property name="samples.dir" value="../../samples"/> + <property name="tests.dir" value="../../tests"/> + <property name="scripts.dir" value="scripts"/> + <property name="docs.dir" value="doc"/> + <property name="tests.dir" value="tests"/> + <property name="xml4com.dir" value="../../Build/Win32/xml4com"/> + + + <!-- + =================================================================== + Set the properties for the build area + =================================================================== + --> + + <!-- + <taskdef resource="cpptasks.tasks"/> + <typedef resource="cpptasks.types"/> + --> + <taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask"/> + <typedef name="linker" classname="net.sf.antcontrib.cpptasks.LinkerDef"/> + <typedef name="compiler" classname="net.sf.antcontrib.cpptasks.CompilerDef"/> + + + <target name="pre-init"> + <condition property="windows"> + <os family="windows"/> + </condition> + <condition property="linux"> + <equals arg1="${platform}" arg2="linux"/> + </condition> + <condition property="is-debug"> + <isTrue value="${debug}"/> + </condition> + <condition property="use-msvc"> + <equals arg1="${compiler}" arg2="VC6"/> + </condition> + <condition property="use-gcc"> + <equals arg1="${compiler}" arg2="gcc"/> + </condition> + <condition property="use-bcc"> + <equals arg1="${compiler}" arg2="bcc"/> + </condition> + <condition property="use-icl"> + <equals arg1="${compiler}" arg2="icl"/> + </condition> + <condition property="use-ecl"> + <equals arg1="${compiler}" arg2="ecl"/> + </condition> + <condition property="use-icc"> + <equals arg1="${compiler}" arg2="icc"/> + </condition> + <condition property="use-ecc"> + <equals arg1="${compiler}" arg2="ecc"/> + </condition> + <condition property="use-CC"> + <equals arg1="${compiler}" arg2="CC"/> + </condition> + <condition property="use-xlC"> + <equals arg1="${compiler}" arg2="xlC"/> + </condition> + <condition property="inmem_messageloader"> + <equals arg1="${messageloader}" arg2="inmem"/> + </condition> + <condition property="netaccessor_socket"> + <equals arg1="${netaccessor}" arg2="socket"/> + </condition> + <condition property="native_transcoder"> + <equals arg1="${transcoder}" arg2="native"/> + </condition> + <condition property="pthread"> + <equals arg1="${thread}" arg2="pthread"/> + </condition> + </target> + + <target name="win-debug-init" depends="pre-init" if="is-debug"> + <property name="winbuild.dir" value="../../Build/Win32/${compiler}/Debug"/> + <property name="winbuild.obj.dir" value="${winbuild.dir}/obj"/> + </target> + + <target name="exec-link"> + <exec executable="link"/> + </target> + + <target name="exec-link-bogus"> + <exec executable="link"> + <arg value="/bogus"/> + </exec> + </target> + + <target name="win-release-init" depends="pre-init" unless="is-debug"> + <property name="winbuild.dir" value="../../build/win32/${compiler}/Release"/> + <property name="winbuild.obj.dir" value="${winbuild.dir}/obj"/> + </target> + + <target name="win-init" depends="win-debug-init,win-release-init" if="windows"> + <echo message="is windows"/> + <property name="win32_transcoder" value=""/> + <property name="netaccessor_winsock" value=""/> + <property name="win32_msgloader" value=""/> + <property name="build.dir" value="${winbuild.dir}"/> + <property name="build.obj.dir" value="${winbuild.obj.dir}"/> + </target> + + <target name="linux-init" depends="pre-init" if="linux"> + <echo message="is linux"/> + <property name="build.obj.dir" value="../../antobj/LINUX"/> + <property name="build.dir" value="../../antlib"/> + <property name="netaccessor_socket" value=""/> + <property name="inmem_messageloader" value=""/> + <property name="pthreads" value=""/> + <property name="iconv_transcoder" value=""/> + </target> + + <target name="init" depends="win-init,linux-init"/> + + <target name="clean"> + <delete dir="../../build"/> + </target> + + <compiler id="base-msvc" name="msvc"> + <!-- target Pentium Pro --> + <compilerarg value="/G6"/> + <!-- display many warnings --> + <compilerarg value="/W3"/> + <!-- maximize speed --> + <compilerarg value="/O2" unless="is-debug"/> + <!-- auto-inlining --> + <compilerarg value="/Ob2" unless="is-debug"/> + <defineset> + <define name="_CRTDBG_MAP_ALLOC" if="is-debug"/> + </defineset> + </compiler> + + <compiler id="msvc" name="msvc" extends="base-msvc" if="use-msvc"> + <!-- disable Microsoft Extensions --> + <compilerarg value="/Za"/> + </compiler> + + <compiler id="msvc-with-extensions" extends="base-msvc" if="use-msvc"> + <!-- enable Microsoft Extensions --> + <compilerarg value="/Ze"/> + </compiler> + + <compiler id="icl" extends="base-msvc" name="icl" if="use-icl"> + <!-- disable Microsoft Extensions --> + <compilerarg value="/Za"/> + </compiler> + <compiler id="icl-with-extensions" extends="base-msvc" name="icl" if="use-icl"> + <!-- enable Microsoft Extensions --> + <compilerarg value="/Ze"/> + </compiler> + + <compiler id="ecl" extends="base-msvc" name="ecl" if="use-ecl"> + <!-- disable Microsoft Extensions --> + <compilerarg value="/Za"/> + </compiler> + <compiler id="ecl-with-extensions" extends="base-msvc" name="ecl" if="use-ecl"> + <!-- enable Microsoft Extensions --> + <compilerarg value="/Ze"/> + </compiler> + + <compiler id="bcc" name="bcc" if="use-bcc"> + <!-- target Pentium Pro --> + <compilerarg value="-6"/> + <!-- zero length empty class member functions --> + <compilerarg value="-Vx"/> + <compilerarg value="-Ve"/> + <!-- align on quad word boundaries --> + <compilerarg value="-a8"/> + <!-- byte size enums --> + <compilerarg value="-b-"/> + <compilerarg value="-k"/> + <compilerarg value="-y" if="is-debug"/> + <compilerarg value="-vi"/> + <compilerarg value="-r-" if="is-debug"/> + <!-- maximize speed --> + <compilerarg value="-O2" unless="is-debug"/> + </compiler> + + <compiler id="gcc" name="gcc" if="use-gcc"> + <compilerarg value="-O" unless="is-debug"/> + </compiler> + + + + + <target name="XercesLib" depends="init"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="shared" + objdir="${build.obj.dir}" outfile="${build.dir}/xerces-c" + multithreaded="true" exceptions="true" subsystem="${subsystem}" dependencyDepth="-1"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <compiler refid="icl"/> + <compiler refid="ecl"/> + <!-- speciality compiler for a few files that require MS extensions --> + <compiler extends="msvc-with-extensions"> + <fileset dir="${src.dir}"> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/MsgLoaders/Win32/*.cpp" if="win32_msgloader"/> + <include name="util/NetAccessors/WinSock/*.cpp" if="netaccessor_winsock"/> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/Transcoders/Win32/*.cpp" if="win32_transcoder"/> + </fileset> + </compiler> + <compiler extends="icl-with-extensions"> + <fileset dir="${src.dir}"> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/MsgLoaders/Win32/*.cpp" if="win32_msgloader"/> + <include name="util/NetAccessors/WinSock/*.cpp" if="netaccessor_winsock"/> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/Transcoders/Win32/*.cpp" if="win32_transcoder"/> + </fileset> + </compiler> + <compiler extends="ecl-with-extensions"> + <fileset dir="${src.dir}"> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/MsgLoaders/Win32/*.cpp" if="win32_msgloader"/> + <include name="util/NetAccessors/WinSock/*.cpp" if="netaccessor_winsock"/> + <include name="util/Platforms/Win32/*.cpp"/> + <include name="util/Transcoders/Win32/*.cpp" if="win32_transcoder"/> + </fileset> + </compiler> + <compiler name="msrc" if="use-msvc"> + <compilerarg value="/l 0x409"/> + <fileset dir="${src.dir}" includes="util/Platforms/Win32/Version.rc"/> + </compiler> + <compiler name="brc" if="use-bcc" inherit="false"> + <!-- version.rc includes afxres.h, I don't know why --> + <includepath location="c:\msdev6\vc98\include"/> + <includepath location="c:\msdev6\vc98\mfc\include"/> + <fileset dir="${src.dir}" includes="util/Platforms/Win32/Version.rc"/> + </compiler> + <compiler if="linux" extends="gcc"> + <defineset> + <define name="_GNU_SOURCE"/> + <define name="__USE_GNU"/> + </defineset> + <fileset dir="${src.dir}" includes="util/Platforms/Linux/*.cpp"/> + </compiler> + <linker name="gcc" if="use-gcc"> + <syslibset libs="kernel32,user32,advapi32,ws2_32" if="windows"/> + <syslibset libs="pthread" if="pthreads"/> + </linker> + <!-- base is 0x12000000 --> + <linker name="msvc" base="301989888" if="use-msvc"> + <syslibset libs="kernel32,user32,advapi32,ws2_32"/> + </linker> + <linker name="icl" base="301989888" if="use-icl"> + <syslibset libs="kernel32,user32,advapi32,ws2_32"/> + </linker> + <linker name="bcc" if="use-bcc"> + <syslibset libs="import32,cw32,ws2_32"/> + </linker> + <fileset dir="${src.dir}"> + <include name="dom/*.cpp"/> + <include name="framework/*.cpp"/> + <include name="idom/*.cpp"/> + <include name="internal/*.cpp"/> + <include name="parsers/*.cpp"/> + <include name="sax/*.cpp"/> + <include name="sax2/*.cpp"/> + <include name="util/*.cpp"/> + <include name="validators/*.cpp"/> + <include name="validators/common/*.cpp"/> + <include name="validators/datatype/*.cpp"/> + <include name="validators/DTD/*.cpp"/> + <include name="validators/schema/*.cpp"/> + <include name="validators/schema/identity/*.cpp"/> + <include name="util/regx/*.cpp"/> + <!-- if using MS Visual C, + these must be compiled with MS Extension enabled + otherwise they can compile with everything else --> + <include name="util/Platforms/Win32/*.cpp" if="windows" unless="use-msvc"/> + <include name="util/MsgLoaders/Win32/*.cpp" if="win32_msgloader" unless="use-msvc"/> + <include name="util/MsgLoaders/InMemory/*.cpp" if="inmem_messageloader"/> + <include name="util/NetAccessors/WinSock/*.cpp" if="netaccessor_winsock" unless="use-msvc"/> + <include name="util/NetAccessors/Socket/*.cpp" if="netaccessor_socket"/> + <include name="util/Transcoders/Win32/*.cpp" if="win32_transcoder" unless="use-msvc"/> + <include name="util/Transcoders/Iconv/*.cpp" if="iconv_transcoder"/> + <include name="util/Transcoders/ICU/*.cpp" if="icu_transcoder"/> + <include name="util/Compilers/GCCDefs.cpp" if="use-gcc"/> + </fileset> + <!-- parent of the source directory --> + <includepath location="${include.dir}"/> + <defineset> + <define name="PROJ_SAX2"/> + <define name="PROJ_XMLPARSER"/> + <define name="PROJ_XMLUTIL"/> + <define name="PROJ_PARSERS"/> + <define name="PROJ_SAX4C"/> + <define name="PROJ_DOM"/> + <define name="PROJ_VALIDATORS"/> + <define name="XML_SINGLEDLL"/> + <define name="WIN32" if="windows"/> + <define name="_WINDOWS" if="windows"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="XML_USE_WIN32_TRANSCODER" if="win32_transcoder"/> + <define name="XML_USE_WIN32_MSGLOADER" if="win32_msgloader"/> + <define name="XML_USE_NETACCESSOR_WINSOCK" if="netaccessor_winsock"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + <define name="XML_USE_NATIVE_TRANSCODER" if="native_transcoder"/> + <define name="XML_USE_ICU_TRANSCODER" if="icu_transcoder"/> + <define name="XML_USE_INMEM_MESSAGELOADER" if="inmem_messageloader"/> + <define name="XML_USE_PTHREADS" if="pthreads"/> + <define name="XML_USE_NETACCESSOR_SOCKET" if="netaccessor_socket"/> + </defineset> + </cc> + + </target> + + <target name="CreateDOMDocument" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/CreateDOMDocument" + multithreaded="true" exceptions="true"> + <compiler extends="gcc"> + <compilerarg value="-fpic"/> + <compilerarg value="-w"/> + <compilerarg value="-O"/> + </compiler> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="CreateDOMDocument/CreateDOMDocument.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="DOMCount" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMCount" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="DOMCount/DOMCount.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="DOMIDTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMIDTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="DOM/DOMIDTest/DOMIDTest.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + + <target name="DOMMemTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMMemTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="DOM/DOMMemTest/DOMMemTest.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="DOMPrint" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMPrint" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="DOMPrint/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="DOMTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="DOM/DOMTest/*.cpp"/> + <fileset dir="${build.dir}" includes="xerces-c.lib"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + + <target name="DOMTraversalTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/DOMTraversalTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="DOM/Traversal/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="EncodingTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/EncodingTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="EncodingTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="EnumVal" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/EnumVal" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="EnumVal/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="IDOMCount" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/IDOMCount" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="IDOMCount/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + + </target> + + + <target name="IDOMMemTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/IDOMMemTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="IDom/IDOMMemTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="IDOMPrint" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/IDOMPrint" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="IDOMPrint/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="IDOMTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/IDOMTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="IDom/IDOMTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="InitTermTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/InitTermTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="InitTermTest/*.cpp"/> + <fileset dir="${build.dir}" includes="xerces-c.lib"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="IRangeTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/IRangeTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="IDom/IRangeTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="ITraversal" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/ITraversal" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="IDom/ITraversal/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="MemParse" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/MemParse" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="MemParse/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="PParse" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/PParse" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="PParse/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="RangeTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/RangeTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="DOM/RangeTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="Redirect" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/Redirect" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="Redirect/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="SAX2Count" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/SAX2Count" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="SAX2Count/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="SAXCount" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/SAXCount" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="SAXCount/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="SAXPrint" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/SAXPrint" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="SAXPrint/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="SEnumVal" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/SEnumVal" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="SEnumVal/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="StdInParse" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/StdInParse" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${samples.dir}" includes="StdInParse/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + + <target name="ThreadTest" depends="XercesLib"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="executable" + objdir="${build.obj.dir}" outfile="${build.dir}/ThreadTest" + multithreaded="true" exceptions="true"> + <compiler refid="gcc"/> + <compiler refid="msvc-with-extensions"/> + <compiler refid="bcc"/> + <linker name="gcc" if="use-gcc"/> + <linker name="msvc" if="use-msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${tests.dir}" includes="ThreadTest/*.cpp"/> + <includepath location="${include.dir}"/> + <defineset> + <define name="CONSOLE"/> + <define name="PLATFORM_WIN32" if="windows"/> + <define name="LINUX" if="linux"/> + <define name="_REENTRANT" if="linux"/> + </defineset> + <libset dir="${build.dir}" libs="xerces-c"/> + <syslibset libs="c,stdc++" if="linux"/> + </cc> + </target> + + <target name="XercesCOM_tlb" depends="init" if="windows"> + <mkdir dir="${xml4com.dir}"/> + <cc debug="${debug}" objdir="${xml4com.dir}" name="midl"> + <!-- output generated header file to use in next step --> + <compilerarg value="/h"/> + <compilerarg value="xml4com.h"/> + <compilerarg value="/iid"/> + <compilerarg value="xml4com_i.c"/> + <fileset dir="${src.dir}" includes="com/xml4com.idl"/> + <includepath location="${src.dir}/com"/> + </cc> + </target> + + <target name="XercesCOM" depends="XercesCOM_tlb,XercesLib" if="windows"> + <mkdir dir="${build.obj.dir}"/> + <mkdir dir="${build.dir}"/> + <cc debug="${debug}" link="shared" + objdir="${build.obj.dir}" outfile="${build.dir}/xml4com" + multithreaded="true" exceptions="true"> + <compiler refid="msvc-with-extensions"/> + <compiler refid="bcc"/> + <compiler name="msrc" if="use-msvc"> + <compilerarg value="/l 0x409"/> + <fileset dir="${src.dir}" includes="com/*.rc"/> + </compiler> + <precompile prototype="${src.dir}/com/StdAfx.cpp"> + <except> + <fileset dir="${src.dir}" includes="com/XMLDOM*.cpp"/> + </except> + </precompile> + <linker name="msvc"/> + <linker name="bcc" if="use-bcc"/> + <fileset dir="${src.dir}" includes="com/*.cpp"/> + <fileset dir="${build.dir}" includes="xerces-c.lib"/> + <includepath location="${xml4com.dir}"/> + <includepath location="${include.dir}"/> + <includepath location="."/> + <defineset> + <define name="PLATFORM_WIN32" if="windows"/> + </defineset> + <syslibset libs="wininet,shlwapi"/> + </cc> + </target> + + + <target name="Samples" depends="CreateDOMDocument,DOMCount, + DOMPrint, + EnumVal, + IDOMCount, + IDOMPrint, + MemParse, + PParse, + Redirect,SAX2Count, + SAXCount,SAXPrint, + SEnumVal,StdInParse"/> + + <target name="Tests" depends="DOMIDTest,DOMMemTest, + DOMTest,DOMTraversalTest, + EncodingTest,IDOMMemTest, + IDOMTest,ITraversal, + InitTermTest,IRangeTest, + RangeTest,ThreadTest"/> + + <target name="XercesAll" depends="Samples,Tests,XercesCOM"/> + + <target name="main" + depends="XercesAll" /> + +</project> diff --git a/samples/xpcom.ant b/samples/xpcom.ant new file mode 100644 index 0000000..b1da4b2 --- /dev/null +++ b/samples/xpcom.ant @@ -0,0 +1,120 @@ +<?xml version="1.0"?> +<!-- + +Copyright 2004 The Ant-Contrib project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + +Builds Mozilla xpcom/sample + +--> +<project name="xpcom" default="test-all"> + +<property name="base.dir" value="."/> +<property name="debug" value="true"/> +<property name="compiler" value="gcc"/> +<property name="build.dir" location="build"/> +<property name="obj.dir" location="${build.dir}/obj"/> +<!-- specify api="unix" or api="win32" override platform default --> +<property name="api" value="default"/> +<property name="mozinclude.dir" location="${base.dir}/dist/include"/> +<property name="mozlib.dir" location="${base.dir}/dist/lib"/> + +<taskdef resource="cpptasks.tasks"/> +<typedef resource="cpptasks.types"/> + +<target name="usage"> + <echo message="Builds Mozilla xpcom/sample."/> + <echo message="Usage:"/> + <echo message="ant -f xpcom.ant -Dbase.dir=/home/someuser/mozilla"/> + <echo message=" -Dcompiler=[gcc | msvc | icc | bcc ...]"/> +</target> + +<target name="init"> + <mkdir dir="${build.dir}"/> + <property name="obj.dir" value="${build.dir}/obj"/> + <mkdir dir="${obj.dir}"/> + <condition property="is-gcc"> + <or> + <equals arg1="${compiler}" arg2="gcc"/> + <equals arg1="${compiler}" arg2="g++"/> + </or> + </condition> + <condition property="is-msvc"> + <or> + <equals arg1="${compiler}" arg2="msvc"/> + </or> + </condition> + <condition property="is-windows"><os family="windows"/></condition> + <condition property="is-win32"> + <or> + <equals arg1="${api}" arg2="win32"/> + <and> + <equals arg1="${api}" arg2="default"/> + <isset property="is-windows"/> + </and> + </or> + </condition> + <property environment="env"/> + <!-- in case not set in environment, use an insignificant value --> + <property name="env.LD_LIBRARY_PATH" value="."/> +</target> + +<target name="clean"> + <delete dir="${build.dir}"/> +</target> + + +<target name="build-xpcomsample" depends="init"> + <mkdir dir="${obj.dir}"/> + + <!-- compile .idl files, places generated files on obj.dir --> + <cc objdir="${obj.dir}"> + <!-- runs xpidl twice to create .h and .xpt files --> + <compiler name="xpidl" inherit="false"> + <includepath path="${base.dir}/dist/idl"/> + <fileset dir="${base.dir}/xpcom/sample" includes="*.idl"/> + </compiler> + </cc> + <cc objdir="${obj.dir}" + outtype="shared" + outfile="${build.dir}/xpcomsample" + rtti="false" + exceptions="false"> + <fileset dir="${base.dir}/xpcom/sample" includes="*.cpp"/> + <defineset define="XPCOM_GLUE,HAVE_DEPENDENT_LIBS,MOZILLA_CLIENT"/> + <defineset> + <define name="OSTYPE" value="Linux2.4"/> + <define name="OSARCH" value="Linux"/> + </defineset> + <defineset if="is-debug" define="DEBUG, _DEBUG, TRACING"/> + <includepath path="${obj.dir}"/> + <includepath path="${base.dir}/xpcom/sample"/> + <includepath path="${mozinclude.dir};${mozinclude.dir}/string:${mozinclude.dir}/xpcom;${mozinclude.dir}/nspr"/> + <compilerarg value="-fshort-wchar"/> + <compilerarg value="-pthread"/> + <libset dir="${mozlib.dir}" libs="xpcomglue, plds4, plc4, nspr4"/> + <syslibset libs="pthread, dl, m"/> + </cc> +</target> + + + +<target name="all" depends="build-xpcomsample"/> + +<target name="test-all" depends="build-xpcomsample"/> + +</project> diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java index 2e6adab..ab40e95 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/CCTask.java @@ -16,10 +16,15 @@ */ package net.sf.antcontrib.cpptasks; import java.io.File; +import java.io.FileFilter; import java.io.IOException; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashSet; import java.util.Hashtable; -import java.util.*; +import java.util.List; +import java.util.Set; +import java.util.Vector; import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration; import net.sf.antcontrib.cpptasks.compiler.LinkType; @@ -120,6 +125,12 @@ import org.apache.tools.ant.types.Environment; * @author Curt Arnold */ public class CCTask extends Task { + + + + + + private static class SystemLibraryCollector implements FileVisitor { private Hashtable libraries; private Linker linker; @@ -180,6 +191,8 @@ public class CCTask extends Task { } return targetsByConfig; } + // FREEHEP + private int maxCores = 0; /** The compiler definitions. */ private Vector _compilers = new Vector(); /** The output file type. */ @@ -706,6 +719,11 @@ public class CCTask extends Task { } } } + // BEGINFREEHEP + Progress progress = new Progress(getObjdir(), rebuildCount); + progress.start(); + // ENDFREEHEP + for (int i = 0; i < targetVectors.length; i++) { // // get the targets for this configuration @@ -719,6 +737,100 @@ public class CCTask extends Task { // // prepare the list of source files // + + // BEGINFREEHEP + int noOfCores = Runtime.getRuntime().availableProcessors(); + log("Found "+noOfCores+" processors available"); + if (maxCores > 0) { + noOfCores = Math.min(maxCores, noOfCores); + log("Limited processors to "+noOfCores); + } + int noOfFiles = targetsForConfig.size(); + if (noOfFiles < noOfCores) { + noOfCores = noOfFiles; + log("Limited used processors to "+noOfCores); + } + + Set[] sourceFiles = new HashSet[noOfCores]; + for (int j = 0; j < sourceFiles.length; j++) { + sourceFiles[j] = new HashSet(noOfFiles + / sourceFiles.length); + } + Enumeration targetsEnum = targetsForConfig.elements(); + index = 0; + while (targetsEnum.hasMoreElements()) { + TargetInfo targetInfo = ((TargetInfo) targetsEnum + .nextElement()); + sourceFiles[index++].add(targetInfo.getSources()[0] + .toString()); + index %= sourceFiles.length; + } + + // setup cores/cpus + Core[] cores = new Core[noOfCores]; + for (int j = 0; j < cores.length; j++) { + cores[j] = new Core(this, j, config, _objDir, sourceFiles[j], + relentless, monitor); + log("\nStarting Core " + j + " with " + + sourceFiles[j].size() + " source files..."); + } + + // starting cores + for (int j = 0; j < cores.length; j++) { + cores[j].start(); + } + + // checking cores + boolean alive = false; + try { + do { + alive = false; + for (int j = 0; j < cores.length; j++) { + if (cores[j] != null) { + if (cores[j].isAlive()) { + alive = true; + } else { + Exception exception = cores[j].getException(); + if (exception != null) { + if ((compileException == null) && (exception instanceof BuildException)) { + compileException = (BuildException)exception; + } else { + log(cores[j].getName()+" "+exception+" ", Project.MSG_ERR); + } + if (!relentless) { + cores[j] = null; + alive = false; + break; + } + } + cores[j] = null; + } + } + } + if (alive) { + // wait for a maximum of 5 seconds or #files*2 seconds. + Thread.sleep(Math.min(5000, sourceFiles[0].size()*2000)); + } + } while (alive); + } catch (InterruptedException e) { + break; + } + + // killing leftovers + for (int j = 0; j < cores.length; j++) { + if (cores[j] != null) { + cores[j].interrupt(); + log(cores[j].getName()+" interrupted "); + } + } + + if ((!relentless) && (compileException != null)) { + break; + } + // ENDFREEHEP + + + /* OLD CODE String[] sourceFiles = new String[targetsForConfig.size()]; Enumeration targetsEnum = targetsForConfig.elements(); index = 0; @@ -738,7 +850,17 @@ public class CCTask extends Task { if (!relentless) break; } + */ } + + // BEGINFREEHEP + progress.exit(); + try { + progress.join(); + } catch (InterruptedException ex) { + } + // ENDFREEHEP + // // save the details of the object file compilation // settings to disk for dependency analysis @@ -796,9 +918,12 @@ public class CCTask extends Task { // File output = linkTarget.getOutput(); if (linkTarget.getRebuild()) { - log("Starting link"); LinkerConfiguration linkConfig = (LinkerConfiguration) linkTarget .getConfiguration(); + // BEGINFREEHEP + log("Linking..."); + log("Starting link {" + linkConfig.getIdentifier() + "}"); + // ENDFREEHEP if (failOnError) { linkConfig.link(this, linkTarget); } else { @@ -825,6 +950,101 @@ public class CCTask extends Task { } } } + + // BEGINFREEHEP + class Core extends Thread { + private CCTask task; + private CompilerConfiguration config; + private File objDir; + private Set sourceFiles; + private boolean relentless; + private CCTaskProgressMonitor monitor; + private Exception compileException; + + Core(CCTask task, int coreNo, CompilerConfiguration config, File objDir, + Set set, boolean relentless, + CCTaskProgressMonitor monitor) { + super("Core "+coreNo); + this.task = task; + this.config = config; + this.objDir = objDir; + this.sourceFiles = set; + this.relentless = relentless; + this.monitor = monitor; + } + + public Exception getException() { + return compileException; + } + + public void run() { + super.run(); + try { + String[] sources = new String[sourceFiles.size()]; + sources = (String[]) sourceFiles.toArray(sources); + config.compile(task, objDir, sources, relentless, monitor); + } catch (Exception ex) { + if (compileException == null) { + compileException = ex; + } + } + } + } + + // ENDFREEHEP + + // BEGINFREEHEP + class Progress extends Thread { + + private boolean stop = false; + private File objDir; + private int rebuildCount; + + public Progress(File objDir, int rebuildCount) { + this.objDir = objDir; + this.rebuildCount = rebuildCount; + } + + public void run() { + if (rebuildCount < 10) + return; + try { + FileFilter updatedFiles = new FileFilter() { + private long startTime = System.currentTimeMillis(); + + public boolean accept(File file) { + return file.lastModified() > startTime + && !file.getName().endsWith(".xml"); + } + }; + while (!stop) { + System.err.print("\r" + + objDir.listFiles(updatedFiles).length + " / " + + rebuildCount + " files compiled..."); + System.err.print("\r"); + System.err.flush(); + if (!stop) { + Thread.sleep(5000); + } + } + } catch (InterruptedException e) { + } + System.err + .print("\r "); + System.err.print("\r"); + System.err.flush(); + log(Integer.toString(rebuildCount) + " files were compiled."); + } + + public void exit() { + stop = true; + } + + } + + // ENDFREEHEP + + /** * Gets the dataset. * @@ -1103,6 +1323,18 @@ public class CCTask extends Task { public void setLink(OutputTypeEnum outputType) { linkType.setOutputType(outputType); } + + // BEGINFREEHEP + public void setLinkCPP(boolean linkCPP) { + linkType.setLinkCPP(linkCPP); + } + + public void setLinkFortran(boolean linkFortran) { + linkType.setLinkFortran(linkFortran); + } + + // ENDFREEHEP + /** * Enables or disables generation of multithreaded code * @@ -1372,7 +1604,18 @@ public class CCTask extends Task { public void setWarnings(WarningLevelEnum level) { compilerDef.setWarnings(level); } - + + // BEGINFREEHEP + public void setMaxCores(int maxCores) { + this.maxCores = maxCores; + } + + public int getMaxCores() { + return maxCores; + } + + // ENDFREEHEP + /** * Indicates whether the build will continue * even if there are compilation errors; defaults to true. @@ -1436,5 +1679,4 @@ public class CCTask extends Task { newVersionInfo.setProject(this.getProject()); versionInfos.addElement(newVersionInfo); } - } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java index 0233050..9e00744 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java @@ -21,27 +21,32 @@ import net.sf.antcontrib.cpptasks.borland.BorlandResourceCompiler; import net.sf.antcontrib.cpptasks.compaq.CompaqVisualFortranCompiler; import net.sf.antcontrib.cpptasks.compiler.Compiler; import net.sf.antcontrib.cpptasks.devstudio.DevStudioCCompiler; -import net.sf.antcontrib.cpptasks.devstudio.DevStudio2005CCompiler; import net.sf.antcontrib.cpptasks.devstudio.DevStudioMIDLCompiler; +import net.sf.antcontrib.cpptasks.devstudio.DevStudio2005CCompiler; import net.sf.antcontrib.cpptasks.devstudio.DevStudioResourceCompiler; import net.sf.antcontrib.cpptasks.gcc.GccCCompiler; import net.sf.antcontrib.cpptasks.gcc.WindresResourceCompiler; import net.sf.antcontrib.cpptasks.hp.aCCCompiler; import net.sf.antcontrib.cpptasks.ibm.VisualAgeCCompiler; import net.sf.antcontrib.cpptasks.intel.IntelLinux32CCompiler; +import net.sf.antcontrib.cpptasks.intel.IntelLinux32Compiler; import net.sf.antcontrib.cpptasks.intel.IntelLinux64CCompiler; +import net.sf.antcontrib.cpptasks.intel.IntelLinux64Compiler; +import net.sf.antcontrib.cpptasks.intel.IntelLinuxFortranCompiler; import net.sf.antcontrib.cpptasks.intel.IntelWin32CCompiler; import net.sf.antcontrib.cpptasks.intel.IntelWin64CCompiler; import net.sf.antcontrib.cpptasks.mozilla.XpidlCompiler; +import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomCCompiler; +import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranCompiler; import net.sf.antcontrib.cpptasks.os390.OS390CCompiler; import net.sf.antcontrib.cpptasks.os400.IccCompiler; import net.sf.antcontrib.cpptasks.sun.C89CCompiler; import net.sf.antcontrib.cpptasks.sun.ForteCCCompiler; +import net.sf.antcontrib.cpptasks.sun.ForteCCompiler; +import net.sf.antcontrib.cpptasks.sun.ForteF77Compiler; import net.sf.antcontrib.cpptasks.ti.ClxxCCompiler; import net.sf.antcontrib.cpptasks.trolltech.MetaObjectCompiler; import net.sf.antcontrib.cpptasks.trolltech.UserInterfaceCompiler; -import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomCCompiler; -import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranCompiler; import org.apache.tools.ant.types.EnumeratedAttribute; /** @@ -105,6 +110,10 @@ import org.apache.tools.ant.types.EnumeratedAttribute; * <td>Intel C++ compiler for Linux (IA-32)</td> * </tr> * <tr> + * <td>ifort</td> + * <td>Intel Fortran compiler for Linux (IA-32)</td> + * </tr> + * <tr> * <td>ecc</td> * <td>Intel C++ compiler for Linux (IA-64)</td> * </tr> @@ -191,6 +200,8 @@ public class CompilerEnum extends EnumeratedAttribute { new ProcessorEnumValue("g++", GccCCompiler.getGppInstance()), new ProcessorEnumValue("c++", GccCCompiler.getCppInstance()), new ProcessorEnumValue("g77", GccCCompiler.getG77Instance()), +// FREEHEP + new ProcessorEnumValue("gfortran", GccCCompiler.getGFortranInstance()), new ProcessorEnumValue("msvc", DevStudioCCompiler.getInstance()), new ProcessorEnumValue("msvc8", DevStudio2005CCompiler.getInstance()), new ProcessorEnumValue("bcc", BorlandCCompiler.getInstance()), @@ -202,9 +213,18 @@ public class CompilerEnum extends EnumeratedAttribute { new ProcessorEnumValue("midl", DevStudioMIDLCompiler.getInstance()), new ProcessorEnumValue("icl", IntelWin32CCompiler.getInstance()), new ProcessorEnumValue("ecl", IntelWin64CCompiler.getInstance()), +// BEGINFREEHEP new ProcessorEnumValue("icc", IntelLinux32CCompiler.getInstance()), new ProcessorEnumValue("ecc", IntelLinux64CCompiler.getInstance()), + new ProcessorEnumValue("icpc", IntelLinux32Compiler.getInstance()), + new ProcessorEnumValue("ecpc", IntelLinux64Compiler.getInstance()), + new ProcessorEnumValue("ifort", IntelLinuxFortranCompiler.getInstance()), +// ENDFREEHEP new ProcessorEnumValue("CC", ForteCCCompiler.getInstance()), +// BEGINFREEHEP + new ProcessorEnumValue("suncc", ForteCCompiler.getInstance()), + new ProcessorEnumValue("sunf77", ForteF77Compiler.getInstance()), +// ENDFREEHEP new ProcessorEnumValue("aCC", aCCCompiler.getInstance()), new ProcessorEnumValue("os390", OS390CCompiler.getInstance()), new ProcessorEnumValue("os400", IccCompiler.getInstance()), diff --git a/src/main/java/net/sf/antcontrib/cpptasks/DependencyInfo.java b/src/main/java/net/sf/antcontrib/cpptasks/DependencyInfo.java index a04105f..d14966e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/DependencyInfo.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/DependencyInfo.java @@ -26,12 +26,15 @@ public final class DependencyInfo { * Not persisted since almost any change could invalidate it. Initialized * to long.MIN_VALUE on construction. */ - private long compositeLastModified; +// FREEHEP +// private long compositeLastModified; private/* final */String includePathIdentifier; private/* final */String[] includes; private/* final */String source; private/* final */long sourceLastModified; private/* final */String[] sysIncludes; +// FREEHEP + private Object tag = null; public DependencyInfo(String includePathIdentifier, String source, long sourceLastModified, Vector includes, Vector sysIncludes) { if (source == null) { @@ -44,25 +47,34 @@ public final class DependencyInfo { this.sourceLastModified = sourceLastModified; this.includePathIdentifier = includePathIdentifier; this.includes = new String[includes.size()]; - if (includes.size() == 0) { - compositeLastModified = sourceLastModified; - } else { - includes.copyInto(this.includes); - compositeLastModified = Long.MIN_VALUE; - } +// BEGINFREEHEP +// if (includes.size() == 0) { +// compositeLastModified = sourceLastModified; +// } else { +// includes.copyInto(this.includes); +// compositeLastModified = Long.MIN_VALUE; +// } +// ENDFREEHEP this.sysIncludes = new String[sysIncludes.size()]; +// FREEHEP + includes.copyInto(this.includes); sysIncludes.copyInto(this.sysIncludes); } /** * Returns the latest modification date of the source or anything that it * depends on. * - * @return the composite lastModified time, returns Long.MIN_VALUE if not + * @returns the composite lastModified time, returns Long.MIN_VALUE if not * set */ - public long getCompositeLastModified() { - return compositeLastModified; +// BEGINFREEHEP +// public long getCompositeLastModified() { +// return compositeLastModified; +// } + public void setTag(Object t) { + tag = t; } +// ENDFREEHEP public String getIncludePathIdentifier() { return includePathIdentifier; } @@ -80,7 +92,19 @@ public final class DependencyInfo { String[] sysIncludesClone = (String[]) sysIncludes.clone(); return sysIncludesClone; } - public void setCompositeLastModified(long lastMod) { - compositeLastModified = lastMod; +// BEGINFREEHEP + /** + * Returns true, if dependency info is tagged with object t. + * + * @param t object to compare with + * + * @return boolean, true, if tagged with t, otherwise false + */ + public boolean hasTag(Object t) { + return tag == t; } +// public void setCompositeLastModified(long lastMod) { +// compositeLastModified = lastMod; +// } +// ENDFREEHEP } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/DependencyTable.java b/src/main/java/net/sf/antcontrib/cpptasks/DependencyTable.java index 48a7278..aaa3881 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/DependencyTable.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/DependencyTable.java @@ -178,29 +178,35 @@ public final class DependencyTable { return !noNeedToRebuild; } public boolean preview(DependencyInfo parent, DependencyInfo[] children) { - int withCompositeTimes = 0; - long parentCompositeLastModified = parent.getSourceLastModified(); - for (int i = 0; i < children.length; i++) { +// BEGINFREEHEP +// int withCompositeTimes = 0; +// long parentCompositeLastModified = parent.getSourceLastModified(); +// ENDFREEHEP + for (int i = 0; i < children.length; i++) { if (children[i] != null) { // // expedient way to determine if a child forces us to // rebuild // visit(children[i]); - long childCompositeLastModified = children[i] - .getCompositeLastModified(); - if (childCompositeLastModified != Long.MIN_VALUE) { - withCompositeTimes++; - if (childCompositeLastModified > parentCompositeLastModified) { - parentCompositeLastModified = childCompositeLastModified; - } - } +// BEGINFREEHEP +// long childCompositeLastModified = children[i] +// .getCompositeLastModified(); +// if (childCompositeLastModified != Long.MIN_VALUE) { +// withCompositeTimes++; +// if (childCompositeLastModified > parentCompositeLastModified) { +// parentCompositeLastModified = childCompositeLastModified; +// } +// } +// ENDFREEHEP } } - if (withCompositeTimes == children.length) { - parent.setCompositeLastModified(parentCompositeLastModified); - } - // +// BEGINFREEHEP +// if (withCompositeTimes == children.length) { +// parent.setCompositeLastModified(parentCompositeLastModified); +// } +// ENDFREEHEP + // // may have been changed by an earlier call to visit() // return noNeedToRebuild; @@ -212,8 +218,9 @@ public final class DependencyTable { } public boolean visit(DependencyInfo dependInfo) { if (noNeedToRebuild) { - if (CUtil.isSignificantlyAfter(dependInfo.getSourceLastModified(), outputLastModified) - || CUtil.isSignificantlyAfter(dependInfo.getCompositeLastModified(), outputLastModified)) { + if (CUtil.isSignificantlyAfter(dependInfo.getSourceLastModified(), outputLastModified)) { +//FREEHEP +// || CUtil.isSignificantlyAfter(dependInfo.getCompositeLastModified(), outputLastModified)) { noNeedToRebuild = false; } } @@ -222,8 +229,9 @@ public final class DependencyTable { // it has not yet been determined whether // we need to rebuild and the composite modified time // has not been determined for this file - return noNeedToRebuild - && dependInfo.getCompositeLastModified() == Long.MIN_VALUE; + return noNeedToRebuild; +// FREEHEP +// && dependInfo.getCompositeLastModified() == Long.MIN_VALUE; } } private/* final */File baseDir; @@ -466,35 +474,43 @@ public final class DependencyTable { public void walkDependencies(CCTask task, DependencyInfo dependInfo, CompilerConfiguration compiler, DependencyInfo[] stack, DependencyVisitor visitor) throws BuildException { +// BEGINFREEHEP + if (dependInfo.hasTag(visitor)) { + return; + } + dependInfo.setTag(visitor); +// ENDFREEHEP // // visit this node // if visit returns true then // visit the referenced include and sysInclude dependencies // if (visitor.visit(dependInfo)) { - // - // find first null entry on stack - // - int stackPosition = -1; - for (int i = 0; i < stack.length; i++) { - if (stack[i] == null) { - stackPosition = i; - stack[i] = dependInfo; - break; - } else { - // - // if we have appeared early in the calling history - // then we didn't exceed the criteria - if (stack[i] == dependInfo) { - return; - } - } - } - if (stackPosition == -1) { - visitor.stackExhausted(); - return; - } - // +// BEGINFREEHEP +// // +// // find first null entry on stack +// // +// int stackPosition = -1; +// for (int i = 0; i < stack.length; i++) { +// if (stack[i] == null) { +// stackPosition = i; +// stack[i] = dependInfo; +// break; +// } else { +// // +// // if we have appeared early in the calling history +// // then we didn't exceed the criteria +// if (stack[i] == dependInfo) { +// return; +// } +// } +// } +// if (stackPosition == -1) { +// visitor.stackExhausted(); +// return; +// } +// ENDFREEHEP + // // locate dependency infos // String[] includes = dependInfo.getIncludes(); @@ -544,7 +560,8 @@ public final class DependencyTable { } } } - stack[stackPosition] = null; +// FREEHEP +// stack[stackPosition] = null; } } private void writeDependencyInfo(BufferedWriter writer, StringBuffer buf, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/LinkerDef.java b/src/main/java/net/sf/antcontrib/cpptasks/LinkerDef.java index cde8837..92595bd 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/LinkerDef.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/LinkerDef.java @@ -23,7 +23,6 @@ import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker; import net.sf.antcontrib.cpptasks.compiler.LinkType; import net.sf.antcontrib.cpptasks.compiler.Linker; import net.sf.antcontrib.cpptasks.compiler.Processor; -import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration; import net.sf.antcontrib.cpptasks.gcc.GccLinker; import net.sf.antcontrib.cpptasks.types.FlexLong; import net.sf.antcontrib.cpptasks.types.LibrarySet; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java index df96723..460860a 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java @@ -15,6 +15,8 @@ * limitations under the License. */ package net.sf.antcontrib.cpptasks; +import org.apache.tools.ant.types.EnumeratedAttribute; + import net.sf.antcontrib.cpptasks.arm.ADSLinker; import net.sf.antcontrib.cpptasks.borland.BorlandLinker; import net.sf.antcontrib.cpptasks.compaq.CompaqVisualFortranLinker; @@ -27,16 +29,17 @@ import net.sf.antcontrib.cpptasks.gcc.LdLinker; import net.sf.antcontrib.cpptasks.hp.aCCLinker; import net.sf.antcontrib.cpptasks.ibm.VisualAgeLinker; import net.sf.antcontrib.cpptasks.intel.IntelLinux32Linker; +import net.sf.antcontrib.cpptasks.intel.IntelLinux32CLinker; import net.sf.antcontrib.cpptasks.intel.IntelLinux64Linker; +import net.sf.antcontrib.cpptasks.intel.IntelLinux64CLinker; import net.sf.antcontrib.cpptasks.intel.IntelWin32Linker; +import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomCLinker; +import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranLinker; import net.sf.antcontrib.cpptasks.os390.OS390Linker; import net.sf.antcontrib.cpptasks.os400.IccLinker; import net.sf.antcontrib.cpptasks.sun.C89Linker; import net.sf.antcontrib.cpptasks.sun.ForteCCLinker; import net.sf.antcontrib.cpptasks.ti.ClxxLinker; -import org.apache.tools.ant.types.EnumeratedAttribute; -import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomCLinker; -import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranLinker; /** * Enumeration of supported linkers @@ -56,8 +59,12 @@ public class LinkerEnum extends EnumeratedAttribute { .getInstance()), new ProcessorEnumValue("icl", IntelWin32Linker.getInstance()), new ProcessorEnumValue("ecl", IntelWin32Linker.getInstance()), - new ProcessorEnumValue("icc", IntelLinux32Linker.getInstance()), - new ProcessorEnumValue("ecc", IntelLinux64Linker.getInstance()), +// BEGINFREEHEP + new ProcessorEnumValue("icc", IntelLinux32CLinker.getInstance()), + new ProcessorEnumValue("ecc", IntelLinux64CLinker.getInstance()), + new ProcessorEnumValue("icpc", IntelLinux32Linker.getInstance()), + new ProcessorEnumValue("ecpc", IntelLinux64Linker.getInstance()), +// ENDFREEHEP new ProcessorEnumValue("CC", ForteCCLinker.getInstance()), new ProcessorEnumValue("aCC", aCCLinker.getInstance()), new ProcessorEnumValue("os390", OS390Linker.getInstance()), diff --git a/src/main/java/net/sf/antcontrib/cpptasks/OutputTypeEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/OutputTypeEnum.java index 873a99c..77092fa 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/OutputTypeEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/OutputTypeEnum.java @@ -42,7 +42,9 @@ public class OutputTypeEnum extends EnumeratedAttribute { return new String[]{"executable", // executable program "plugin", // plugin module "shared", // dynamically linkable module - "static" // convenience library + "static", +// FREEHEP + "jni" // jni module }; } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/SubsystemEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/SubsystemEnum.java index 19dd207..24dac1b 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/SubsystemEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/SubsystemEnum.java @@ -26,7 +26,8 @@ public final class SubsystemEnum extends EnumeratedAttribute { private final static String[] values = new String[]{"gui", "console", "other"}; public SubsystemEnum() { - setValue("gui"); +// FREEHEP changed from gui into console + setValue("console"); } public String[] getValues() { return (String[]) values.clone(); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/TargetHistoryTable.java b/src/main/java/net/sf/antcontrib/cpptasks/TargetHistoryTable.java index bdab94c..1a6eda1 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/TargetHistoryTable.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/TargetHistoryTable.java @@ -323,7 +323,8 @@ public final class TargetHistoryTable { markForRebuild((TargetInfo) targetInfoEnum.nextElement()); } } - public void markForRebuild(TargetInfo targetInfo) { + // FREEHEP added synchronized + public synchronized void markForRebuild(TargetInfo targetInfo) { // // if it must already be rebuilt, no need to check further // @@ -382,7 +383,8 @@ public final class TargetHistoryTable { } } } - private void update(String configId, String outputName, String[] sources) { +// FREEHEP added synchronized + private synchronized void update(String configId, String outputName, String[] sources) { File outputFile = new File(outputDir, outputName); // // if output file doesn't exist or predates the start of the @@ -407,7 +409,8 @@ public final class TargetHistoryTable { history.put(outputName, newHistory); } } - public void update(TargetInfo linkTarget) { + // FREEHEP added synchronized + public synchronized void update(TargetInfo linkTarget) { File outputFile = linkTarget.getOutput(); String outputName = outputFile.getName(); // diff --git a/src/main/java/net/sf/antcontrib/cpptasks/VersionInfo.java b/src/main/java/net/sf/antcontrib/cpptasks/VersionInfo.java index 92cfeb0..4ddcd14 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/VersionInfo.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/VersionInfo.java @@ -212,7 +212,7 @@ public final class VersionInfo extends DataType { /** * Returns a VersionInfo that reflects any inherited version information. * @return merged version information. - */ +\ */ public VersionInfo merge() { if (isReference()) { VersionInfo refVersion = (VersionInfo) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/antlib.xml b/src/main/java/net/sf/antcontrib/cpptasks/antlib.xml new file mode 100644 index 0000000..5f8af42 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/antlib.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> + <!-- + * + * Copyright 2004 The Ant-Contrib project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + <antlib> + <taskdef resource="cpptasks.tasks" /> + <typedef resource="cpptasks.types" /> + </antlib> +
\ No newline at end of file diff --git a/src/main/java/net/sf/antcontrib/cpptasks/apple/PropertyListSerialization.java b/src/main/java/net/sf/antcontrib/cpptasks/apple/PropertyListSerialization.java index c3a6807..6a3c410 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/apple/PropertyListSerialization.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/apple/PropertyListSerialization.java @@ -16,22 +16,22 @@ */ package net.sf.antcontrib.cpptasks.apple; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -import javax.xml.transform.Result; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.io.File; -import java.io.IOException; -import java.io.FileOutputStream; + +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; + +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; /** * Static class that provides methods to serialize diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java index 1595ae1..ca3c3e3 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java @@ -115,14 +115,16 @@ public class CompaqVisualFortranCompiler extends CommandLineFortranCompiler { } protected String getIncludeDirSwitch(String includeDir) { StringBuffer buf = new StringBuffer("/include:"); - if (includeDir.indexOf(' ') >= 0) { - buf.append('"'); +// BEGINFREEHEP quotes seem to confuse the compiler +// if (includeDir.indexOf(' ') >= 0) { +// buf.append('"'); +// buf.append(includeDir); +// buf.append('"'); +// } else { buf.append(includeDir); - buf.append('"'); - } else { - buf.append(includeDir); - } - return buf.toString(); +// } +// ENDFREEHEP + return buf.toString(); } public Linker getLinker(LinkType type) { return CompaqVisualFortranLinker.getInstance().getLinker(type); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java index d0cd77b..045f1ff 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java +++ b/src/main/java/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/main/java/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java index 83c59f7..24a0193 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java @@ -14,7 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +// BEGINFREEHEP, fully replaced with a runner with threads package net.sf.antcontrib.cpptasks.compiler; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -31,92 +33,135 @@ import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; * @author Curt Arnold */ public class CaptureStreamHandler implements ExecuteStreamHandler { - /** - * Runs an executable and captures the output in a String array - * - * @param cmdline - * command line arguments - * @return output of process - */ - public static String[] run(String[] cmdline) { - CaptureStreamHandler handler = new CaptureStreamHandler(); - Execute exec = new Execute(handler); - exec.setCommandline(cmdline); - try { - int status = exec.execute(); - } catch (IOException ex) { - } - return handler.getOutput(); - } - private InputStream errorStream; - private InputStream fromProcess; - public CaptureStreamHandler() { - } - public String[] getOutput() { - String[] output; - if (fromProcess != null) { - Vector lines = new Vector(10); - try { - BufferedReader reader = new BufferedReader( - new InputStreamReader(errorStream)); - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 100; j++) { - String line = reader.readLine(); - if (line == null) { - reader = new BufferedReader(new InputStreamReader( - fromProcess)); - break; - } - lines.addElement(line); - } - } - } catch (IOException ex) { - } - output = new String[lines.size()]; - lines.copyInto(output); - return output; - } - output = new String[0]; - return output; - } - /** - * Install a handler for the error stream of the subprocess. - * - * @param is - * input stream to read from the error stream from the - * subprocess - */ - public void setProcessErrorStream(InputStream is) throws IOException { - errorStream = is; - } - /** - * Install a handler for the input stream of the subprocess. - * - * @param os - * output stream to write to the standard input stream of the - * subprocess - */ - public void setProcessInputStream(OutputStream os) throws IOException { - os.close(); - } - /** - * Install a handler for the output stream of the subprocess. - * - * @param is - * input stream to read from the error stream from the - * subprocess - */ - public void setProcessOutputStream(InputStream is) throws IOException { - fromProcess = is; - } - /** - * Start handling of the streams. - */ - public void start() throws IOException { - } - /** - * Stop handling of the streams - will not be restarted. - */ - public void stop() { - } + + String[] output; + + /** + * Runs an executable and captures the output in a String array + * + * @param cmdline + * command line arguments + * @return output of process + */ + public static String[] run(String[] cmdline) { + CaptureStreamHandler handler = new CaptureStreamHandler(); + Execute exec = new Execute(handler); + exec.setCommandline(cmdline); + try { + int status = exec.execute(); + } catch (IOException ex) { + } + return handler.getOutput() != null ? handler.getOutput() : new String[0]; + } + + private InputStream processErrorStream; + + private InputStream processOutputStream; + + public CaptureStreamHandler() { + } + + public String[] getOutput() { + return output; + } + + static class Copier extends Thread { + InputStream is; + + Vector lines; + + Copier(InputStream is) { + this.is = is; + lines = new Vector(10); + } + + public void run() { + try { + BufferedReader reader = new BufferedReader( new InputStreamReader(is) ); + while ( true ) { + String line = reader.readLine(); + if ( line == null ) + break; + lines.addElement( line ); + } + } catch (IOException e) { + // Ignore + } + } + + public Vector getLines() { + return lines; + } + } + + /** + * Reads concurrently both the process standard output and standard error. + * The standard error - if not empty - is copied to the output string array field. Otherwise + * the standard output is copied to the output field. The output field is set to an empty array + * in case of any error. + */ + public void gatherOutput() { + try { + Copier errorCopier = new Copier(processErrorStream); + Copier outputCopier = new Copier(processOutputStream); + errorCopier.start(); + outputCopier.start(); + errorCopier.join(); + outputCopier.join(); + if (errorCopier.getLines().size() > 0) { + output = new String[errorCopier.getLines().size()]; + errorCopier.getLines().copyInto(output); + } else { + output = new String[outputCopier.getLines().size()]; + outputCopier.getLines().copyInto(output); + } + } catch (Exception e) { + output = new String[0]; + } + } + + /** + * Install a handler for the error stream of the subprocess. + * + * @param is + * input stream to read from the error stream from the subprocess + */ + public void setProcessErrorStream(InputStream is) throws IOException { + processErrorStream = is; + } + + /** + * Install a handler for the input stream of the subprocess. + * + * @param os + * output stream to write to the standard input stream of the + * subprocess + */ + public void setProcessInputStream(OutputStream os) throws IOException { + os.close(); + } + + /** + * Install a handler for the output stream of the subprocess. + * + * @param is + * input stream to read from the error stream from the subprocess + */ + public void setProcessOutputStream(InputStream is) throws IOException { + processOutputStream = is; + } + + /** + * Start handling of the streams. + */ + public void start() throws IOException { + gatherOutput(); + } + + /** + * Stop handling of the streams - will not be restarted. + */ + public void stop() { + } +// ENDFREEHEP } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java index 86594fa..93c3e1e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java @@ -145,9 +145,10 @@ public abstract class CommandLineLinker extends AbstractLinker String[] libnames = null; LibrarySet[] libsets = specificDef.getActiveLibrarySets(defaultProviders,1); - if (libsets.length > 0) { +// FREEHEP call at all times +// if (libsets.length > 0) { libnames = addLibrarySets(task, libsets, preargs, midargs, endargs); - } +// } StringBuffer buf = new StringBuffer(getIdentifier()); for (int i = 0; i < 3; i++) { @@ -336,7 +337,10 @@ public abstract class CommandLineLinker extends AbstractLinker String outputDir, String sourceFile) { String relativePath = CUtil.getRelativePath(outputDir, new File(sourceFile)); - return quoteFilename(buf,relativePath); +// FREEHEP, return the shortest +// return quoteFilename(buf, sourceFile.length() > relativePath.length() ? relativePath : sourceFile); +// FREEHEP trying with always absolute paths, as Windows relPaths have a tighter restriction on length than absPaths... + return quoteFilename(buf, sourceFile); } /** 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 70ee93f..67d7e6b 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/LinkType.java @@ -27,6 +27,12 @@ public class LinkType { private OutputTypeEnum outputType = new OutputTypeEnum(); private boolean staticRuntime = false; private SubsystemEnum subsystem = new SubsystemEnum(); + +// BEGINFREEHEP + private boolean linkCPP = true; + private boolean linkFortran = false; +// ENDFREEHEP + /** * Constructor * @@ -44,6 +50,11 @@ public class LinkType { String value = outputType.getValue(); return value.equals("executable"); } + + public boolean isJNIModule() { + String value = outputType.getValue(); + return value.equals("jni"); + } /** * Gets whether the link should produce a plugin module. * @@ -60,7 +71,8 @@ public class LinkType { */ public boolean isSharedLibrary() { String value = outputType.getValue(); - return value.equals("shared") || value.equals("plugin"); +// FREEHEP + return value.equals("shared") || value.equals("plugin") || value.equals("jni"); } /** * Gets whether the link should produce a static library. @@ -147,4 +159,23 @@ public class LinkType { public String getSubsystem() { return subsystem.getValue(); } + +// BEGINFREEHEP + public void setLinkCPP(boolean linkCPP) { + this.linkCPP = linkCPP; + } + + public boolean linkCPP() { + return linkCPP; + } + + public void setLinkFortran(boolean linkFortran) { + this.linkFortran = linkFortran; + } + + public boolean linkFortran() { + return linkFortran; + } +// ENDFREEHEP + } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java index 1281046..d0b8b95 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java @@ -45,6 +45,7 @@ public final class DevStudioCCompiler extends DevStudioCompatibleCCompiler { return DevStudioLinker.getInstance().getLinker(type); } public int getMaximumCommandLength() { - return 32767; +// FREEHEP stay on safe side + return 32000; // 32767; } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java index 5f37855..cc4493d 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java @@ -108,6 +108,7 @@ public abstract class DevStudioCompatibleCCompiler String lastInclude) { String[] additionalArgs = new String[]{ "/Fp" + CUtil.getBasename(prototype) + ".pch", "/Yc"}; + // FREEHEP FIXME we may need /Yd here, but only in debug mode, how do we find out? return new CommandLineCompilerConfiguration(baseConfig, additionalArgs, null, true); } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java index 985dfcf..de006d8 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java @@ -61,7 +61,8 @@ public abstract class DevStudioCompatibleLibrarian extends CommandLineLinker { return new String[0]; } public int getMaximumCommandLength() { - return 32767; +// FREEHEP stay on the safe side + return 32000; // 32767; } public String[] getOutputFileSwitch(String outFile) { StringBuffer buf = new StringBuffer("/OUT:"); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java index 80d2aac..987948b 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java @@ -117,7 +117,8 @@ public abstract class DevStudioCompatibleLinker extends CommandLineLinker { return patterns; } public int getMaximumCommandLength() { - return 32767; +// FREEHEP stay on the safe side + return 32000; // 32767; } public String[] getOutputFileSwitch(String outputFile) { return new String[]{"/OUT:" + outputFile}; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java index fa2e414..effd883 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java @@ -94,7 +94,8 @@ public final class DevStudioMIDLCompiler extends CommandLineCompiler { return DevStudioLinker.getInstance().getLinker(type); } public int getMaximumCommandLength() { - return 32767; +// FREEHEP stay on the safe side + return 32000; // 32767; } protected int getMaximumInputFilesPerCommand() { return 1; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java index 6f8360b..3d9b83e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java @@ -99,7 +99,8 @@ public final class DevStudioResourceCompiler extends CommandLineCompiler { return DevStudioLinker.getInstance().getLinker(type); } public int getMaximumCommandLength() { - return 32767; +// FREEHEP stay on the safe side + return 32000; // 32767; } protected int getMaximumInputFilesPerCommand() { return 1; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java index 75ddcc7..f1eb2d7 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java @@ -55,11 +55,17 @@ public abstract class AbstractLdLinker extends CommandLineLinker { args.addElement("-g"); } if (isDarwin()) { - if (linkType.isPluginModule()) { + if (linkType.isPluginModule()) { + args.addElement("-bundle"); +// BEGINFREEHEP + } else if (linkType.isJNIModule()) { + args.addElement("-dynamic"); args.addElement("-bundle"); +// ENDFREEHEP } else { if (linkType.isSharedLibrary()) { - args.addElement("-prebind"); +// FREEHEP no longer needed for 10.4+ +// args.addElement("-prebind"); args.addElement("-dynamiclib"); } } @@ -121,11 +127,16 @@ public abstract class AbstractLdLinker extends CommandLineLinker { // if (set.getType() != previousLibraryType) { if (set.getType() != null && "static".equals(set.getType().getValue())) { +// BEGINFREEHEP not on MacOS X + if (!isDarwin()) { endargs.addElement(getStaticLibFlag()); previousLibraryType = set.getType(); + } +//ENDFREEHEP } else { +// FREEHEP not on MacOS X, recheck this! if (set.getType() == null || - !"framework".equals(set.getType().getValue()) || + !"framework".equals(set.getType().getValue()) && !isDarwin()) { endargs.addElement(getDynamicLibFlag()); previousLibraryType = set.getType(); @@ -137,7 +148,8 @@ public abstract class AbstractLdLinker extends CommandLineLinker { "framework".equals(set.getType().getValue()) && isDarwin()) { buf.setLength(0); - buf.append("-framework "); +// FREEHEP, added as endarg w/o trailing space to avoid quoting! + endargs.addElement("-framework"); } int initialLength = buf.length(); for (int j = 0; j < libs.length; j++) { @@ -154,6 +166,13 @@ public abstract class AbstractLdLinker extends CommandLineLinker { endargs.addElement(buf.toString()); } } + +// BEGINFREEHEP if last was -Bstatic reset it to -Bdynamic so that libc and libm can be found as shareables + if ((previousLibraryType != null) && previousLibraryType.getValue().equals("static") && !isDarwin()) { + endargs.addElement(getDynamicLibFlag()); + } +// ENDFREEHEP + String rc[] = new String[libnames.size()]; for (int i = 0; i < libnames.size(); i++) { rc[i] = (String) libnames.elementAt(i); @@ -239,7 +258,8 @@ public abstract class AbstractLdLinker extends CommandLineLinker { return patterns; } public int getMaximumCommandLength() { - return Integer.MAX_VALUE; +// FREEHEP + return isWindows() ? 20000 : Integer.MAX_VALUE; } public String[] getOutputFileNames(String baseName, VersionInfo versionInfo) { String[] baseNames = super.getOutputFileNames(baseName, versionInfo); 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 999ccf7..f9e4c0b 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java @@ -59,6 +59,11 @@ public final class GccCCompiler extends GccCompatibleCCompiler { sourceExtensions, headerExtensions, false, new GccCCompiler("g77", sourceExtensions, headerExtensions, true, null, false, null), false, null); +// FREEHEP + private static final GccCCompiler gfortranInstance = new GccCCompiler("gfortran", + sourceExtensions, headerExtensions, false, + new GccCCompiler("gfortran", sourceExtensions, headerExtensions, true, + null, false, null), false, null); private static final GccCCompiler gppInstance = new GccCCompiler("g++", sourceExtensions, headerExtensions, false, new GccCCompiler("g++", sourceExtensions, headerExtensions, true, @@ -80,6 +85,14 @@ public final class GccCCompiler extends GccCompatibleCCompiler { return g77Instance; } /** + * Gets g77 adapter + */ +// FREEHEPBEGIN + public static GccCCompiler getGFortranInstance() { + return gfortranInstance; + } +// FREEHEPEND + /** * Gets gpp adapter */ public static GccCCompiler getGppInstance() { @@ -118,6 +131,12 @@ public final class GccCCompiler extends GccCompatibleCCompiler { if (isPICMeaningful && linkType.isSharedLibrary()) { args.addElement("-fPIC"); } +// BEGINFREEHEP + // Add -fno_rtti only for g++ and c++ + if (!getCommand().equals("g77") && !getCommand().equals("gcc") && (rtti != null) && (!rtti.booleanValue())) { + args.addElement("-fno_rtti"); + } +// ENDFREEHEP } public Processor changeEnvironment(boolean newEnvironment, Environment env) { if (newEnvironment || env != null) { @@ -237,6 +256,6 @@ public final class GccCCompiler extends GccCompatibleCCompiler { return GccLinker.getInstance().getLinker(linkType); } public int getMaximumCommandLength() { - return Integer.MAX_VALUE; + return isWindows() ? 20000 : Integer.MAX_VALUE; } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java index 0485fba..fc7bbfc 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java @@ -98,10 +98,16 @@ public abstract class GccCompatibleCCompiler extends CommandLineCCompiler { args.addElement("-mwindows"); } } - if (rtti != null && !rtti.booleanValue()) { - args.addElement("-fno-rtti"); +// BEGINFREEHEP, tests have been modified + if (!exceptions) { + args.addElement("-fno-exceptions"); } - +// ENDFREEHEP +// BEGINFREEHEP moved to GccCCompiler +// if (rtti != null && !rtti.booleanValue()) { +// args.addElement("-fno-rtti"); +// } +// ENDFREEHEP } /** * Adds an include path to the command. 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 c4720c8..a551bfa 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java @@ -33,10 +33,13 @@ public class GccLinker extends AbstractLdLinker { private static final String[] libtoolObjFiles = new String[]{".fo", ".a", ".lib", ".dll", ".so", ".sl"}; private static String[] linkerOptions = new String[]{"-bundle", +// FREEHEP + "-dynamic", "-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, @@ -45,6 +48,11 @@ public class GccLinker extends AbstractLdLinker { objFiles, discardFiles, "lib", ".bundle", false, null); private static final GccLinker machDllLinker = new GccLinker("gcc", 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; } @@ -191,20 +199,17 @@ public class GccLinker extends AbstractLdLinker { if (type.isStaticLibrary()) { return GccLibrarian.getInstance(); } +// BEGINFREEHEP + if (type.isJNIModule()) { + return isDarwin() ? machJNILinker : isWindows() ? dllLinker : soLinker; + } 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/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java index f3bc174..043720d 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/main/java/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: ="; @@ -41,18 +42,29 @@ public class GppLinker extends AbstractLdLinker { ".lib", ".dll", ".so", ".sl"}; private static String[] linkerOptions = new String[]{"-bundle", "-dylib", "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib", - "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"}; + "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker", + // FREEHEP + "-static-libgcc", "-shared-libgcc" }; private static final GppLinker instance = new GppLinker("gcc", 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", objFiles, discardFiles, "lib", ".bundle", false, null); + // 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; } private File[] libDirs; private String runtimeLibrary; + // FREEEHEP + private String gccLibrary, gfortranLibrary; + protected GppLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) { @@ -69,22 +81,66 @@ 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]; + // BEGINFREEHEP link or not with libstdc++ + // for MacOS X see: + // http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/LibCPPDeployment.html + gfortranLibrary = null; + if (linkType.linkFortran()) { + if (linkType.isStaticRuntime()) { + String[] cmdin = new String[] { "gfortran", + "-print-file-name=libgfortran.a" }; + String[] cmdout = CaptureStreamHandler.run(cmdin); + if ((cmdout.length > 0) && (cmdout[0].indexOf('/') >= 0)) { + gfortranLibrary = cmdout[0]; + } + } else { + gfortranLibrary = "-lgfortran"; + } + } + + runtimeLibrary = null; + if (linkType.linkCPP()) { + if (linkType.isStaticRuntime()) { + if (isDarwin()) { + runtimeLibrary = "-lstdc++-static"; + } else { + String[] cmdin = new String[] { "g++", + "-print-file-name=libstdc++.a" }; + String[] cmdout = CaptureStreamHandler.run(cmdin); + if ((cmdout.length > 0) && (cmdout[0].indexOf('/') >= 0)) { + runtimeLibrary = cmdout[0]; + } + } } else { - runtimeLibrary = null; + runtimeLibrary = "-lstdc++"; } + } + + gccLibrary = null; + if (linkType.isStaticRuntime()) { + gccLibrary = "-static-libgcc"; } else { - runtimeLibrary = "-lstdc++"; + if (linkType.linkCPP()) { + // NOTE: added -fexceptions here for MacOS X + gccLibrary = "-fexceptions"; + } else { + gccLibrary = "-shared-libgcc"; + } } + // ENDFREEHEP } public String[] addLibrarySets(CCTask task, LibrarySet[] libsets, Vector preargs, Vector midargs, Vector endargs) { String[] rs = super.addLibrarySets(task, libsets, preargs, midargs, endargs); + // BEGINFREEHEP + if (gfortranLibrary != null) { + endargs.addElement(gfortranLibrary); + } + if (gccLibrary != null) { + endargs.addElement(gccLibrary); + } + // ENDFREEHEP if (runtimeLibrary != null) { endargs.addElement(runtimeLibrary); } @@ -184,20 +240,20 @@ public class GppLinker extends AbstractLdLinker { if (type.isStaticLibrary()) { return GccLibrarian.getInstance(); } + // BEGINFREEHEP + if (type.isJNIModule()) { + return isDarwin() ? machJNILinker : isWindows() ? dllLinker + : soLinker; + } 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; } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java b/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java index 2221aba..3a6f19f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ide/CommentDef.java @@ -16,11 +16,6 @@ */ package net.sf.antcontrib.cpptasks.ide; -import org.apache.tools.ant.util.StringUtils; - -import java.io.File; -import java.util.Collections; -import java.util.List; /** * Defines a comment to place in the generated project files. diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java index 12fd5bd..085d61e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java @@ -50,7 +50,8 @@ public final class IntelLinux32CCompiler extends GccCompatibleCCompiler { return this; } public Linker getLinker(LinkType type) { - return IntelLinux32Linker.getInstance().getLinker(type); +// FREEHEP + return IntelLinux32CLinker.getInstance().getLinker(type); } public int getMaximumCommandLength() { return Integer.MAX_VALUE; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CLinker.java new file mode 100644 index 0000000..49a8a57 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CLinker.java @@ -0,0 +1,35 @@ +// FREEHEP +package net.sf.antcontrib.cpptasks.intel; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker; +import net.sf.antcontrib.cpptasks.gcc.GccLibrarian; +public final class IntelLinux32CLinker extends AbstractLdLinker { + private static final String[] discardFiles = new String[0]; + private static final String[] libtoolObjFiles = new String[]{".fo", ".a", + ".lib", ".dll", ".so", ".sl"}; + private static final String[] objFiles = new String[]{".o", ".a", ".lib", + ".dll", ".so", ".sl"}; + private static final IntelLinux32CLinker dllLinker = new IntelLinux32CLinker( + "lib", ".so", false, new IntelLinux32CLinker("lib", ".so", true, + null)); + private static final IntelLinux32CLinker instance = new IntelLinux32CLinker( + "", "", false, null); + public static IntelLinux32CLinker getInstance() { + return instance; + } + private IntelLinux32CLinker(String outputPrefix, String outputSuffix, + boolean isLibtool, IntelLinux32CLinker libtoolLinker) { + super("icc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, + isLibtool, libtoolLinker); + } + public Linker getLinker(LinkType type) { + if (type.isStaticLibrary()) { + return GccLibrarian.getInstance(); + } + if (type.isSharedLibrary()) { + return dllLinker; + } + return instance; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Compiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Compiler.java new file mode 100644 index 0000000..d4feac3 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Compiler.java @@ -0,0 +1,36 @@ +// FREEHEP +package net.sf.antcontrib.cpptasks.intel; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.compiler.Processor; +import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler; + +import org.apache.tools.ant.types.Environment; + +public final class IntelLinux32Compiler extends GccCompatibleCCompiler { + private static final IntelLinux32Compiler instance = new IntelLinux32Compiler( + false, new IntelLinux32Compiler(true, null, false, null), false, + null); + public static IntelLinux32Compiler getInstance() { + return instance; + } + private IntelLinux32Compiler(boolean isLibtool, + IntelLinux32Compiler libtoolCompiler, boolean newEnvironment, + Environment env) { + super("icpc", "-V", isLibtool, libtoolCompiler, newEnvironment, env); + } + public Processor changeEnvironment(boolean newEnvironment, Environment env) { + if (newEnvironment || env != null) { + return new IntelLinux32Compiler(getLibtool(), + (IntelLinux32Compiler) getLibtoolCompiler(), + newEnvironment, env); + } + return this; + } + public Linker getLinker(LinkType type) { + return IntelLinux32Linker.getInstance().getLinker(type); + } + public int getMaximumCommandLength() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java index 9bed915..e6ddee1 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java @@ -40,7 +40,8 @@ public final class IntelLinux32Linker extends AbstractLdLinker { } private IntelLinux32Linker(String outputPrefix, String outputSuffix, boolean isLibtool, IntelLinux32Linker libtoolLinker) { - super("icc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, +// FREEHEP + super("icpc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java index 9ed6393..1d9f6c5 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java @@ -50,7 +50,8 @@ public final class IntelLinux64CCompiler extends GccCompatibleCCompiler { return this; } public Linker getLinker(LinkType type) { - return IntelLinux64Linker.getInstance().getLinker(type); +// FREEHEP + return IntelLinux64CLinker.getInstance().getLinker(type); } public int getMaximumCommandLength() { return Integer.MAX_VALUE; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CLinker.java new file mode 100644 index 0000000..ec25e9e --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CLinker.java @@ -0,0 +1,36 @@ +// FREEHEP +package net.sf.antcontrib.cpptasks.intel; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker; +import net.sf.antcontrib.cpptasks.gcc.GccLibrarian; + +public final class IntelLinux64CLinker extends AbstractLdLinker { + private static final String[] discardFiles = new String[0]; + private static final String[] libtoolObjFiles = new String[]{".fo", ".a", + ".lib", ".dll", ".so", ".sl"}; + private static final String[] objFiles = new String[]{".o", ".a", ".lib", + ".dll", ".so", ".sl"}; + private static final IntelLinux64CLinker dllLinker = new IntelLinux64CLinker( + "lib", ".so", false, new IntelLinux64CLinker("lib", ".so", true, + null)); + private static final IntelLinux64CLinker instance = new IntelLinux64CLinker( + "", "", false, null); + public static IntelLinux64CLinker getInstance() { + return instance; + } + private IntelLinux64CLinker(String outputPrefix, String outputSuffix, + boolean isLibtool, IntelLinux64CLinker libtoolLinker) { + super("ecc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, + isLibtool, libtoolLinker); + } + public Linker getLinker(LinkType type) { + if (type.isStaticLibrary()) { + return GccLibrarian.getInstance(); + } + if (type.isSharedLibrary()) { + return dllLinker; + } + return instance; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Compiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Compiler.java new file mode 100644 index 0000000..531de0c --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Compiler.java @@ -0,0 +1,36 @@ +// FREEHEP +package net.sf.antcontrib.cpptasks.intel; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.compiler.Processor; +import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler; + +import org.apache.tools.ant.types.Environment; + +public final class IntelLinux64Compiler extends GccCompatibleCCompiler { + private static final IntelLinux64Compiler instance = new IntelLinux64Compiler( + false, new IntelLinux64Compiler(true, null, false, null), false, + null); + public static IntelLinux64Compiler getInstance() { + return instance; + } + private IntelLinux64Compiler(boolean isLibtool, + IntelLinux64Compiler libtoolCompiler, boolean newEnvironment, + Environment env) { + super("ecpc", "-V", isLibtool, libtoolCompiler, newEnvironment, env); + } + public Processor changeEnvironment(boolean newEnvironment, Environment env) { + if (newEnvironment || env != null) { + return new IntelLinux64Compiler(getLibtool(), + (IntelLinux64Compiler) this.getLibtoolCompiler(), + newEnvironment, env); + } + return this; + } + public Linker getLinker(LinkType type) { + return IntelLinux64Linker.getInstance().getLinker(type); + } + public int getMaximumCommandLength() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java index d712e5b..6798c3f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java @@ -40,7 +40,8 @@ public final class IntelLinux64Linker extends AbstractLdLinker { } private IntelLinux64Linker(String outputPrefix, String outputSuffix, boolean isLibtool, IntelLinux64Linker libtoolLinker) { - super("ecc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, +// FREEHEP + super("ecpc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinuxFortranCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinuxFortranCompiler.java new file mode 100644 index 0000000..b9e4467 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinuxFortranCompiler.java @@ -0,0 +1,37 @@ +// BEGINFREEHEP +package net.sf.antcontrib.cpptasks.intel; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.compiler.Processor; +import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler; + +import org.apache.tools.ant.types.Environment; + +public final class IntelLinuxFortranCompiler extends GccCompatibleCCompiler { + private static final IntelLinuxFortranCompiler instance = new IntelLinuxFortranCompiler( + false, new IntelLinuxFortranCompiler(true, null, false, null), false, + null); + public static IntelLinuxFortranCompiler getInstance() { + return instance; + } + private IntelLinuxFortranCompiler(boolean isLibtool, + IntelLinuxFortranCompiler libtoolCompiler, boolean newEnvironment, + Environment env) { + super("ifort", "-V", isLibtool, libtoolCompiler, newEnvironment, env); + } + public Processor changeEnvironment(boolean newEnvironment, Environment env) { + if (newEnvironment || env != null) { + return new IntelLinuxFortranCompiler(getLibtool(), + (IntelLinuxFortranCompiler) getLibtoolCompiler(), + newEnvironment, env); + } + return this; + } + public Linker getLinker(LinkType type) { + return IntelLinux32Linker.getInstance().getLinker(type); + } + public int getMaximumCommandLength() { + return Integer.MAX_VALUE; + } +} +// ENDFREEHEP
\ No newline at end of file diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java index 47d2155..91ec3d1 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java @@ -51,7 +51,8 @@ public final class ForteCCLinker extends AbstractLdLinker { args.addElement("-g"); } if (linkType.isStaticRuntime()) { - args.addElement("-static"); +// FREEHEP changed -static + args.addElement("-staticlib=%all"); } if (linkType.isSharedLibrary()) { args.addElement("-G"); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCompiler.java new file mode 100644 index 0000000..9fb43da --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCompiler.java @@ -0,0 +1,98 @@ +/* FREEHEP + */ +package net.sf.antcontrib.cpptasks.sun; +import java.io.File; +import java.util.Vector; + +import net.sf.antcontrib.cpptasks.CUtil; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler; +import net.sf.antcontrib.cpptasks.OptimizationEnum; +/** + * Adapter for the Sun (r) Forte (tm) C compiler + * + * @author Mark Donszelmann + */ +public final class ForteCCompiler extends GccCompatibleCCompiler { + private static final ForteCCompiler instance = new ForteCCompiler("cc"); + /** + * Gets singleton instance of this class + */ + public static ForteCCompiler getInstance() { + return instance; + } + private String identifier; + private File[] includePath; + /** + * Private constructor. Use ForteCCompiler.getInstance() to get singleton + * instance of this class. + */ + private ForteCCompiler(String command) { + super(command, "-V", false, null, false, null); + } + public void addImpliedArgs(final Vector args, + final boolean debug, + final boolean multithreaded, + final boolean exceptions, + final LinkType linkType, + final Boolean rtti, + final OptimizationEnum optimization) { + args.addElement("-c"); + if (debug) { + args.addElement("-g"); + } + if (optimization != null) { + if (optimization.isSpeed()) { + args.addElement("-xO2"); + } + } + if (multithreaded) { + args.addElement("-mt"); + } + if (linkType.isSharedLibrary()) { + args.addElement("-KPIC"); + } + + } + public void addWarningSwitch(Vector args, int level) { + switch (level) { + case 0 : + args.addElement("-w"); + break; + case 1 : + case 2 : + args.addElement("+w"); + break; + case 3 : + case 4 : + case 5 : + args.addElement("+w2"); + break; + } + } + public File[] getEnvironmentIncludePath() { + if (includePath == null) { + File ccLoc = CUtil.getExecutableLocation("cc"); + if (ccLoc != null) { + File compilerIncludeDir = new File( + new File(ccLoc, "../include").getAbsolutePath()); + if (compilerIncludeDir.exists()) { + includePath = new File[2]; + includePath[0] = compilerIncludeDir; + } + } + if (includePath == null) { + includePath = new File[1]; + } + includePath[includePath.length - 1] = new File("/usr/include"); + } + return includePath; + } + public Linker getLinker(LinkType linkType) { + return ForteCCLinker.getInstance().getLinker(linkType); + } + public int getMaximumCommandLength() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteF77Compiler.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteF77Compiler.java new file mode 100644 index 0000000..2230b66 --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteF77Compiler.java @@ -0,0 +1,98 @@ +/* FREEHEP + */ +package net.sf.antcontrib.cpptasks.sun; +import java.io.File; +import java.util.Vector; + +import net.sf.antcontrib.cpptasks.CUtil; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; +import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler; +import net.sf.antcontrib.cpptasks.OptimizationEnum; +/** + * Adapter for the Sun (r) Forte (tm) F77 compiler + * + * @author Mark Donszelmann + */ +public final class ForteF77Compiler extends GccCompatibleCCompiler { + private static final ForteF77Compiler instance = new ForteF77Compiler("f77"); + /** + * Gets singleton instance of this class + */ + public static ForteF77Compiler getInstance() { + return instance; + } + private String identifier; + private File[] includePath; + /** + * Private constructor. Use ForteF77Compiler.getInstance() to get singleton + * instance of this class. + */ + private ForteF77Compiler(String command) { + super(command, "-V", false, null, false, null); + } + public void addImpliedArgs(final Vector args, + final boolean debug, + final boolean multithreaded, + final boolean exceptions, + final LinkType linkType, + final Boolean rtti, + final OptimizationEnum optimization) { + args.addElement("-c"); + if (debug) { + args.addElement("-g"); + } + if (optimization != null) { + if (optimization.isSpeed()) { + args.addElement("-xO2"); + } + } + if (multithreaded) { + args.addElement("-mt"); + } + if (linkType.isSharedLibrary()) { + args.addElement("-KPIC"); + } + + } + public void addWarningSwitch(Vector args, int level) { + switch (level) { + case 0 : + args.addElement("-w"); + break; + case 1 : + case 2 : + args.addElement("+w"); + break; + case 3 : + case 4 : + case 5 : + args.addElement("+w2"); + break; + } + } + public File[] getEnvironmentIncludePath() { + if (includePath == null) { + File f77Loc = CUtil.getExecutableLocation("f77"); + if (f77Loc != null) { + File compilerIncludeDir = new File( + new File(f77Loc, "../include").getAbsolutePath()); + if (compilerIncludeDir.exists()) { + includePath = new File[2]; + includePath[0] = compilerIncludeDir; + } + } + if (includePath == null) { + includePath = new File[1]; + } + includePath[includePath.length - 1] = new File("/usr/include"); + } + return includePath; + } + public Linker getLinker(LinkType linkType) { + return ForteCCLinker.getInstance().getLinker(linkType); + } + public int getMaximumCommandLength() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE index 340dceb..70964f8 100644 --- a/src/main/resources/META-INF/NOTICE +++ b/src/main/resources/META-INF/NOTICE @@ -2,3 +2,5 @@ This product includes software developed by The Ant-Contrib project (http://ant-contrib.sourceforge.net) This product includes software developed by The Apache Software Foundation (http://www.apache.org/). +This product was changed by FreeHEP + The FreeHEP project (http://java.freehep.org/). diff --git a/src/test/java/net/sf/antcontrib/cpptasks/TestCompilerDef.java b/src/test/java/net/sf/antcontrib/cpptasks/TestCompilerDef.java index 12e1967..017dc02 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/TestCompilerDef.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/TestCompilerDef.java @@ -225,7 +225,8 @@ public final class TestCompilerDef CompilerDef extendedLinker = (CompilerDef) createExtendedProcessorDef( baseLinker); String[] preArgs = getPreArguments(extendedLinker); - assertEquals(2, preArgs.length); + // FREEHEP, passes extra option + assertEquals(3, preArgs.length); assertEquals("/base", preArgs[0]); } @@ -244,8 +245,10 @@ public final class TestCompilerDef CompilerDef extendedCompiler = (CompilerDef) createExtendedProcessorDef( baseCompiler); String[] preArgs = getPreArguments(extendedCompiler); - assertEquals(2, preArgs.length); - assertEquals("-Dfoo=bar", preArgs[1]); + // BEGINFREEHEP, passes extra option + assertEquals(3, preArgs.length); + assertEquals("-Dfoo=bar", preArgs[2]); + // ENDFREEHEP } /** @@ -259,8 +262,10 @@ public final class TestCompilerDef IncludePath path = baseCompiler.createIncludePath(); path.setPath("/tmp"); String[] preArgs = getPreArguments(extendedCompiler); - assertEquals(2, preArgs.length); - assertEquals("-I", preArgs[1].substring(0, 2)); + // BEGINFREEHEP, passes extra option + assertEquals(3, preArgs.length); + assertEquals("-I", preArgs[2].substring(0, 2)); + // ENDFREEHEP } /** @@ -274,8 +279,10 @@ public final class TestCompilerDef SystemIncludePath path = baseCompiler.createSysIncludePath(); path.setPath("/tmp"); String[] preArgs = getPreArguments(extendedCompiler); - assertEquals(2, preArgs.length); - assertEquals("-I", preArgs[1].substring(0, 2)); + // BEGINFREEHEP, passes extra option + assertEquals(3, preArgs.length); + assertEquals("-I", preArgs[2].substring(0, 2)); + // ENDFREEHEP } /** diff --git a/src/test/java/net/sf/antcontrib/cpptasks/TestLinkerDef.java b/src/test/java/net/sf/antcontrib/cpptasks/TestLinkerDef.java index 994b068..e35c5e6 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/TestLinkerDef.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/TestLinkerDef.java @@ -243,7 +243,8 @@ public final class TestLinkerDef setLinkerName(extendedLinker, "msvc"); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/BASE:0x2710", preArgs[3]); } @@ -260,7 +261,8 @@ public final class TestLinkerDef setLinkerName(extendedLinker, "msvc"); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/STACK:0x2710", preArgs[3]); } @@ -291,7 +293,8 @@ public final class TestLinkerDef setLinkerName(extendedLinker, "msvc"); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/FIXED", preArgs[3]); } @@ -308,7 +311,8 @@ public final class TestLinkerDef setLinkerName(extendedLinker, "msvc"); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:YES", preArgs[2]); } @@ -324,7 +328,8 @@ public final class TestLinkerDef setLinkerName(extendedLinker, "msvc"); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/MAP", preArgs[3]); } @@ -349,7 +354,8 @@ public final class TestLinkerDef extendedLinker.setBase(new FlexLong("10000")); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/BASE:0x2710", preArgs[3]); } @@ -367,7 +373,8 @@ public final class TestLinkerDef extendedLinker.setBase(new FlexLong("10000")); String[] preArgs = getPreArguments(extendedLinker); assertEquals("/NOLOGO", preArgs[0]); - assertEquals("/SUBSYSTEM:WINDOWS", preArgs[1]); + // FREEHEP changed from WINDOWS into CONSOLE + assertEquals("/SUBSYSTEM:CONSOLE", preArgs[1]); assertEquals("/INCREMENTAL:NO", preArgs[2]); assertEquals("/BASE:0x2710", preArgs[3]); } diff --git a/src/test/java/net/sf/antcontrib/cpptasks/TestProcessorDef.java b/src/test/java/net/sf/antcontrib/cpptasks/TestProcessorDef.java index c4e2905..8bce7ec 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/TestProcessorDef.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/TestProcessorDef.java @@ -257,7 +257,8 @@ public abstract class TestProcessorDef baseLinker.setDebug(true); ProcessorDef extendedLinker = createExtendedProcessorDef(baseLinker); String[] preArgs = getPreArguments(extendedLinker); - assertEquals("-g", preArgs[preArgs.length - 1]); + // FREEHEP, passes (sometimes) extra option + assertEquals("-g", preArgs[Math.max(preArgs.length - 2, 0)]); } /** diff --git a/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudio2005CCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudio2005CCompiler.java index dccb986..8f6903e 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudio2005CCompiler.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudio2005CCompiler.java @@ -18,8 +18,6 @@ package net.sf.antcontrib.cpptasks.devstudio; import java.util.Vector; import junit.framework.TestCase; - -import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; /** * Test Microsoft C/C++ compiler adapter * diff --git a/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudioCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudioCCompiler.java index eeeec14..0e546e9 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudioCCompiler.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/devstudio/TestDevStudioCCompiler.java @@ -18,8 +18,6 @@ package net.sf.antcontrib.cpptasks.devstudio; import java.util.Vector; import junit.framework.TestCase; - -import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; /** * Test Microsoft C/C++ compiler adapter * diff --git a/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java b/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java index 63996c5..27ffea0 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java @@ -73,9 +73,11 @@ public class TestAbstractLdLinker extends TestCase { pluginOutType.setValue("shared"); pluginType.setOutputType(pluginOutType); linker.addImpliedArgs(false, pluginType, args); - assertEquals(2, args.size()); - assertEquals("-prebind", args.elementAt(0)); - assertEquals("-dynamiclib", args.elementAt(1)); + // FIXME NAR-103 + // BEGINFREEHEP + assertEquals(1, args.size()); + assertEquals("-dynamiclib", args.elementAt(0)); + // ENDFREEHEP } /** * Checks for proper arguments for plugin generation on Darwin @@ -168,11 +170,14 @@ public class TestAbstractLdLinker extends TestCase { String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs); assertEquals("-L", ((String) endargs.elementAt(0)).substring(0, 2)); - assertEquals("-Bdynamic", (String) endargs.elementAt(1)); - assertEquals("-lbart", (String) endargs.elementAt(2)); - assertEquals("-lcart", (String) endargs.elementAt(3)); - assertEquals("-ldart", (String) endargs.elementAt(4)); - assertEquals(endargs.size(), 5); +// FIXME NAR-103 +// BEGINFREEHEP +// assertEquals("-Bdynamic", (String) endargs.elementAt(1)); + assertEquals("-lbart", (String) endargs.elementAt(1)); + assertEquals("-lcart", (String) endargs.elementAt(2)); + assertEquals("-ldart", (String) endargs.elementAt(3)); + assertEquals(endargs.size(), 4); + // ENDFREEHEP } public void testAddLibrarySetLibFrameworkDarwin() { System.setProperty("os.name", "Mac OS X"); @@ -191,11 +196,22 @@ public class TestAbstractLdLinker extends TestCase { Vector endargs = new Vector(); String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs); +// FIXME NAR-103 +// BEGINFREEHEP + /* assertEquals("-F", ((String) endargs.elementAt(0)).substring(0, 2)); assertEquals("-framework bart", (String) endargs.elementAt(1)); assertEquals("-framework cart", (String) endargs.elementAt(2)); assertEquals("-framework dart", (String) endargs.elementAt(3)); assertEquals(endargs.size(), 4); + */ + assertEquals("-F", ((String) endargs.elementAt(0)).substring(0, 2)); + assertEquals("-framework", (String) endargs.elementAt(1)); + assertEquals("bart", (String) endargs.elementAt(2)); + assertEquals("cart", (String) endargs.elementAt(3)); + assertEquals("dart", (String) endargs.elementAt(4)); + assertEquals(endargs.size(), 5); +// ENDFREEHEP } public void testAddLibraryStatic() { AbstractLdLinker linker = getLinker(); @@ -219,12 +235,23 @@ public class TestAbstractLdLinker extends TestCase { Vector endargs = new Vector(); String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, endargs); - assertEquals("-lbart", (String) endargs.elementAt(0)); - assertEquals("-Bstatic", (String) endargs.elementAt(1)); - assertEquals("-lcart", (String) endargs.elementAt(2)); - assertEquals("-Bdynamic", (String) endargs.elementAt(3)); - assertEquals("-ldart", (String) endargs.elementAt(4)); - assertEquals(endargs.size(), 5); + for (int i=0; i<endargs.size(); i++) System.err.println(endargs.get( i )); +// NAR-103 +// BEGINFREEHEP + if (System.getProperty("os.name").equals("Mac OS X")) { + assertEquals("-lbart", (String) endargs.elementAt(0)); + assertEquals("-lcart", (String) endargs.elementAt(1)); + assertEquals("-ldart", (String) endargs.elementAt(2)); + assertEquals(endargs.size(), 3); + } else { + assertEquals("-lbart", (String) endargs.elementAt(0)); + assertEquals("-Bstatic", (String) endargs.elementAt(1)); + assertEquals("-lcart", (String) endargs.elementAt(2)); + assertEquals("-Bdynamic", (String) endargs.elementAt(3)); + assertEquals("-ldart", (String) endargs.elementAt(4)); + assertEquals(endargs.size(), 5); + } +// ENDFREEHEP } public void testLibReturnValue() { AbstractLdLinker linker = getLinker(); diff --git a/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java index 073463e..6c3a8b5 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/hp/TestaCCCompiler.java @@ -15,10 +15,7 @@ * limitations under the License. */ package net.sf.antcontrib.cpptasks.hp; -import java.util.Vector; - import junit.framework.TestCase; - import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; /** * Test HP aCC compiler adapter diff --git a/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java b/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java index 62a513e..87e7020 100644 --- a/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java +++ b/src/test/java/net/sf/antcontrib/cpptasks/ibm/TestVisualAgeCCompiler.java @@ -15,10 +15,7 @@ * limitations under the License. */ package net.sf.antcontrib.cpptasks.ibm; -import java.util.Vector; - import junit.framework.TestCase; - import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; /** * Test IBM Visual Age compiler adapter |