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.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
Link¶
-
class
xpybuild.targets.native.
Link
(bin, objects, libs=None, libpaths=None, shared=False, options=None, flags=None, dependencies=None)[source]¶ Bases:
xpybuild.basetarget.BaseTarget
Target that links object files (typically generated by
Cpp
orC
) 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.BaseTarget
Target that compiles .a archive files from collections of object files.
- Parameters
bin – the output library
objects – a (list of) input objects