xpybuild.targets.native

Contains targets for compiling C and C++, and linking the resulting object files into a library or executable.

Also contains functors for adding the necessary suffix/prefix for these targets on the current platform:

exename

Functor that adds the suffix/prefix for an executable to a path (using the native.cxx.exenamefn option for this platform), for example: Link(exename('${OUTPUT_DIR}/myprogram'), ...)

objectname

Functor that adds the suffix/prefix for a C/C++ object file to a path (using the native.cxx.objnamefn option for this platform), for example: Cpp(objectname('${OUTPUT_DIR}/cpp_objects/myfile'), ...)

libname

Functor that adds the suffix/prefix for a dynamic library to a path (using the native.cxx.libnamefn option for this platform), for example: Link(libname('${OUTPUT_DIR}/mylibrary'), ...)

staticlibname

Functor that adds the suffix/prefix for a static library to a path (using the native.cxx.staticlibnamefn option for this platform), for example: Link(staticlibname('${OUTPUT_DIR}/mylibrary'), ...)

exename

xpybuild.targets.native.exename = <xpybuild.utils.functors.ComposableWrapper object>

Functor that adds the suffix/prefix for an executable to a path (using the native.cxx.exenamefn option for this platform), for example: Link(exename('${OUTPUT_DIR}/myprogram'), ...)

objectname

xpybuild.targets.native.objectname = <xpybuild.utils.functors.ComposableWrapper object>

Functor that adds the suffix/prefix for a C/C++ object file to a path (using the native.cxx.objnamefn option for this platform), for example: Cpp(objectname('${OUTPUT_DIR}/cpp_objects/myfile'), ...)

libname

xpybuild.targets.native.libname = <xpybuild.utils.functors.ComposableWrapper object>

Functor that adds the suffix/prefix for a dynamic library to a path (using the native.cxx.libnamefn option for this platform), for example: Link(libname('${OUTPUT_DIR}/mylibrary'), ...)

staticlibname

xpybuild.targets.native.staticlibname = <xpybuild.utils.functors.ComposableWrapper object>

Functor that adds the suffix/prefix for a static library to a path (using the native.cxx.staticlibnamefn option for this platform), for example: Link(staticlibname('${OUTPUT_DIR}/mylibrary'), ...)

Cpp

class xpybuild.targets.native.Cpp(object, source, includes=None, flags=None, dependencies=None, options=None)[source]

Bases: xpybuild.basetarget.BaseTarget

Target that compiles a C++ source file to a single object file.

Parameters
  • object – the object file to generate; see objectname.

  • source – a (list of) source files

  • includes

    a (list of) include directories, as strings or PathSets,

    each with a trailing slash; the directories in the native.include option are also added.

    If this target depends on some include files that are generated by another target, make sure it’s a directory target since all include directories must either exist before the build starts or be targets themselves. If specifying a subdirectory of a generated directory, do this using DirGeneratedByTarget. If you have a composite generated directory made up of several file targets, wrap them in TargetsWithinDir before passing as the includes parameter.

  • flags – a list of compiler flags in addition to those in the native.cxx.flags/native.c.flags option.

  • dependencies – a list of additional dependencies that need to be built before this target. Usually this is not needed.

  • options – DEPRECATED; use .option() instead

C

class xpybuild.targets.native.C(object, source, includes=None, flags=None, dependencies=None, options=None)[source]

Bases: xpybuild.targets.native.Cpp

Target that compiles a C source file to a single object file.

Parameters
  • object – the object file to generate; see objectname.

  • source – a (list of) source files

  • includes

    a (list of) include directories, as strings or PathSets,

    each with a trailing slash; the directories in the native.include option are also added.

    If this target depends on some include files that are generated by another target, make sure it’s a directory target since all include directories must either exist before the build starts or be targets themselves. If specifying a subdirectory of a generated directory, do this using DirGeneratedByTarget. If you have a composite generated directory made up of several file targets, wrap them in TargetsWithinDir before passing as the includes parameter.

  • flags – a list of compiler flags in addition to those in the native.cxx.flags/native.c.flags option.

  • dependencies – a list of additional dependencies that need to be built before this target. Usually this is not needed.

  • options – DEPRECATED; use .option() instead

Ar

class xpybuild.targets.native.Ar(bin, objects)[source]

Bases: xpybuild.basetarget.BaseTarget

Target that compiles .a archive files from collections of object files.

Parameters
  • bin – the output library

  • objects – a (list of) input objects