-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rapids_cpm cccl packages cmake files are now relocated to not clash w…
…ith upstream (#393) This way rapids-cmake versions of these projects don't clash with the upstream versions. Fixes #367 Authors: - Robert Maynard (https://github.com/robertmaynard) - Bradley Dice (https://github.com/bdice) Approvers: - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) URL: #393
- Loading branch information
1 parent
95f9210
commit 2ca5443
Showing
6 changed files
with
182 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/cmake/libcudacxxInstallRules.cmake b/cmake/libcudacxxInstallRules.cmake | ||
index 446ccb50..ff622bb7 100644 | ||
--- a/cmake/libcudacxxInstallRules.cmake | ||
+++ b/cmake/libcudacxxInstallRules.cmake | ||
@@ -1,5 +1,5 @@ | ||
option(libcudacxx_ENABLE_INSTALL_RULES | ||
- "Enable installation of libcudacxx" ${libcudacxx_TOPLEVEL_PROJECT} | ||
+ "Enable installation of libcudacxx" ${LIBCUDACXX_TOPLEVEL_PROJECT} | ||
) | ||
|
||
if (NOT libcudacxx_ENABLE_INSTALL_RULES) | ||
@@ -12,24 +12,27 @@ include(GNUInstallDirs) | ||
# Libcudacxx headers | ||
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/include/cuda" | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
+ PATTERN CMakeLists.txt EXCLUDE | ||
) | ||
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/include/nv" | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
+ PATTERN CMakeLists.txt EXCLUDE | ||
) | ||
|
||
# Libcudacxx cmake package | ||
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake" | ||
- PATTERN libcudacxx-header-search EXCLUDE | ||
+ PATTERN *.cmake.in EXCLUDE | ||
) | ||
|
||
# Need to configure a file to store CMAKE_INSTALL_INCLUDEDIR | ||
# since it can be defined by the user. This is common to work around collisions | ||
# with the CTK installed headers. | ||
+set(install_location "${CMAKE_INSTALL_LIBDIR}/cmake/libcudacxx") | ||
configure_file("${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in" | ||
"${libcudacxx_BINARY_DIR}/lib/cmake/libcudacxx/libcudacxx-header-search.cmake" | ||
@ONLY | ||
) | ||
install(FILES "${libcudacxx_BINARY_DIR}/lib/cmake/libcudacxx/libcudacxx-header-search.cmake" | ||
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libcudacxx" | ||
+ DESTINATION "${install_location}" | ||
) | ||
|
||
diff --git a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in | ||
index 9e7e187c..cb3b946f 100644 | ||
--- a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in | ||
+++ b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in | ||
@@ -1,8 +1,18 @@ | ||
# Parse version information from version header: | ||
unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search | ||
+ | ||
+# Find CMAKE_INSTALL_INCLUDEDIR=@CMAKE_INSTALL_INCLUDEDIR@ directory" | ||
+set(from_install_prefix "@install_location@") | ||
+ | ||
+# Transform to a list of directories, replace each directory with "../" | ||
+# and convert back to a string | ||
+string(REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix}") | ||
+list(TRANSFORM from_install_prefix REPLACE ".+" "../") | ||
+list(JOIN from_install_prefix "" from_install_prefix) | ||
+ | ||
find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config | ||
NO_DEFAULT_PATH # Only search explicit paths below: | ||
PATHS | ||
- "${CMAKE_CURRENT_LIST_DIR}/../../../@CMAKE_INSTALL_INCLUDEDIR@" # Install tree | ||
+ "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/@CMAKE_INSTALL_INCLUDEDIR@" # Install tree | ||
) | ||
set_property(CACHE _libcudacxx_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
testing/cpm/cpm_libcudacxx-verify-install-custom-libdir/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#============================================================================= | ||
# Copyright (c) 2023, 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. | ||
#============================================================================= | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
include(${rapids-cmake-dir}/cpm/libcudacxx.cmake) | ||
|
||
include(${rapids-cmake-dir}/cpm/init.cmake) | ||
include(${rapids-cmake-dir}/export/export.cmake) | ||
|
||
project(fake LANGUAGES CXX VERSION 3.1.4) | ||
|
||
rapids_cpm_init() | ||
|
||
set(CMAKE_INSTALL_LIBDIR "lib/aarch64") | ||
rapids_cpm_libcudacxx(INSTALL_EXPORT_SET fake_set) | ||
|
||
add_library(fakeLib INTERFACE) | ||
install(TARGETS fakeLib EXPORT fake_set) | ||
target_link_libraries(fakeLib INTERFACE libcudacxx::libcudacxx) | ||
|
||
rapids_export(INSTALL fake | ||
EXPORT_SET fake_set | ||
NAMESPACE test:: | ||
) | ||
|
||
# Install our project so we can verify `libcudacxx` can be found | ||
# from a custom install location | ||
add_custom_target(install_project ALL | ||
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --prefix install/fake/ | ||
) | ||
|
||
# Add a custom command that verifies that the expect files have | ||
# been installed for each component | ||
file(WRITE "${CMAKE_BINARY_DIR}/install/CMakeLists.txt" [=[ | ||
cmake_minimum_required(VERSION 3.20) | ||
project(verify_install_targets LANGUAGES CXX) | ||
|
||
set(computed_path "${CMAKE_CURRENT_SOURCE_DIR}/fake/lib/aarch64/cmake/fake/") | ||
find_package(fake REQUIRED NO_DEFAULT_PATH HINTS ${computed_path}) | ||
if(NOT TARGET libcudacxx::libcudacxx) | ||
message(FATAL_ERROR "Failed to import libcudacxx dependency") | ||
endif() | ||
]=]) | ||
|
||
add_custom_target(verify_install_libcudacxx_works ALL | ||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/install/build" | ||
COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/install" -B="${CMAKE_BINARY_DIR}/install/build" | ||
) | ||
add_dependencies(verify_install_libcudacxx_works install_project) |