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:
Functor that adds the suffix/prefix for an executable to a path (using the |
|
Functor that adds the suffix/prefix for a C/C++ object file to a path (using the |
|
Functor that adds the suffix/prefix for a dynamic library to a path (using the |
|
Functor that adds the suffix/prefix for a static library to a path (using the |
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.exenamefnoption 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.objnamefnoption 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.libnamefnoption 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.staticlibnamefnoption 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.BaseTargetTarget 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.includeoption 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.flagsoption.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.CppTarget 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.includeoption 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.flagsoption.dependencies – a list of additional dependencies that need to be built before this target. Usually this is not needed.
options – DEPRECATED; use .option() instead
Link¶
-
class
xpybuild.targets.native.Link(bin, objects, libs=None, libpaths=None, shared=False, options=None, flags=None, dependencies=None)[source]¶ Bases:
xpybuild.basetarget.BaseTargetTarget that links object files (typically generated by
CpporC) to an executable or library binary.- Parameters
bin – the output binary. See
exename,libname,staticlibname.objects – a (list of) input object
libs – a (list of) libraries linked against (optional) in platform-neutral format. Can include list properties like ‘${FOO_LIB_NAMES[]}’.
libpaths – a (list of) additional library search directories (optional)
shared – if true compiles to a shared object (.dll or .so) (optional, defaults to false)
flags – a list of additional linker flags
options – [DEPRECATED - use .option() instead]
dependencies – a list of additional dependencies (targets or files)
Ar¶
-
class
xpybuild.targets.native.Ar(bin, objects)[source]¶ Bases:
xpybuild.basetarget.BaseTargetTarget that compiles .a archive files from collections of object files.
- Parameters
bin – the output library
objects – a (list of) input objects