pip install -e .
This tells pip to:
- Perform an editable install of the current project.
- Use the
pyproject.tomlas the single source of truth for building and packaging.
It sees:
[build-system]
build-backend = "scikit_build_core.build"
So pip uses scikit-build-core as the build backend (instead of legacy setuptools).
It starts a CMake build, just like if you had run:
cmake -S . -B build
cmake --build build
It uses the CMakeLists.txt at the project root, which:
-
Declares the project:
project(rcs LANGUAGES C CXX VERSION 0.4.0) -
Sets modern C++20 and compiler policies.
-
Locates external dependencies:
Eigen3,Python3,MuJoCo,pinocchio
-
Downloads with
FetchContent:rl,pybind11 -
Includes:
add_subdirectory(src)
add_subdirectory(rcs)
target_include_directories(rcs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(sim)
add_subdirectory(pybind)
This loads and builds 3 subcomponents.
add_library(rcs SHARED)
target_sources(rcs PRIVATE Pose.cpp Robot.cpp IK.cpp utils.cpp)
target_link_libraries(rcs PUBLIC Eigen3::Eigen mdl pinocchio::all)
- Builds a shared C++ library:
rcs - Contains your robot control logic
- Exposes
include/headers - Linked against external libraries
add_library(sim)
target_sources(sim PRIVATE sim.cpp SimRobot.cpp ...)
target_link_libraries(sim PUBLIC rcs MuJoCo::MuJoCo)
- Builds a C++ simulation library
- Depends on:
- Your own
rcslibrary - MuJoCo physics engine
- Your own
pybind11_add_module(_core MODULE rcs.cpp)
target_link_libraries(_core PRIVATE sim rcs)
-
Compiles a Python extension module:
_core.so -
Uses
pybind11to bind C++ classes/functions -
Links to both
simandrcsnative libraries -
Adds install instructions:
install(TARGETS _core rcs DESTINATION rcs COMPONENT python_package)
From pyproject.toml:
[tool.scikit-build]
build.targets = ["_core", "scenes", "rcs"]
wheel.packages = ["python/rcs"]
install.components = ["python_package"]
-
scikit-build-coreinstalls_core.sointo:python/rcs/_core.so -
That directory becomes a valid Python package
After install:
from rcs import _core
- You now access the C++ functionality exposed in
rcs.cppthrough Python. _corecontains Python-wrapped C++ objects/functions viapybind11.
pip install -e .
│
▼
Reads pyproject.toml (scikit_build_core used)
│
▼
CMakeLists.txt (root) → add_subdirectory(src)
│
▼
src/rcs → builds C++ library `rcs`
src/sim → builds C++ library `sim`
src/pybind → builds Python extension `_core`
│
▼
All .so libraries installed in `python/rcs/`
`_core` accessible from Python as import
| Layer | Role | Tool |
|---|---|---|
pyproject.toml |
Project metadata, build backend | pip, scikit-build-core |
CMakeLists.txt (root) |
Configure the full C++ build | CMake |
src/rcs |
Core robot logic in C++ | C++, Eigen, pinocchio |
src/sim |
Simulation logic, MuJoCo | C++, MuJoCo |
src/pybind |
Bindings to Python | pybind11 |
python/rcs/ |
Python package with compiled .so |
scikit-build, pip |