Skip to content

[Caspar] Python bindings opt-out#459

Closed
tordnat wants to merge 9 commits into
symforce-org:mainfrom
tordnat:tordnat/caspar-pybindings-optout
Closed

[Caspar] Python bindings opt-out#459
tordnat wants to merge 9 commits into
symforce-org:mainfrom
tordnat:tordnat/caspar-pybindings-optout

Conversation

@tordnat
Copy link
Copy Markdown
Contributor

@tordnat tordnat commented May 2, 2026

Projects embedding only the CXX/CUDA core of Caspar (e.g. via ExternalProject_Add) can now skip pybind11 entirely:

  • CasparLibrary.generate(..., python_bindings=False) skips generating pybinding.cc, caspar_mappings_pybinding.h, solver_pybinding.h, and .pyi stubs
  • The generated CMakeLists.txt omits the pybind11 find/fetch block and pybind11_add_module target entirely when python_bindings=False
  • When python_bindings=True (default), a CASPAR_BUILD_PYTHON_BINDINGS CMake option is still emitted for compile-time opt-out
  • All existing callers are unaffected since the default is True

Blocked by #457 and requested by colmap/colmap#4018 such that we don't have to manually remove python bindings when regenerating.

Comment thread symforce/caspar/source/templates/buildfiles/CMakeLists.txt.jinja Outdated
@tordnat
Copy link
Copy Markdown
Contributor Author

tordnat commented May 4, 2026

New changes tested on bal example. Runs fine, but blocked by #458 since the pybinding fixes have not been applied to this branch yet. Added a new filter for linking which should avoid generating pybind headers as well:

if not python_bindings and "pybind" in f.name:
    continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants