rez.build_system#
- rez.build_system.get_buildsys_types()#
Returns the available build system implementations - cmake, make etc.
- rez.build_system.get_valid_build_systems(working_dir, package=None)#
Returns the build system classes that could build the source in given dir.
- Parameters:
working_dir (str) – Dir containing the package definition and potentially build files.
package (Package) – Package to be built. This may or may not be needed to determine the build system. For eg, cmake just has to look for a CMakeLists.txt file, whereas the ‘build_command’ package field must be present for the ‘custom’ build system type.
- Returns:
Valid build system class types.
- Return type:
- rez.build_system.create_build_system(working_dir, buildsys_type=None, package=None, opts=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[])#
Return a new build system that can build the source in working_dir.
- class rez.build_system.BuildSystem#
Bases:
object
A build system, such as cmake, make, Scons etc.
- classmethod name()#
Return the name of the build system, eg ‘make’.
- __init__(working_dir, opts=None, package=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[])#
Create a build system instance.
- Parameters:
working_dir – Directory to build source from.
opts – argparse.Namespace object which may contain constructor params, as set by our bind_cli() classmethod.
package (DeveloperPackage) – Package to build. If None, defaults to the package in the working directory.
write_build_scripts – If True, create build scripts rather than perform the full build. The user can then run these scripts to place themselves into a build environment and invoke the build system directly.
build_args – Extra cli build arguments.
child_build_args – Extra cli args for child build system, ignored if there is no child build system.
- classmethod is_valid_root(path)#
Return True if this build system can build the source in path.
- classmethod child_build_system()#
Returns the child build system.
Some build systems, such as cmake, don’t build the source directly. Instead, they build an interim set of build scripts that are then consumed by a second build system (such as make). You should implement this method if that’s the case.
- Returns:
Name of build system (corresponding to the plugin name) if this system has a child system, or None otherwise.
- classmethod bind_cli(parser, group)#
Expose parameters to an argparse.ArgumentParser that are specific to this build system.
- Parameters:
parser (ArgumentParser) – Arg parser.
group (ArgumentGroup) – Arg parser group - you should add args to this, NOT to parser.
- build(context, variant, build_path, install_path, install=False, build_type=BuildType.local)#
Implement this method to perform the actual build.
- Parameters:
context – A ResolvedContext object that the build process must be executed within.
variant (Variant) – The variant being built.
build_path – Where to write temporary build files. May be absolute or relative to working_dir.
install_path (str) – The package repository path to install the package to, if installing. If None, defaults to config.local_packages_path.
install – If True, install the build.
build_type – A BuildType (i.e local or central).
- Returns:
A dict containing the following information:
success: Bool indicating if the build was successful.
extra_files: List of created files of interest, not including build targets. A good example is the interpreted context file, usually named ‘build.rxt.sh’ or similar. These files should be located under build_path. Rez may install them for debugging purposes.
build_env_script: If this instance was created with write_build_scripts as True, then the build should generate a script which, when run by the user, places them in the build environment.
- Return type:
- classmethod set_standard_vars(executor, context, variant, build_type, install, build_path, install_path=None)#
Set some standard env vars that all build systems can rely on.
- classmethod add_pre_build_commands(executor, variant, build_type, install, build_path, install_path=None)#
Execute pre_build_commands function if present.
- classmethod add_standard_build_actions(executor, context, variant, build_type, install, build_path, install_path=None)#
Perform build actions common to every build system.