Targets are used to produce binaries, or to group other targets. When compiling executables or dynamic libraries, they provide the additional link libraries.

By default, hxcpp will try to compile the default target, so it is easiest to define this one - perhaps by simply adding a dependence on your other target(s).

The target is defined with a toolid attribute: exe, static_link, or dll. This defines which linker is used, but many of the target entries will be the same even if the linker is changed.

Targets can contain the following nodes:

  • subTargetName - Builds another target before building this one.
<target id="subTargetName" />
  • merge - Combines fields from another target. This is useful if you want a target to function as a static or dynamic library when compiled on its own, but also allow it to be used as a list of object files if another target wants to link in the object files directly.
<merge id="otherTargetName" />
  • files - Adds a named group of compiled files to the target.
<files id="filesId"/>
  • section - Groups blocks of elements - usually ones that all respect the same if/unless condition.
  • lib - Adds a library to the link line.

    • name - the complete name is specified.
    • base - the name without a compiler-specific extension (.a/.lib) is specified.
    • hxbase - the name without an extension and architecture (-v7/.iphonesim) is specified.
<lib (name|hxbase|base)="libName" />
  • flag - Adds a single link flag.
<flag value="flag"/>
  • vflag - Adds a name-value pair of link arguments.
<vflag name="flag1" value="flag2"/>
  • depend - Declares that the target depends on the given filename.
<depend name="filename" />
  • dir - Adds a directory to the target's directory list. These directories will get removed when the target is cleaned.
<dir name="tempPath" />
  • outdir - Sets the directory for build results - including "copyFile" targets.
<outdir name="path"/>
  • ext - Sets the extension for the generated files.

    • ext - the extension, should contain ".".
<ext name=".ext"/>
  • builddir - Sets the directory from which the target's build commands are run, and therefore the relative base for some filenames, and destination for some compiler-generated temporary files.
<builddir name="path"/>
  • libpath - Add a library search path to the build command.

    • name - directory. The linker will add the required flags.
<libpath name="directory"/>