rapidsai / cudf

cuDF - GPU DataFrame Library
https://docs.rapids.ai/api/cudf/stable/
Apache License 2.0
8.31k stars 886 forks source link

[Feature Request] Make fmt and spdlog Optional with a -D_USE_EXTERNAL_SPDLOG_FMT Flag #16951

Open ava6969 opened 2 days ago

ava6969 commented 2 days ago
if (USE_EXTERNAL_SPDLOG_FMT)
  find_package(fmt CONFIG REQUIRED)
  find_package(spdlog CONFIG REQUIRED)
else()
  include(cmake/thirdparty/get_fmt.cmake)
  include(cmake/thirdparty/get_spdlog.cmake)
endif()

This feature proposes adding the ability to optionally use externally provided versions of fmt and spdlog by introducing a CMake flag: -D_USE_EXTERNAL_SPDLOG_FMT. When this flag is set, the build system will skip downloading or configuring fmt and spdlog via rapids-cmake and instead rely on external installations, such as those installed via package managers like vcpkg or system-level package management. Key Benefits: Flexibility: Allows developers to integrate pre-existing installations of fmt and spdlog, avoiding redundant or conflicting installations. Compatibility: This makes it easier for projects that already manage dependencies using systems like vcpkg or Conan to integrate with RMM without modifying dependency configurations. Customization: Developers can control and customize the versions of fmt and spdlog used in the build process.

Proposed Changes: Introduce a new CMake option: -D_USE_EXTERNAL_SPDLOG_FMT=ON. When the flag is set to ON, CMake will use find_package(spdlog) and find_package(fmt) to locate the external installations instead of using rapids-cmake to fetch and configure them. If the flag is not set, the current behavior of using rapids-cmake to fetch spdlog and fmt will be maintained, ensuring backward compatibility.

Use Case Example: Developers who have installed spdlog and fmt via vcpkg or other package managers can configure the project as follows:

cmake .. -D_USE_EXTERNAL_SPDLOG_FMT=ON \
  -DCMAKE_PREFIX_PATH=/path/to/external/installations \
  -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake

This setup will automatically link the external versions of spdlog and fmt during the build process.

bdice commented 2 days ago

Thanks for the issue! There is a related discussion about removing spdlog from RAPIDS public APIs here: https://github.com/rapidsai/build-planning/issues/104