12.6.3.2 Files

The files node defines a group of files that all share the same attributes, including relative directory, default compiler flags and dependencies. The node can be used to define a set of header files on which other files can depend, or a set of source files to be compiled and included in a target.

  • depend - Declares that all files in the group depend on another file or another file group.

    • name - if the named file changes then all the files in the group need recompiling.
    • files - if any of the files in the named group changes then then all the files in the group need recompiling.
<depend name="filename" />
<depend files="filesId" />
  • options - Sets the name of the file containing compiler flags. When the cache is not used, Options.txt helps detect when the options have changed, and therefore whether files need recompiling.
<options name="Options.txt" />
  • config - Sets the name of the file to generate that contains the C++ preprocessor defines that were active when code was compiled.
<config name="outfile.h" />
  • tag - Adds a default compiler tag for all files in the group. See Tags.
<tag value="tag" />
  • addTwice - When compiled to a library, adds the library twice to the link line - once at the beginning and once at the end to satisfy Linux selective linking.
<addTwice value="true" />
  • cache - Enables compiler cache for files in the group. See compile cache for more details.

    • project - name of project used to manage and group object files in the cache.
    • asLibrary - link the objects (.obj) into a .lib file, which can skip unneeded objects, but will also skip things that rely on static initializers to register handlers, so be careful.
<cache value="true" project="name" asLibrary="true" />
  • include - Includes an external file list.
<include name="filename.xml" />
  • section - Groups blocks of elements - usually ones that all respect the same if/unless condition.
<section name="id" />...</section>
  • compilerflag - Adds a compiler flag when compiling files in the group.

    • name and value - adds 2 command-line arguments when compiling.
    • value - adds 1 command-line argument when compiling.
<compilerflag name="name" value="value" />
<compilerflag value="value" />
  • nvcc - This group is compiled with nvcc.
<nvcc />
  • objprefix - Sets the id prepended to generated object (.obj) name to allow alphabetical grouping of similar objects.
<objprefix value="prefix" />
  • precompiledheader - Use a precompiled header of given name when compiling the group.

    • name - the include used when precompiling these files (without the .h).
    • directory - the location of this file.
    • e.g. for #include <lib/Header.h>:

      • name="lib/Header"
      • directory="${haxelib:somelib}/include"
<precompiledheader name="name" dir="directory" />
  • file - Adds a file to the group, with optional attributes.

    • name - name of the file - may be absolute or relative to dir.
    • tags - overrides group tags. See Tags. (optional)
    • filterout - allows files to be skipped at compile-time if the named define exists. This is useful when the define is set sometime after the file list is parsed.
    • embed - causes the file to be embedded as an extern C++ const char * string constant of the specified name.
    • <depend name="..." /> (child node) - filename of additional dependency.
<file name="filename" tags="tag,tag1" filterout="define" embedName="embed" >
   <depend name="filename1" />
   <depend name="filename2" />
</file>