Skip to content

Conversation

@paulinus
Copy link
Contributor

@paulinus paulinus commented Nov 1, 2025

Add pyproject.toml making it possible to build the library via pip install -e .

paulinus and others added 6 commits October 31, 2025 23:02
This commit completes the migration from setup.py to a modern pyproject.toml-based
build system using scikit-build-core. The new system is standards-compliant and
works with any PEP 517 build tool (pip, uv, build, poetry, etc.).

## Changes Made

### Build System (pyproject.toml)
- Migrated from setup.py to pyproject.toml with scikit-build-core
- Updated CMake version requirement from 3.0 to 3.15
- Updated dependency versions for Python 3.13 compatibility:
  - joblib: 0.14.1 -> >=1.0.0 (fixes distutils deprecation)
  - pytest: 3.0.7 -> >=7.0.0
  - Changed all pinned dependencies to minimum version specifiers (>=)
- Configured wheel building with proper install directories

### CMake Configuration
- Added install() commands to all 8 C++ extension modules
- Fixed OpenCV dependency to only link required components (core, imgproc, calib3d)
- Eliminated unnecessary VTK dependency from OpenCV's viz module
- Updated minimum CMake version to 3.15
- Added proper component specification to avoid transitive dependencies

### Bug Fixes
- Added missing #include <cassert> to opensfm/src/geometry/triangulation.h
- Fixed compilation error with modern GCC versions

### Files Modified
- pyproject.toml: New build configuration
- opensfm/src/CMakeLists.txt: OpenCV component restrictions, CMake version
- opensfm/src/bundle/CMakeLists.txt: Added install() command
- opensfm/src/dense/CMakeLists.txt: Added install() command
- opensfm/src/features/CMakeLists.txt: Added install() command
- opensfm/src/geo/CMakeLists.txt: Added install() command
- opensfm/src/geometry/CMakeLists.txt: Added install() command
- opensfm/src/map/CMakeLists.txt: Added install() command
- opensfm/src/robust/CMakeLists.txt: Added install() command
- opensfm/src/sfm/CMakeLists.txt: Added install() command
- opensfm/src/geometry/triangulation.h: Added cassert include
- .gitignore: Added build artifacts

## Testing
- All 8 C++ extensions build successfully
- All 198 pytest tests pass
- Verified on Python 3.13.7 with GCC 15.2.1
- Tested with uv package manager
- No VTK runtime dependencies

## Benefits
- Modern, standards-compliant build system
- Tool-agnostic (works with pip, uv, build, poetry, etc.)
- Cleaner dependency management
- Better compatibility with modern Python versions
- Eliminates unnecessary dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@meta-cla meta-cla bot added the cla signed label Nov 1, 2025
Implement fallback mechanism to support both modern and legacy glog versions.
Modern glog (v0.5.0+) provides native CMake config files, but older systems
like Ubuntu 20.04 (glog 0.4.0) ship packages built with autotools that lack
these config files.

The build now attempts to use glog's native CMake config first, falling back
to a custom FindGlog.cmake module if the config is not available. Both paths
create the glog::glog imported target with the required GLOG_USE_GLOG_EXPORT
compile definition.

Changes:
- Add custom FindGlog.cmake with glog::glog target creation
- Implement CONFIG-first detection with FindModule fallback in CMakeLists.txt
- Update foundation and test libraries to use glog::glog target
- Add status messages indicating which detection method succeeded

This ensures compatibility across Ubuntu 20.04 (glog 0.4.0), Ubuntu 22.04+
(glog 0.6.0+), Arch Linux (glog 0.7.1), and custom glog installations.

Fixes build errors with modern glog that requires GLOG_USE_GLOG_EXPORT
definition when consuming the library.
@paulinus paulinus force-pushed the feat-new-build-system branch from 1559cf0 to 19d8c58 Compare November 2, 2025 17:16
@meta-codesync
Copy link

meta-codesync bot commented Nov 3, 2025

@paulinus has imported this pull request. If you are a Meta employee, you can view this in D86073943.

@meta-codesync
Copy link

meta-codesync bot commented Nov 3, 2025

@paulinus merged this pull request in 655d75c.

@paulinus paulinus deleted the feat-new-build-system branch November 4, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants