rezplugins.build_system.cmake

CMake-based build system

class rezplugins.build_system.cmake.CMakeBuildSystem(working_dir, opts=None, package=None, write_build_scripts=False, verbose=False, build_args=[], child_build_args=[])[source]

Bases: rez.build_system.BuildSystem

The CMake build system.

The ‘cmake’ executable is run within the build environment. Rez supplies a library of cmake macros in the ‘cmake_files’ directory; these are added to cmake’s searchpath and are available to use in your own CMakeLists.txt file.

The following CMake variables are available: - REZ_BUILD_TYPE: One of ‘local’, ‘central’. Describes whether an install

is going to the local packages path, or the release packages path.

  • REZ_BUILD_INSTALL: One of 0 or 1. If 1, an installation is taking place; if 0, just a build is occurring.

classmethod bind_cli(parser, group)[source]

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: 0>)[source]

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

  • 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

A dict containing the following information

build_systems = {'codeblocks': 'CodeBlocks - Unix Makefiles', 'eclipse': 'Eclipse CDT4 - Unix Makefiles', 'make': 'Unix Makefiles', 'mingw': 'MinGW Makefiles', 'ninja': 'Ninja', 'nmake': 'NMake Makefiles', 'xcode': 'Xcode'}
build_targets = ['Debug', 'Release', 'RelWithDebInfo']
classmethod child_build_system()[source]

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 is_valid_root(path, package=None)[source]

Return True if this build system can build the source in path.

classmethod name()[source]

Return the name of the build system, eg ‘make’.

schema_dict = {'build_system': Or('eclipse', 'codeblocks', 'make', 'nmake', 'mingw', 'xcode', 'ninja'), 'build_target': Or('Debug', 'Release', 'RelWithDebInfo'), 'cmake_args': [<class 'str'>], 'cmake_binary': Or(None, <class 'str'>), 'make_binary': Or(None, <class 'str'>)}
exception rezplugins.build_system.cmake.RezCMakeError(value=None)[source]

Bases: rez.exceptions.BuildSystemError

rezplugins.build_system.cmake.register_plugin()[source]