From 73e7eba6eb4377262a3fc4666807120f562021c0 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 23 May 2024 06:44:53 +0000 Subject: [PATCH 1/4] record nvtx3 in build export set --- rapids-cmake/cpm/nvtx3.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rapids-cmake/cpm/nvtx3.cmake b/rapids-cmake/cpm/nvtx3.cmake index 06b6749d..865d1f13 100644 --- a/rapids-cmake/cpm/nvtx3.cmake +++ b/rapids-cmake/cpm/nvtx3.cmake @@ -98,6 +98,9 @@ function(rapids_cpm_nvtx3) EXPORT_SET nvtx3-targets GLOBAL_TARGETS nvtx3-c nvtx3-cpp NAMESPACE nvtx::) + rapids_export_package(BUILD nvtx3 ${_RAPIDS_BUILD_EXPORT_SET} GLOBAL_TARGETS nvtx3-c nvtx3-cpp) + rapids_export_find_package_root(BUILD nvtx3 [=[${CMAKE_CURRENT_LIST_DIR}]=] + EXPORT_SET ${_RAPIDS_BUILD_EXPORT_SET}) endif() if(_RAPIDS_INSTALL_EXPORT_SET AND NOT exclude) include(GNUInstallDirs) From 3c265fc6d865c3bbe0a8ec4c6d75e05837f68faa Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 23 May 2024 06:52:11 +0000 Subject: [PATCH 2/4] fix typo --- rapids-cmake/export/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rapids-cmake/export/package.cmake b/rapids-cmake/export/package.cmake index 8d16854a..e98ac262 100644 --- a/rapids-cmake/export/package.cmake +++ b/rapids-cmake/export/package.cmake @@ -42,7 +42,7 @@ generated information will include a :cmake:command:`find_dependency` call for < Will record is part of the build directory export set ``INSTALL`` - Will record is part of the build directory export set + Will record is part of the install directory export set ``VERSION`` .. versionadded:: v22.04.00 From 50c5d93ece9a79108545b508b7285a1f7e5c3e92 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 23 May 2024 06:52:54 +0000 Subject: [PATCH 3/4] fix lint --- rapids-cmake/cpm/nvtx3.cmake | 3 ++- rapids-cmake/export/package.cmake | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rapids-cmake/cpm/nvtx3.cmake b/rapids-cmake/cpm/nvtx3.cmake index 865d1f13..37fd3fb4 100644 --- a/rapids-cmake/cpm/nvtx3.cmake +++ b/rapids-cmake/cpm/nvtx3.cmake @@ -98,7 +98,8 @@ function(rapids_cpm_nvtx3) EXPORT_SET nvtx3-targets GLOBAL_TARGETS nvtx3-c nvtx3-cpp NAMESPACE nvtx::) - rapids_export_package(BUILD nvtx3 ${_RAPIDS_BUILD_EXPORT_SET} GLOBAL_TARGETS nvtx3-c nvtx3-cpp) + rapids_export_package(BUILD nvtx3 ${_RAPIDS_BUILD_EXPORT_SET} GLOBAL_TARGETS nvtx3-c + nvtx3-cpp) rapids_export_find_package_root(BUILD nvtx3 [=[${CMAKE_CURRENT_LIST_DIR}]=] EXPORT_SET ${_RAPIDS_BUILD_EXPORT_SET}) endif() diff --git a/rapids-cmake/export/package.cmake b/rapids-cmake/export/package.cmake index e98ac262..646317c6 100644 --- a/rapids-cmake/export/package.cmake +++ b/rapids-cmake/export/package.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 283d2eb0e86c5a9ec18183c832901d9626575713 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 23 May 2024 07:45:12 -0400 Subject: [PATCH 4/4] Consistently use the `nvtx3` name everywhere --- rapids-cmake/cpm/nvtx3.cmake | 31 +++++++++++++++---------------- testing/cpm/cpm_nvtx-export.cmake | 6 +++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/rapids-cmake/cpm/nvtx3.cmake b/rapids-cmake/cpm/nvtx3.cmake index 37fd3fb4..7b8792ec 100644 --- a/rapids-cmake/cpm/nvtx3.cmake +++ b/rapids-cmake/cpm/nvtx3.cmake @@ -21,7 +21,7 @@ rapids_cpm_nvtx3 .. versionadded:: v24.06.00 -Allow projects to find `NVTX3` via `CPM` with built-in tracking of dependencies +Allow projects to find `nvtx3` via `CPM` with built-in tracking of dependencies for correct export support. Uses the version of nvtx3 :ref:`specified in the version file ` for consistency @@ -42,10 +42,10 @@ Result Targets Result Variables ^^^^^^^^^^^^^^^^ - :cmake:variable:`NVTX3_SOURCE_DIR` is set to the path to the source directory of nvtx3. - :cmake:variable:`NVTX3_BINARY_DIR` is set to the path to the build directory of nvtx3. - :cmake:variable:`NVTX3_ADDED` is set to a true value if nvtx3 has not been added before. - :cmake:variable:`NVTX3_VERSION` is set to the version of nvtx3 specified by the versions.json. + :cmake:variable:`nvtx3_SOURCE_DIR` is set to the path to the source directory of nvtx3. + :cmake:variable:`nvtx3_BINARY_DIR` is set to the path to the build directory of nvtx3. + :cmake:variable:`nvtx3_ADDED` is set to a true value if nvtx3 has not been added before. + :cmake:variable:`nvtx3_VERSION` is set to the version of nvtx3 specified by the versions.json. #]=======================================================================] function(rapids_cpm_nvtx3) @@ -72,7 +72,7 @@ function(rapids_cpm_nvtx3) rapids_cpm_generate_patch_command(nvtx3 ${version} patch_command) include("${rapids-cmake-dir}/cpm/find.cmake") - rapids_cpm_find(NVTX3 ${version} ${ARGN} + rapids_cpm_find(nvtx3 ${version} ${ARGN} GLOBAL_TARGETS nvtx3-c nvtx3-cpp CPM_ARGS GIT_REPOSITORY ${repository} @@ -81,15 +81,15 @@ function(rapids_cpm_nvtx3) EXCLUDE_FROM_ALL ${exclude}) include("${rapids-cmake-dir}/cpm/detail/display_patch_status.cmake") - rapids_cpm_display_patch_status(NVTX3) + rapids_cpm_display_patch_status(nvtx3) # Extract the major version value of nvtx3 to use with `rapids-export` to setup compatibility # rules include("${rapids-cmake-dir}/cmake/parse_version.cmake") rapids_cmake_parse_version(MAJOR ${version} ${version}) - # Set up install rules Need to be re-entrant safe so only call when `NVTX3_ADDED` - if(NVTX3_ADDED) + # Set up install rules Need to be re-entrant safe so only call when `nvtx3_ADDED` + if(nvtx3_ADDED) install(TARGETS nvtx3-c nvtx3-cpp EXPORT nvtx3-targets) if(_RAPIDS_BUILD_EXPORT_SET) include("${rapids-cmake-dir}/export/export.cmake") @@ -98,14 +98,13 @@ function(rapids_cpm_nvtx3) EXPORT_SET nvtx3-targets GLOBAL_TARGETS nvtx3-c nvtx3-cpp NAMESPACE nvtx::) - rapids_export_package(BUILD nvtx3 ${_RAPIDS_BUILD_EXPORT_SET} GLOBAL_TARGETS nvtx3-c - nvtx3-cpp) + include("${rapids-cmake-dir}/export/find_package_root.cmake") rapids_export_find_package_root(BUILD nvtx3 [=[${CMAKE_CURRENT_LIST_DIR}]=] EXPORT_SET ${_RAPIDS_BUILD_EXPORT_SET}) endif() if(_RAPIDS_INSTALL_EXPORT_SET AND NOT exclude) include(GNUInstallDirs) - install(DIRECTORY "${NVTX3_SOURCE_DIR}/c/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install(DIRECTORY "${nvtx3_SOURCE_DIR}/c/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") include("${rapids-cmake-dir}/export/export.cmake") rapids_export(INSTALL nvtx3 VERSION ${version} @@ -116,9 +115,9 @@ function(rapids_cpm_nvtx3) endif() # Propagate up variables that CPMFindPackage provide - set(NVTX3_SOURCE_DIR "${NVTX3_SOURCE_DIR}" PARENT_SCOPE) - set(NVTX3_BINARY_DIR "${NVTX3_BINARY_DIR}" PARENT_SCOPE) - set(NVTX3_ADDED "${NVTX3_ADDED}" PARENT_SCOPE) - set(NVTX3_VERSION ${version} PARENT_SCOPE) + set(nvtx3_SOURCE_DIR "${nvtx3_SOURCE_DIR}" PARENT_SCOPE) + set(nvtx3_BINARY_DIR "${nvtx3_BINARY_DIR}" PARENT_SCOPE) + set(nvtx3_ADDED "${nvtx3_ADDED}" PARENT_SCOPE) + set(nvtx3_VERSION ${version} PARENT_SCOPE) endfunction() diff --git a/testing/cpm/cpm_nvtx-export.cmake b/testing/cpm/cpm_nvtx-export.cmake index 76f6dc73..781c3450 100644 --- a/testing/cpm/cpm_nvtx-export.cmake +++ b/testing/cpm/cpm_nvtx-export.cmake @@ -22,16 +22,16 @@ rapids_cpm_nvtx3(BUILD_EXPORT_SET frank INSTALL_EXPORT_SET test) rapids_cpm_nvtx3(INSTALL_EXPORT_SET test2) get_target_property(packages rapids_export_install_test PACKAGE_NAMES) -if(NOT NVTX3 IN_LIST packages) +if(NOT nvtx3 IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvtx3 failed to record nvtx3 needs to be exported") endif() get_target_property(packages rapids_export_install_test2 PACKAGE_NAMES) -if(NOT NVTX3 IN_LIST packages) +if(NOT nvtx3 IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvtx3 failed to record nvtx3 needs to be exported") endif() get_target_property(packages rapids_export_build_frank PACKAGE_NAMES) -if(NOT NVTX3 IN_LIST packages) +if(NOT nvtx3 IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvtx3 failed to record nvtx3 needs to be exported") endif()