Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rapids-logger #737

Merged
merged 12 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmake-format-rapids-cmake.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@
"INSTALL_EXPORT_SET": 1
}
},
"rapids_cpm_rapids_logger": {
"pargs": {
"nargs": 0
}
},
"rapids_cpm_nvbench": {
"pargs": {
"nargs": 0,
Expand Down
1 change: 1 addition & 0 deletions docs/packages/packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/packages/rapids_cpm_fmt
/packages/rapids_cpm_gbench
/packages/rapids_cpm_gtest
/packages/rapids_cpm_rapids_logger
/packages/rapids_cpm_nvbench
/packages/rapids_cpm_nvcomp
/packages/rapids_cpm_nvtx3
Expand Down
1 change: 1 addition & 0 deletions docs/packages/rapids_cpm_rapids_logger.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. cmake-module:: ../../rapids-cmake/cpm/rapids_logger.cmake
67 changes: 67 additions & 0 deletions rapids-cmake/cpm/rapids_logger.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#=============================================================================
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
include_guard(GLOBAL)

#[=======================================================================[.rst:
rapids_cpm_rapids_logger
------------------------

.. versionadded:: v25.02.00

Allow projects to build `rapids-logger` via `CPM`.

Uses the version of rapids-logger :ref:`specified in the version file <cpm_versions>` for consistency
across all RAPIDS projects.

Unlike most `rapids_cpm` functions, this one does not support export sets because rapids-logger adds targets directly to the calling project's own export set and does not require its own exporting or to be found at all by consuming projects once the first project's call to rapids_make_logger has completed.

.. code-block:: cmake

rapids_cpm_rapids_logger( [<CPM_ARGS> ...])

.. |PKG_NAME| replace:: logger
.. include:: common_package_args.txt

Result Functions
^^^^^^^^^^^^^^^^
:cmake:command:`rapids_make_logger` is made available

#]=======================================================================]
function(rapids_cpm_rapids_logger)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.rapids_logger")

set(options)
set(one_value)
set(multi_value)
cmake_parse_arguments(_RAPIDS "${options}" "${one_value}" "${multi_value}" ${ARGN})

include("${rapids-cmake-dir}/cpm/detail/package_details.cmake")
rapids_cpm_package_details(rapids_logger version repository tag shallow exclude)

include("${rapids-cmake-dir}/cpm/detail/generate_patch_command.cmake")
rapids_cpm_generate_patch_command(rapids_logger ${version} patch_command)

include("${rapids-cmake-dir}/cpm/find.cmake")
rapids_cpm_find(rapids_logger ${version} ${_RAPIDS_UNPARSED_ARGUMENTS}
CPM_ARGS
GIT_REPOSITORY ${repository}
GIT_TAG ${tag}
GIT_SHALLOW ${shallow} ${patch_command}
EXCLUDE_FROM_ALL ON)

include("${rapids-cmake-dir}/cpm/detail/display_patch_status.cmake")
rapids_cpm_display_patch_status(logger)
endfunction()
7 changes: 7 additions & 0 deletions rapids-cmake/cpm/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"git_url": "https://github.com/NVIDIA/cuCollections.git",
"git_tag": "096346b739da3fb1d9c3b402190c0a3a7e554440"
},
"rapids_logger": {
"version": "0.1.0",
"git_shallow": false,
"always_download": true,
"git_url": "https://github.com/rapidsai/rapids-logger",
"git_tag": "98cb4d232dc4612f80d462a0a7bc5490dbc22399"
vyasr marked this conversation as resolved.
Show resolved Hide resolved
},
"fmt": {
"version": "11.0.2",
"git_url": "https://github.com/fmtlib/fmt.git",
Expand Down
4 changes: 3 additions & 1 deletion testing/cpm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,6 +103,8 @@ add_cmake_config_test( cpm_gtest-simple.cmake )
add_cmake_config_test( cpm_gtest-static.cmake )
add_cmake_config_test( cpm_gtest-explicit-static.cmake )

add_cmake_config_test( cpm_logger-simple.cmake )

add_cmake_config_test( cpm_nvbench-export.cmake SERIAL)
add_cmake_config_test( cpm_nvbench-simple.cmake SERIAL)
add_cmake_config_test( cpm_nvbench-already-found-fmt.cmake SERIAL)
Expand Down
48 changes: 48 additions & 0 deletions testing/cpm/cpm_logger-simple.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#=============================================================================
# Copyright (c) 2022-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
include(${rapids-cmake-dir}/cpm/init.cmake)
include(${rapids-cmake-dir}/cpm/rapids_logger.cmake)

rapids_cpm_init()
rapids_cpm_rapids_logger()

set(logger_namespace rapids)
set(logger_target "${logger_namespace}_logger")
set(logger_impl_target "${logger_namespace}_logger_impl")

rapids_make_logger("${logger_namespace}")

function(check_target target)
if(NOT TARGET "${target}")
message(FATAL_ERROR "Target ${target} was not created.")
endif()
endfunction()

function(check_file fn)
if(NOT EXISTS "${fn}")
message(FATAL_ERROR "File ${fn} was not created.")
endif()
endfunction()

check_target("${logger_target}")
check_target("${logger_impl_target}")
check_target("${logger_namespace}::${logger_target}")
check_target("${logger_namespace}::${logger_impl_target}")

set(base_dir "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${logger_namespace}")
check_file("${base_dir}/logger.hpp")
check_file("${base_dir}/logger_impl/logger_impl.hpp")
check_file("${base_dir}/logger_impl/logger.cpp")
4 changes: 3 additions & 1 deletion testing/utils/fill_cache/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@ include(${rapids-cmake-dir}/cpm/cccl.cmake)
include(${rapids-cmake-dir}/cpm/cuco.cmake)
include(${rapids-cmake-dir}/cpm/gbench.cmake)
include(${rapids-cmake-dir}/cpm/gtest.cmake)
include(${rapids-cmake-dir}/cpm/rapids_logger.cmake)
include(${rapids-cmake-dir}/cpm/nvbench.cmake)
include(${rapids-cmake-dir}/cpm/nvcomp.cmake)
include(${rapids-cmake-dir}/cpm/nvtx3.cmake)
Expand All @@ -38,6 +39,7 @@ rapids_cpm_cccl(DOWNLOAD_ONLY ON)
rapids_cpm_cuco(DOWNLOAD_ONLY ON)
rapids_cpm_gbench(DOWNLOAD_ONLY ON)
rapids_cpm_gtest(DOWNLOAD_ONLY ON)
rapids_cpm_rapids_logger(DOWNLOAD_ONLY ON)
rapids_cpm_nvbench(DOWNLOAD_ONLY ON)
rapids_cpm_nvtx3(DOWNLOAD_ONLY ON)
rapids_cpm_rmm(DOWNLOAD_ONLY ON)
Expand Down
Loading