Compilers are run over each of the changed files in each of the file groups in a target to create object files, which are then linked into the target. Modification dates or hashes are used to tell if files need recompiling, or if the object file can be reused.

  • flag - Adds a single argument to the compiler command line.

    • value - flag added to the command line.
    • tag - optional filter to restrict flag to files with a matching tag. See Tags.
<flag value="value" tag="tag" />
  • cflag/cppflag/objcflag/mmflag - Adds a flag when compiling specific file types.

    • cflag - only added to .c (C) files.
    • cppflag - only added to .cpp (C++) files.
    • objcflag - only added to .objc (Objective-C) files.
    • mmflag - only added to .mm (Objective-C++) files.
<cflag value="value" />
<cppflag value="value" />
<objcflag value="value" />
<mmflag value="value" />
  • pchflag - Adds a flag when compiling precompiled header .h files.

    • pchflag - usually ["-x", "c++-header"] for apple to specify the "identity" of the header.
<pchflag value="value" />
  • pch - Sets the precompiled header style - gcc or msvc.
<pch value="gcc|msvc" />
  • objdir - Sets the name of the directory used to store object files. Should be unique for a given set of compiler flags to avoid linking against the wrong architecture.

    • value - usually built programmatically, e.g. obj/msvc${MSVC_VER}-rt${OBJEXT}${OBJCACHE}${XPOBJ}.
<objdir value="obj/somewhere" />
  • output - Sets the flag used to specify the compiler's output.

    • value - flag value. Note that it should contain a space character if the actual name should be a separate argument, like -o<space>, or -o/-out: if the name should be appended directly.
<outflag value="-flag" />
  • exe - Overrides the executable command specified in the compiler attribute.

    • name - command. Usually you would use path to add the directory containing the executable, then specify the filename part only in this attribute.
<exe name="command" />
  • ext - Sets the object file extension.

    • name - extension, including ".". .o on Linux and Mac, .obj on Windows.
<ext name=".obj" />
  • getversion - Sets the command used to obtain the version of the compiler. This is used for checking if the compiler has changed, and therefore whether the objects need recompiling.

    • value - command to run. It defaults to (compiler) --version which works for gcc-based compilers. Setting it to an empty value will disable caching.
<getversion value="command" />
  • section - Groups blocks of elements - usually ones that all respect the same if/unless condition.
  • include - Includes compiler options from another file. Most compilers should include <include name="toolchain/common-defines.xml" /> to add the defines used by hxcpp.
<include name="filename" />