Rev 1760 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<project name="ant-cppcompile-task"><!--This macrodef is used to streamline and manage a common build framework.Many of the options listed below are documented within the cpptasks documentation.--><macrodef name="cppcompile"><attribute name="name"description="The logical name of the package to be built. Typically the ant.project.name"/><attribute name="version"description="The version of the package to be built. This may be the logical version rather than the released package version."/><attribute name="compiler"description="The compiler to be used (bcpp, msvc, suncc). Requires the associated ant-???? package where ???? is the compiler."/><attribute name="targetname"default="@{name}"description="Optional target package name, which may include some target based identity, if different from the project name. Default to package 'name'"/><attribute name="buildtype"default="release"description="Optional type of build, whether 'debug' or 'release'. Defaults to 'release'"/><attribute name="compilerpath"default="$${@{compiler}_bin}"description="Optional compiler path override. Normally defined within the ant-???? compiler package."/><attribute name="rtti"default="true"description="Optional flag, used to enable Run-Time Type Information"/><attribute name="usevcl"default="false"description="Optional flag, used to include vcl libraries"/><attribute name="exceptions"default="true"description="Optional flag, used to enable exception handling support. Defaults to true"/><attribute name="multithreaded"default="true"description="Optional flag, used to enable multithreaded support. Defaults to true"/><attribute name="optimize"default="speed"description="Optional flag, used to specify optimization. Defaults to 'speed', but is overridden to 'none' by debug buildtype."/><attribute name="outtype"default="executable"description="Optional flag, used to indicate the type of package being built (static, shared, executable)"/><attribute name="subsystem"default="console"description="Optional flag, used to indicate the nature of the subsystem under which the program will run. (gui, console, other)."/><attribute name="build"default="${basedir}/build"description="The location of the project 'build' folder. Defaults to 'project basedir'/build. You do not normal need to provide this value."/><attribute name="objdir"default="@{build}/obj"description="Optional value, used to nominate the build object directory base."/><attribute name="pkgdir"default="@{build}/pkg"description="Optional value, used to nominate the build package directory."/><element name="compiler-elements" optional="yes" implicit="yes" description="Any compiler specific parameters."/><sequential><echo taskname="ant-cppcompile-task">Compiling @{name} Version: @{version}</echo><!-- Determine any compile type dependent flagsIncluding naming standards, optimizations, etc --><if><equals arg1="@{buildtype}" arg2="debug"/><then><property name="@{name}@{compiler}@{buildtype}-compile_type_symbol" value="D"/><property name="@{name}@{compiler}@{buildtype}-debug_flag" value="true"/><property name="@{name}@{compiler}@{buildtype}-compile_optimize" value="none"/></then><else><property name="@{name}@{compiler}@{buildtype}-compile_type_symbol" value="P"/><property name="@{name}@{compiler}@{buildtype}-debug_flag" value="false"/><if><equals arg1="@{optimize}" arg2=""/><then><property name="@{name}@{compiler}@{buildtype}-compile_optimize" value="speed"/></then><else><property name="@{name}@{compiler}@{buildtype}-compile_optimize" value="@{optimize}"/></else></if></else></if><!-- Identify the compile platform extension --><condition property="compile.platform" value="win32"><os family="windows"/></condition><condition property="compile.platform" value="win32"><os family="dos"/></condition><condition property="compile.platform" value="sparc"><os name="SunOS"/></condition><!-- Type of target => executable,plugin,shared,static --><if><equals arg1="@{outtype}" arg2="executable"/><then><property name="@{name}@{buildtype}--targetfolder" value="bin.${compile.platform}${@{name}@{compiler}@{buildtype}-compile_type_symbol}"/><property name="@{name}@{compiler}@{outtype}@{buildtype}-output_name" value="@{targetname}"/></then><else><property name="@{name}@{buildtype}--targetfolder" value="lib.${compile.platform}"/><property name="@{name}@{compiler}@{outtype}@{buildtype}-output_name" value="@{targetname}@{version}${@{name}@{compiler}@{buildtype}-compile_type_symbol}"/></else></if><!-- Type of target => Linker Options for bcpp compiler according type executable,plugin,shared,static--><if><equals arg1="@{compiler}" arg2="bcpp"/><then><if><equals arg1="@{outtype}" arg2="executable"/><then><property name="@{buildtype}@{compiler}@{name}--linker" value="@{compiler}_linker_@{buildtype}_@{subsystem}"/></then><else><if><equals arg1="@{outtype}" arg2="shared"/><then><property name="@{buildtype}@{compiler}@{name}--linker" value="@{compiler}_linker_@{buildtype}_@{subsystem}"/></then><else><property name="@{buildtype}@{compiler}@{name}--linker" value="@{compiler}_linker_none"/></else></if></else></if></then><else><property name="@{buildtype}@{compiler}@{name}--linker" value="@{compiler}_linker_@{buildtype}_@{subsystem}"/></else></if><!-- Type of target => Linker Options with VCL--><if><equals arg1="@{usevcl}" arg2="true"/><then><property name="@{name}_@{compiler}--vcl" value="_vcl"/></then><else><property name="@{name}_@{compiler}--vcl" value=""/></else></if><mkdir dir="${objdir}/@{buildtype}_@{compiler}"/><mkdir dir="${objdir}/@{buildtype}_@{compiler}/@{targetname}"/><mkdir dir="@{pkgdir}"/><mkdir dir="@{pkgdir}/${@{name}@{buildtype}--targetfolder}"/><echo taskname="ant-cppcompile-task">Compile @{name} into @{pkgdir}/${@{name}@{buildtype}--targetfolder}/${@{name}@{compiler}@{outtype}@{buildtype}-output_name}</echo><echo taskname="ant-cppcompile-task">Using Compiler @{compiler} from @{compilerpath}</echo><echo taskname="ant-cppcompile-task">Placing Objects in ${objdir}/@{buildtype}_@{compiler}/@{targetname}</echo><echo taskname="ant-cppcompile-task">Use Compiler Includes from ${@{compiler}_include_@{buildtype}}</echo><echo taskname="ant-cppcompile-task">Use Package Includes from @{pkgdir}/include</echo><echo taskname="ant-cppcompile-task">Linking with Library ${@{compiler}_lib_@{buildtype}} Files: ${@{compiler}_libraries_@{buildtype}}</echo><echo taskname="ant-cppcompile-task">Linker ${@{buildtype}@{compiler}@{name}--linker}${@{name}_@{compiler}--vcl}</echo><echo taskname="ant-cppcompile-task">Compiler @{compiler}_compiler_@{buildtype}_@{subsystem}</echo><echo taskname="ant-cppcompile-task">Output File Name ${@{name}@{compiler}@{outtype}@{buildtype}-output_name}</echo><echo taskname="ant-cppcompile-task">Include Path: ${@{compiler}_include_@{buildtype}}</echo><cc name="${@{compiler}_compilername}"path="@{compilerpath}"rtti="@{rtti}"exceptions="@{exceptions}"multithreaded="@{multithreaded}"optimize="${@{name}@{compiler}@{buildtype}-compile_optimize}"debug="${@{name}@{compiler}@{buildtype}-debug_flag}"outtype="@{outtype}"subsystem="@{subsystem}"outfile="@{pkgdir}/${@{name}@{buildtype}--targetfolder}/${@{name}@{compiler}@{outtype}@{buildtype}-output_name}"objdir="${objdir}/@{buildtype}_@{compiler}/@{targetname}"><compiler refid="@{compiler}_compiler_@{buildtype}_@{subsystem}"/><linker refid="${@{buildtype}@{compiler}@{name}--linker}${@{name}_@{compiler}--vcl}"/><includepath path="${@{compiler}_include_@{buildtype}}"/><includepath path="@{pkgdir}/include"/><compiler-elements/></cc></sequential></macrodef></project>