Skip to content

Finish pybind11 dependence removal - #227

Merged
michael-petersen merged 2 commits into
develfrom
pybind11-disable
Jul 27, 2026
Merged

Finish pybind11 dependence removal#227
michael-petersen merged 2 commits into
develfrom
pybind11-disable

Conversation

@michael-petersen

Copy link
Copy Markdown
Member

This pull request improves support for disabling the Python development environment by making the build system respect the DISABLE_PYTHON option throughout the CMake configuration. The changes ensure that Python-related dependencies and targets are only included when Python support is enabled, resulting in a cleaner and more robust build process when Python is not required.

Build system improvements for Python support:

  • Added logic in CMakeLists.txt to set ENABLE_PYEXP to OFF and print a status message when DISABLE_PYTHON is enabled, preventing the build of Python-related components.
  • Conditionalized inclusion of pybind11 headers and subdirectory in the main CMakeLists.txt and only add them if Python is not disabled.
  • Updated exputil/CMakeLists.txt to only link against pybind11::embed if Python support is enabled, avoiding unnecessary dependencies.

Test utilities adjustments:

  • Modified utils/Test/CMakeLists.txt to only add and link the testEmp executable (and its dependencies) if Python is enabled, ensuring test targets are consistent with the build configuration.

Minor code improvement:

  • Added a missing #include <cassert> in exputil/realize_model.cc for improved code safety and correctness.

Copilot AI review requested due to automatic review settings July 25, 2026 15:45
@michael-petersen

Copy link
Copy Markdown
Member Author

This PR helps the work started by @Leengit, if you'd also like to take a look?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CMake build to better support configurations where the Python development environment is disabled (DISABLE_PYTHON=ON), by conditionally excluding Python-related dependencies/targets and adjusting one C++ source include.

Changes:

  • Gate inclusion of the extern/pybind11 subdirectory and headers on DISABLE_PYTHON.
  • Avoid linking pybind11::embed (and avoid building/linking the testEmp test utility) when Python is disabled.
  • Add a missing <cassert> include in exputil/realize_model.cc.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
CMakeLists.txt Adds DISABLE_PYTHON handling and conditionally includes/adds extern/pybind11.
exputil/CMakeLists.txt Conditionally links pybind11::embed only when Python is not disabled.
utils/Test/CMakeLists.txt Conditionally builds/links testEmp only when Python is not disabled.
exputil/realize_model.cc Adds <cassert> include to support existing assert(...) usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CMakeLists.txt
@The9Cat

The9Cat commented Jul 25, 2026

Copy link
Copy Markdown
Member

Do we have a use case for the resulting build that can be tested and verified? @Leengit may have already done this?

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@michael-petersen

Copy link
Copy Markdown
Member Author

I've built this version of the code on tursa, which has effective no Python (a version so old it can't handle pybind11). So I think that's sufficient testing, unless we get any external input.

@The9Cat

The9Cat commented Jul 27, 2026

Copy link
Copy Markdown
Member

Agreed.

@michael-petersen
michael-petersen merged commit 40ab8e9 into devel Jul 27, 2026
8 checks passed
@michael-petersen
michael-petersen deleted the pybind11-disable branch July 27, 2026 13:10
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.

3 participants