diff options
Diffstat (limited to 'src/samples')
-rw-r--r-- | src/samples/blas.ant | 185 | ||||
-rw-r--r-- | src/samples/check.ant | 206 | ||||
-rw-r--r-- | src/samples/cppunit.ant | 583 | ||||
-rw-r--r-- | src/samples/hello/build.xml | 27 | ||||
-rw-r--r-- | src/samples/hello/src/main/c/hello.c | 25 | ||||
-rw-r--r-- | src/samples/qtunit.ant | 238 | ||||
-rw-r--r-- | src/samples/xercesc.ant | 1113 | ||||
-rw-r--r-- | src/samples/xpcom.ant | 120 |
8 files changed, 2497 insertions, 0 deletions
diff --git a/src/samples/blas.ant b/src/samples/blas.ant new file mode 100644 index 0000000..c1a28f5 --- /dev/null +++ b/src/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/src/samples/check.ant b/src/samples/check.ant new file mode 100644 index 0000000..f0e1c14 --- /dev/null +++ b/src/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/src/samples/cppunit.ant b/src/samples/cppunit.ant new file mode 100644 index 0000000..9b0938b --- /dev/null +++ b/src/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/src/samples/hello/build.xml b/src/samples/hello/build.xml new file mode 100644 index 0000000..b8e0b78 --- /dev/null +++ b/src/samples/hello/build.xml @@ -0,0 +1,27 @@ +<!-- + Licensed to the Ant-Contrib Project under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The Ant-Contrib Project licenses this file to You 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="hello" default="compile"> + <taskdef resource="cpptasks.tasks"/> + <target name="compile"> + <mkdir dir="target/main/obj"/> + <cc outtype="static" subsystem="console" outfile="target/hello" objdir="target/main/obj"> + <fileset dir="src/main/c" includes="*.c"/> + <project type="xcode" outfile="hello" overwrite="true"/> + </cc> + </target> +</project> diff --git a/src/samples/hello/src/main/c/hello.c b/src/samples/hello/src/main/c/hello.c new file mode 100644 index 0000000..6912199 --- /dev/null +++ b/src/samples/hello/src/main/c/hello.c @@ -0,0 +1,25 @@ +/* + + Licensed to the Ant-Contrib Project under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The Ant-Contrib Project licenses this file to You 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. + +*/ + +#include <stdio.h> + +int main(int argc, const char** argv) { + puts("Hello, World."); + return 0; +} diff --git a/src/samples/qtunit.ant b/src/samples/qtunit.ant new file mode 100644 index 0000000..fab89ed --- /dev/null +++ b/src/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/src/samples/xercesc.ant b/src/samples/xercesc.ant new file mode 100644 index 0000000..b3072de --- /dev/null +++ b/src/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/src/samples/xpcom.ant b/src/samples/xpcom.ant new file mode 100644 index 0000000..b1da4b2 --- /dev/null +++ b/src/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> |