rapids_cython_create_modules

Added in version v24.02.00.

Generate C(++) from Cython and create Python modules.

rapids_cython_create_modules([CXX]
                             [SOURCE_FILES <src1> <src2> ...]
                             [LINKED_LIBRARIES <lib1> <lib2> ... ]
                             [INSTALL_DIR <install_path>]
                             [MODULE_PREFIX <module_prefix>]
                             [ASSOCIATED_TARGETS <target1> <target2> ...])

Creates a Cython target for each provided source file, then adds a corresponding Python extension module. Each built library has its RPATH set to $ORIGIN.

Note

Requires rapids_cython_init() to be called before usage.

CXX

Flag indicating that the Cython files need to generate C++ rather than C.

SOURCE_FILES

The list of Cython source files to be built into Python extension modules. Note that this function assumes that Cython source files have a one-to-one correspondence with extension modules to build, i.e. for every <Name>.pyx in SOURCE_FILES we assume that <Name>.pyx is a Cython source file for which an extension module <Name> should be built.

LINKED_LIBRARIES

The list of libraries that need to be linked into all modules. In RAPIDS, this list usually contains (at minimum) the corresponding C++ libraries.

INSTALL_DIR

The path relative to the installation prefix so that it can be converted to an absolute path in a relocatable way. If not provided, defaults to the path to CMAKE_CURRENT_SOURCE_DIR relative to PROJECT_SOURCE_DIR.

MODULE_PREFIX

A prefix used to name the generated library targets. This functionality is useful when multiple Cython modules in different subpackages of the the same project have the same name. The default prefix is the empty string.

ASSOCIATED_TARGETS

A list of targets that are associated with the Cython targets created in this function. The target to associated target mapping is stored and may be leveraged by the following functions:

  • rapids_cython_add_rpath_entries() accepts a path for an associated target and updates the RPATH of each target with which that associated target is associated.

Result Variables

RAPIDS_CYTHON_CREATED_TARGETS will be set to a list of targets created by this function.