Skip to content

build: replace build.py with Conan 2 + CMakePresets build system#8734

Draft
mc-nv wants to merge 2 commits intomainfrom
mchornyi/TRI-122/conan-next
Draft

build: replace build.py with Conan 2 + CMakePresets build system#8734
mc-nv wants to merge 2 commits intomainfrom
mchornyi/TRI-122/conan-next

Conversation

@mc-nv
Copy link
Copy Markdown
Contributor

@mc-nv mc-nv commented Apr 13, 2026

Resolves: TRI-122
triton-inference-server/backend#123
triton-inference-server/common#154
triton-inference-server/core#490
triton-inference-server/third_party#74

Description

Replaces the legacy build.py script with a Conan 2 package manager and CMakePresets-based build system for the main server repository. Adds Conan recipes for internal dependencies (cnmem, dcgm, libevhtp), build presets for all target platforms/architectures, and migrates CMakeLists.txt to use Conan-provided imported targets.

Changes

  • build: replace build.py with Conan 2 + CMakePresets build system

Affected Files

  • CMakeLists.txt
  • CMakePresets.json
  • build.py.legacy
  • cmake/CMakePresets.json
  • cmake/TritonCheckCxxAbi.cmake
  • cmake/presets/ (platform-specific presets for all targets)
  • conan/profiles/ (linux-gcc13 release/debug profiles)
  • conan/recipes/cnmem/conanfile.py
  • conan/recipes/dcgm/conanfile.py
  • conan/recipes/libevhtp/conanfile.py
  • conanfile.py
  • requirements.txt
  • src/CMakeLists.txt
  • src/test/CMakeLists.txt

Retire the build.py / ExternalProject / third_party workflow.  Every
external dependency is now resolved through Conan 2 (private NVIDIA
Artifactory remote or Conan Center).  Internal Triton repos (common,
core, backend) are consumed as local add_subdirectory checkouts whose
paths are set by conanfile.py or overridden on the cmake command line.

New files:
- conanfile.py: server dependency manifest (grpc, protobuf, re2, boost,
  libevent, libevhtp, prometheus-cpp, gtest, nlohmann_json, …)
- requirements.txt: Python wheel deps (tritonfrontend, tritonserver)
- CMakePresets.json: thin include wrapper (points to cmake/presets/)
- cmake/CMakePresets.json: aggregated include list for all platform files
- cmake/presets/CMakePresets.TritonInferenceServer.*.json (6 presets):
  Release targets for CPU/CUDA × Ubuntu/manylinux × x86_64/aarch64
- cmake/presets/CMakePresets.TritonClient.*.json (6 presets): client variants
- cmake/presets/CMakePresets.TritonPerfAnalyzer.*.json (2 presets)
- cmake/presets/CMakePresets.TritonVLLMBackend.*.json (1 preset)
- cmake/presets/CMakePresets.TritonTRTLLMBackend.*.json (2 presets)
- conan/profiles/linux-gcc13-{release,debug,-aarch64,-manylinux,…}: build profiles
- conan/recipes/{libevhtp,cnmem,dcgm}/conanfile.py: custom Conan recipes
- build.py → build.py.legacy: retired (kept for reference)

Modified files:
- CMakeLists.txt: replace ExternalProject/FetchContent with
  add_subdirectory for sibling repos; add triton_add_backend /
  triton_add_plugin macros; add FetchContent compatibility shims so
  existing ${repo-core_SOURCE_DIR} references in test targets still resolve
- src/CMakeLists.txt: replace legacy Find-module variable refs with Conan
  imported targets (libevent::*, opentelemetry-cpp::*, AWSSDK::*);
  add rapidjson to simple target; fix relative ldscript path → absolute
- src/test/CMakeLists.txt: use libevent::core + libevent::extra instead of
  ${LIBEVENT_LIBRARIES}; drop ${LIBEVENT_INCLUDE_DIRS} (propagated via
  target interface)
- src/test/*/CMakeLists.txt (7 files): fix relative --version-script paths
  to ${CMAKE_CURRENT_BINARY_DIR}/... for Ninja compatibility
- .gitignore: exclude CMakeUserPresets.json (generated by conan install)

Developer workflow:
  conan install server/ \
    --profile:host=server/conan/profiles/linux-gcc13-release \
    --profile:build=server/conan/profiles/linux-gcc13-release \
    -o '&:enable_gpu=False' --build=missing \
    --output-folder=server/build/<preset>/conan
  cmake --preset triton-inference-server-release-cpu-ubuntu-x86_64
  cmake --build --preset triton-inference-server-release-cpu-ubuntu-x86_64

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set CMAKE_CUDA_RUNTIME_LIBRARY=Shared in server/src and all CUDA
  preset JSONs so libtritonserver.so links libcudart.so dynamically,
  matching the production container (libcudart.so.13).

- Move all find_package() calls before add_subdirectory(core) in
  CMakeLists.txt so cnmem::cnmem and DCGM::dcgm imported targets
  exist when core/src/CMakeLists.txt evaluates if(TARGET cnmem::cnmem).

- Update dcgm/conanfile.py to search /usr/include and
  /usr/lib/x86_64-linux-gnu in addition to /usr/local/dcgm so the
  apt-installed datacenter-gpu-manager package is found correctly.

- Add rapidjson to memory_alloc example link libraries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant