Manual build¶
Scripts only chains standard tools. This page describes them, for a build without the script, and the CMake options of the project, for a superbuild.
Without the script¶
Build¶
The build alone, against RAT installed under a prefix:
PYRAT_STUBS=1 uv build --wheel --python 3.14 -C cmake.define.CMAKE_PREFIX_PATH=/opt/rat
-C cmake.define.<NAME>=<VALUE> passes any CMake
definition (a vcpkg toolchain, a triplet, the options
below). PYRAT_STUBS=1 in the environment turns the
stubs on: it adds numpy and pybind11-stubgen to the build
requirements and sets PYRAT2_STUBS. pip install .
builds the same way.
pybind11 and scikit-build-core come from the isolated build
environment (pyproject.toml), never from vcpkg: a
vcpkg-installed pybind11 would bring vcpkg’s own Python,
and the module would be built for the wrong interpreter.
Repair¶
The wheel built above only holds pyRat. CMake lists the
directories of the libraries it links in
build/<wheel tag>/pyrat_runtime.json:
{
"runtime_dirs": [
"C:/path/to/rat/bin",
"C:/path/to/vcpkg_installed/x64-windows-release/bin",
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/x64"
],
"mkl_bin": null
}
mkl_bin is the directory of an MKL found outside vcpkg
(Windows only). Give these directories to the repair tool:
For Windows:
uvx delvewheel repair <wheel> -w wheelhouse --add-path "<dir1>;<dir2>;..."
For Linux:
LD_LIBRARY_PATH="<dir1>:<dir2>:$LD_LIBRARY_PATH" uvx --with patchelf auditwheel repair <wheel> -w wheelhouse
For macOS:
DYLD_LIBRARY_PATH="<dir1>:<dir2>:$DYLD_LIBRARY_PATH" uvx --from delocate delocate-wheel -w wheelhouse <wheel>
With an MKL from oneAPI on Windows, delvewheel also needs MKL’s
CPU kernels (--include) and the MKL names kept
(--no-mangle): the script works these out, which is a good
reason to use it.
CMake options¶
Option |
Default |
Meaning |
|---|---|---|
|
|
Build the bindings of one Rat library each, and define the
preprocessor macro of the same name for the sources.
Dependencies are switched on as needed (Models needs MLFMM and
Math; Distmesh, Materials, Math and MLFMM need Common). In
rat-all, |
|
|
Generate the |
|
|
|
|
|
Install the module with |
|
|
Precompile the prelude header every source includes first. |
|
|
|
|
detected |
CUDA major version RAT was built with, reported by the module; empty without CUDA. |
|
empty |
Extra runtime library directories ( |
|
the build’s Python |
Interpreter that runs the tests: it needs numpy, and the same minor version as the module. |
In a superbuild¶
rat-all configures pyRat with add_subdirectory: the
module is built next to RAT, not installed, and with
PYRAT2_BUILD_TESTING the CTest suite checks that the
bindings still match the RAT libraries. The build tree is
not a wheel: to import the module from it on Windows, point
PYRAT_DLL_DIRS at the RAT, vcpkg, CUDA and MKL DLL
directories (os.pathsep-separated); import pyrat adds
them with os.add_dll_directory before loading the module.
The CTest tests set it themselves.