Skip to content

Conversation

@eclipse0922
Copy link
Contributor

@eclipse0922 eclipse0922 commented Dec 12, 2025

This PR adds native vcpkg support to Open3D, enabling easier builds with vcpkg-managed dependencies.

Note: This is Phase 1 of vcpkg support - upstream changes to Open3D's build system. Phase 2 (creating the actual vcpkg port in microsoft/vcpkg) will follow after this PR is merged.

Changes

  • Add vcpkg toolchain auto-detection in CMakeLists.txt
  • Auto-enable USE_SYSTEM_* options when vcpkg is detected
  • Fix find_package() for vcpkg compatibility:
    • jsoncpp: Add JsonCpp::JsonCpp target (vcpkg naming)
    • curl: Use find_package(CURL) instead of pkg-config
    • zeromq: Use find_package(ZeroMQ) instead of pkg-config
    • minizip: Use find_package(unofficial-minizip) instead of pkg-config
  • Fix CURL_STATICLIB redefinition warning in Download.cpp
  • Add vcpkg.json manifest for dependency specification
  • Fix typo: USE_USE_SYSTEM_ZEROMQ -> USE_SYSTEM_ZEROMQ
  • Update stdgpu for CUDA 13 support (cccl/thrust path change)

All changes are backwards compatible - non-vcpkg builds work as before.

Roadmap for Full vcpkg Support

Phase Description Status
Phase 1 Upstream changes to Open3D (this PR) 🔄 In Progress
Phase 2 Create vcpkg port in microsoft/vcpkg ⏳ Pending Phase 1
Phase 3 Add GUI support (requires Filament port) ⏳ Future

Note: CUDA is supported in Phase 1 - just install CUDA Toolkit separately and use -DBUILD_CUDA_MODULE=ON

Type

Motivation and Context

vcpkg is a popular C++ package manager used by many developers, but Open3D has lacked native vcpkg support since 2019 (#767). Previous attempts (microsoft/vcpkg#17423) failed due to pkg-config path issues and missing CMake target compatibility.

This PR enables Open3D to build seamlessly with vcpkg-managed dependencies by:

  1. Auto-detecting vcpkg toolchain and enabling system dependencies
  2. Fixing find_package() compatibility for vcpkg's CMake targets
  3. Providing a vcpkg.json manifest for easy dependency management

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

Changes Made

File Change
CMakeLists.txt vcpkg auto-detection + auto-enable USE_SYSTEM_*
3rdparty/find_dependencies.cmake Fix find_package() for jsoncpp, curl, zeromq, minizip
3rdparty/stdgpu/stdgpu.cmake Update stdgpu for CUDA 13 cccl/thrust path support
cpp/open3d/utility/Download.cpp Fix CURL_STATICLIB redefinition
vcpkg.json New manifest file for vcpkg dependencies

Test Results

Successfully built on Ubuntu 22.04 with vcpkg:

# Without CUDA
cmake -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake \
      -DBUILD_PYTHON_MODULE=OFF -DBUILD_GUI=OFF ..
cmake --build . --parallel 16
# [100%] Built target Open3D

# With CUDA 13
cmake -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake \
      -DBUILD_PYTHON_MODULE=OFF -DBUILD_GUI=OFF -DBUILD_CUDA_MODULE=ON ..
cmake --build . --parallel 16
# [100%] Built target Open3D

Current Scope (Phase 1)

  • ✅ C++ core library
  • ✅ Basic 3D processing (point clouds, meshes, IO)
  • ✅ CUDA support (tested with CUDA 13 - requires CUDA Toolkit installed separately)
  • ❌ GUI (requires Filament - not in vcpkg)
  • ❌ Python bindings (not needed for vcpkg C++ port)

Dependencies from vcpkg (verified working)

assimp, curl, eigen3, fmt, glew, glfw3, jpeg, jsoncpp, msgpack, nanoflann, openssl, png, qhull, tbb, tinyobjloader, zeromq, cppzmq, minizip

Backwards Compatibility

All changes include fallbacks - non-vcpkg builds work exactly as before.

Next Steps After This PR

  1. Merge this PR
  2. Create vcpkg port PR at microsoft/vcpkg
  3. (Future) Add Filament vcpkg port for GUI support

This PR adds native vcpkg support to Open3D, enabling easier builds with
vcpkg-managed dependencies.

Changes:
- Add vcpkg toolchain auto-detection in CMakeLists.txt
- Auto-enable USE_SYSTEM_* options when vcpkg is detected
- Fix find_package() for vcpkg compatibility:
  - jsoncpp: Add JsonCpp::JsonCpp target (vcpkg naming)
  - curl: Use find_package(CURL) instead of pkg-config
  - zeromq: Use find_package(ZeroMQ) instead of pkg-config
  - minizip: Use find_package(unofficial-minizip) instead of pkg-config
- Fix CURL_STATICLIB redefinition warning in Download.cpp
- Add vcpkg.json manifest for dependency specification
- Fix typo: USE_USE_SYSTEM_ZEROMQ -> USE_SYSTEM_ZEROMQ

All changes are backwards compatible - non-vcpkg builds work as before.

Usage with vcpkg:
  cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake \
        -DBUILD_PYTHON_MODULE=OFF -DBUILD_GUI=OFF ..
@update-docs
Copy link

update-docs bot commented Dec 12, 2025

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

CUDA 13 moved thrust/cub/libcudacxx to cccl/ subdirectory. This update:
- Updates stdgpu to latest master (133f9e20) with CUDA 13 detection
- Removes THRUST_INCLUDE_DIR override to allow stdgpu auto-detection

The new stdgpu version automatically appends /cccl to include paths for
CUDA 13+ when CMake < 3.31.9.
@eclipse0922 eclipse0922 marked this pull request as ready for review December 12, 2025 05:47
@eclipse0922 eclipse0922 marked this pull request as draft December 12, 2025 09:31
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.

Add vcpkg support

1 participant