Build Reference

Xnt has several “build” modules to aid you in your compliation and project/ sub-project build steps

Make

Apache Ant

xnt.build.make.ant(target, path='', flags=None, pkeys=None, pvalues=None)

Wrapper around Apache Ant

Invoke Apache Ant in either the current working directory or the specified directory using the specified target, passing a list of flags to the invocation. Where flags is a list of valid flags for ant.

pkeys and pvalues are zipped to form a key/value pair passed to Ant as property values

Parameters:
  • target – Ant Target to execute
  • path – Path of the Ant build file if different than current directory
  • flags – List of flags to pass to Ant
  • pkeys – List of keys to combine with pvalues to pass to Ant
  • pvalues – List of values to combine with pkeys to pass to Ant

Gnu Make

xnt.build.make.make(target, path='', flags=None, pkeys=None, pvalues=None)

Wrapper around GNU Make

Invoke Gnu Make (make) in either the current working directory or the specified directory using the specified target, passing a list of flags to the invocation. Where flags is a list of valid flags for make.

pkeys and pvalues are zipped together to form a key/value pair that are passed to Make as property values.

Parameters:
  • target – Make Target to execute
  • path – Path of the make file if different than current directory
  • flags – List of flags to pass to make
  • pkeys – List of keys, zipped with pvalues, to pass to Make
  • pvalues – List of values, zipped with pkeys, to pass to Make

(.NET)Ant

xnt.build.make.nant(target, path='', flags=None, pkeys=None, pvalues=None)

Wrapper around .NET Ant

Invoke NAnt in either the current working directory or the specified directory using the specified target, passing a list of flags to the invocation. Where flags is a list of valid flags for nant.

pkeys and pvalues are zipped together to form a key/ value pair to pass to NAnt as property values.

Parameters:
  • target – NAnt Target to execute
  • path – Path of NAnt build file, if different than current directory
  • flags – List of flags to pass to NAnt
  • pkeys – List of keys, zipped with pvalues, to pass to NAnt
  • pvalues – List of values, zipped with pkeys, to pass to NAnt

Compiler Collection

For all compilers so far, Xnt assumes they are installed and in your $PATH. If they are not, an error will be thrown (by subprocess)

gcc/g++

xnt.build.cc.gcc(src, flags=None)

gcc compiler, non-named output file

Parameters:
  • src – C source file to compile with default gcc
  • flags – List of flags to pass onto the compiler
xnt.build.cc.gcc_o(src, output, flags=None)

gcc compiler, with output file

Parameters:
  • src – C source file to compile with default gcc
  • output – Name of resulting object or executable
  • flags – List of flags to pass onto the compiler
xnt.build.cc.gpp(src, flags=None)

g++ compiler, non-named output file

Parameters:
  • src – C++ source file to compile with default g++
  • flags – List of flags to pass onto the compiler
xnt.build.cc.gpp_o(src, output, flags=None)

g++ compiler, with output file

Parameters:
  • src – C++ source file to compile with default g++
  • output – Name of resulting object or executable
  • flags – List of flags to pass onto the compiler

Javac

xnt.build.cc.javac(src, flags=None)

Javac: compile Java programs

Parameters:
  • src – Java source file to compile with default javac
  • flags – List of flags to pass onto the compiler

NVCC

xnt.build.cc.nvcc(src, flags=None)

NVCC: compile CUDA C/C++ programs

Parameters:
  • src – CUDA source file to compile with default nvcc
  • flags – List of flags to pass onto the compiler
xnt.build.cc.nvcc_o(src, output, flags=None)

NVCC: compile with named output

Parameters:
  • src – CUDA source file to compile with default nvcc
  • output – Name of resulting object or executable
  • flags – List of flags to pass onto the compiler

Notes

Default out

Most, if not all, compilers have a default name given to compiled binaries when no output file name is given. For example, gcc will give code with a main method a name of a.out or %.o for objects, and so on. javac defaults to <class-name>.class.

Recompile

At the current moment, all compile wrappers do not do “smart” checks for compilation. That is, all compile steps will rebuild regardless if the binary file is modified later than the source file. This would be a nice feature, but I fear it would be too expensive (complicated) and out of the scope of this project to implement correctly.

Tex

Building LaTeX documents can be confusing and sometimes tricky to do correctly.

xnt.build.tex.pdflatex(document, path='./', bibtex=False, makeglossary=False)

Generate PDF LaTeX Document

Use pdflatex to build a LaTeX PDF document. Can optionally execute steps to properly build bibtex references and/ or glossaries.

Parameters:
  • document – Name of tex file (with or without .tex extension)
  • path – Directory of tex file, if different than current directory
  • bibtex – Flag to or not to add bibtex. Default: False
  • makeglossary – Flag to or not to add a glossary. Default: False
xnt.build.tex.clean(path='./', remove_pdf=False)

Clean up generated files of PDF compilation

Parameters:
  • path – Directory of output files, if different than current directory
  • remove_pdf – Flag to remove the PDF. Default: False

Table Of Contents

Previous topic

Task Reference

Next topic

xnt.build.cc

This Page