Module Extensions

Rules for building Module Extensions

Functions

py_cc_extension

load("@rules_venv//python/module_extension:defs.bzl", "py_cc_extension")

py_cc_extension(*, name, srcs, conlyopts, copts, cxxopts, data, defines, deps, dynamic_deps,
                imports, includes, linkopts, local_defines, malloc, compilation_mode, abi, stripped,
                **kwargs)

Define a Python C extension module.

This target is consumed just as a py_library would be.

PARAMETERS

NameDescriptionDefault Value
nameThe name of the target.none
srcshe list of C and C++ files that are processed to create the library target. These are C/C++ source and header files, either non-generated (normal source code) or generated. For more details see cc_binary.srcsnone
conlyoptsAdd these options to the C compilation command. For more details see cc_binary.conlyopts[]
coptsAdd these options to the C/C++ compilation command. For more details see cc_binary.copts[]
cxxoptsAdd these options to the C++ compilation command. For more details see cc_binary.cxxopts[]
dataList of files used by this rule at compile time and runtime. For more details see cc_binary.data[]
definesList of defines to add to the compile line of this and all dependent targets For more details see cc_binary.defines[]
depsThe list of other libraries to be linked in to the binary target. For more details see cc_binary.deps[]
dynamic_depsThese are other cc_shared_library dependencies the current target depends on. For more details see cc_binary.dynamic_deps[]
importsList of import directories to be added to the PYTHONPATH. For more details see py_library.imports.[]
includesList of include dirs to be added to the compile line. For more details see cc_binary.includes[]
linkoptsAdd these flags to the C++ linker command. For more details see cc_binary.linkopts[]
local_definesList of defines to add to the compile line. For more details see cc_binary.local_definesNone
mallocOverride the default dependency on malloc. For more details see cc_binary.mallocNone
compilation_modeThe compilation_mode value to build the extension for. If set to "current", the current configuration will be used."opt"
abiThe ABI value to use for the output library name.select({"@platforms//os:linux": "gnu", "//conditions:default": ""})
strippedUse the stripped output of the c extension for the library.None
kwargsAdditional keyword arguments for common definition attributes.none