-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rapids-cmake add rapids_cpm_<PackageName> for common packages
Fixes #32 The following packages are now are easier to user for RAPIDS projects as rapids-cmake offers a pre-configured setup for each project. GTest NVBench RMM SpdLog Thrust On top of providing a consistent version of these packages to all RAPIDS projects, rapids-cmake now is able to deduce when these projects should also be installed. ```cmake rapids_cpm_gtest(BUILD_EXPORT_SET myproject) rapdis_cpm_rmm(BUILD_EXPORT_SET myproject INSTALL_EXPORT_SET myproject) ``` Given the above snippet when RMM is built as a subcomponent of `myproject` it will be installed as well. This is done since RMM is part of the INSTALL export set, and therefore must be available from an installed version of `myproject`.
- Loading branch information
1 parent
f367fe6
commit 6af51f9
Showing
26 changed files
with
833 additions
and
2 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
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 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/gtest.cmake |
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 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/nvbench.cmake |
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 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/rmm.cmake |
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 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/spdlog.cmake |
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 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/thrust.cmake |
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,77 @@ | ||
#============================================================================= | ||
# Copyright (c) 2020-2021, 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_gtest | ||
---------------- | ||
|
||
.. versionadded:: v21.10.00 | ||
|
||
Allow projects to find or build `Google Test` via `CPM` with built-in | ||
tracking of these dependencies for correct export support. | ||
|
||
Uses version 1.10.0 of Google Test for consistency across all RAPIDS projects | ||
|
||
.. code-block:: cmake | ||
|
||
rapids_cpm_gtest( [BUILD_EXPORT_SET <export-name>] | ||
[INSTALL_EXPORT_SET <export-name>] | ||
) | ||
.. note:: | ||
Installation of GTest will occur if an INSTALL_EXPORT_SET is provided, and GTest | ||
is added to the project via :cmake:command:`add_subdirectory` by CPM. | ||
|
||
Result Targets | ||
^^^^^^^^^^^^^^ | ||
GTest::gtest, GTest::gmock, GTest::gtest_main, GTest::gmock_main targets will be created | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
:cmake:variable:`GTest_SOURCE_DIR` is set to the path to the source directory of GTest. | ||
:cmake:variable:`GTest_BINAR_DIR` is set to the path to the build directory of GTest. | ||
:cmake:variable:`GTest_ADDED` is set to a true value if GTest has not been added before. | ||
|
||
#]=======================================================================] | ||
function(rapids_cpm_gtest) | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.gtest") | ||
|
||
set(to_install OFF) | ||
if(INSTALL_EXPORT_SET IN_LIST ARGN) | ||
set(to_install ON) | ||
endif() | ||
|
||
include("${rapids-cmake-dir}/cpm/find.cmake") | ||
rapids_cpm_find(GTest 1.10 ${ARGN} | ||
GLOBAL_TARGETS GTest::gtest GTest::gmock GTest::gtest_main GTest::gmock_main | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG release-1.10.0 | ||
GIT_SHALLOW TRUE | ||
OPTIONS "INSTALL_GTEST ${to_install}") | ||
|
||
# Propagate up variables that CPMFindPackage provide | ||
set(GTest_SOURCE_DIR "${GTest_SOURCE_DIR}" PARENT_SCOPE) | ||
set(GTest_BINARY_DIR "${GTest_BINARY_DIR}" PARENT_SCOPE) | ||
set(GTest_ADDED "${GTest_ADDED}" PARENT_SCOPE) | ||
|
||
if(NOT TARGET GTest::gtest) | ||
add_library(GTest::gtest ALIAS gtest) | ||
add_library(GTest::gmock ALIAS gmock) | ||
add_library(GTest::gtest_main ALIAS gtest_main) | ||
add_library(GTest::gmock_main ALIAS gmock_main) | ||
endif() | ||
endfunction() |
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,79 @@ | ||
#============================================================================= | ||
# Copyright (c) 2020-2021, 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_nvbench | ||
------------------ | ||
|
||
.. versionadded:: v21.10.00 | ||
|
||
Allow projects to find or build `nvbench` via `CPM` with built-in | ||
tracking of these dependencies for correct export support. | ||
|
||
Uses latest version of nvbench for consistency across all RAPIDS projects | ||
|
||
.. code-block:: cmake | ||
|
||
rapids_cpm_nvbench( [BUILD_EXPORT_SET <export-name>] ) | ||
|
||
``BUILD_EXPORT_SET`` | ||
Record that a :cmake:command:`CPMFindPackage(nvbench)` call needs to occur as part of | ||
our build directory export set. | ||
|
||
.. note:: | ||
|
||
RAPIDS-cmake will error out if an INSTALL_EXPORT_SET is provided, as nvbench | ||
doesn't provide any support for installation. | ||
|
||
Result Targets | ||
^^^^^^^^^^^^^^ | ||
nvbench::nvbench target will be created | ||
|
||
nvbench::main target will be created | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
:cmake:variable:`nvbench_SOURCE_DIR` is set to the path to the source directory of nvbench. | ||
:cmake:variable:`nvbench_BINAR_DIR` is set to the path to the build directory of nvbench. | ||
:cmake:variable:`nvbench_ADDED` is set to a true value if nvbench has not been added before. | ||
|
||
#]=======================================================================] | ||
function(rapids_cpm_nvbench) | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.nvbench") | ||
|
||
set(to_install FALSE) | ||
if(INSTALL_EXPORT_SET IN_LIST ARGN) | ||
message(FATAL_ERROR "nvbench doesn't provide install rules. | ||
It can't be part of an INSTALL_EXPORT_SET") | ||
endif() | ||
|
||
include("${rapids-cmake-dir}/cpm/find.cmake") | ||
rapids_cpm_find(nvbench 0.0 ${ARGN} | ||
GLOBAL_TARGETS nvbench::nvbench nvbench::main | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/NVIDIA/nvbench.git | ||
GIT_TAG main | ||
GIT_SHALLOW TRUE | ||
OPTIONS "NVBench_ENABLE_EXAMPLES OFF" "NVBench_ENABLE_TESTING OFF") | ||
|
||
# Propagate up variables that CPMFindPackage provide | ||
set(nvbench_SOURCE_DIR "${nvbench_SOURCE_DIR}" PARENT_SCOPE) | ||
set(nvbench_BINARY_DIR "${nvbench_BINARY_DIR}" PARENT_SCOPE) | ||
set(nvbench_ADDED "${nvbench_ADDED}" PARENT_SCOPE) | ||
|
||
# nvbench creates the correct namespace aliases | ||
endfunction() |
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,72 @@ | ||
#============================================================================= | ||
# Copyright (c) 2020-2021, 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_rmm | ||
-------------- | ||
|
||
.. versionadded:: v21.10.00 | ||
|
||
Allow projects to find or build `rmm` via `CPM` with built-in | ||
tracking of these dependencies for correct export support. | ||
|
||
Uses the associated cal-version of rmm for consistency across all RAPIDS projects | ||
|
||
.. code-block:: cmake | ||
|
||
rapids_cpm_rmm( [BUILD_EXPORT_SET <export-name>] | ||
[INSTALL_EXPORT_SET <export-name>] | ||
) | ||
|
||
``BUILD_EXPORT_SET`` | ||
Record that a :cmake:command:`CPMFindPackage(rmm)` call needs to occur as part of | ||
our build directory export set. | ||
|
||
``INSTALL_EXPORT_SET`` | ||
Record a :cmake:command:`find_dependency(rmm)` call needs to occur as part of | ||
our install directory export set. | ||
|
||
.. note:: | ||
Installation of rmm will always occur when it is built as a subcomponent of the | ||
calling project. | ||
|
||
Result Targets | ||
^^^^^^^^^^^^^^ | ||
rmm::rmm target will be created | ||
|
||
#]=======================================================================] | ||
function(rapids_cpm_rmm) | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.rmm") | ||
|
||
set(to_install FALSE) | ||
if(INSTALL_EXPORT_SET IN_LIST ARGN) | ||
set(to_install TRUE) | ||
endif() | ||
|
||
include("${rapids-cmake-dir}/rapids-version.cmake") | ||
include("${rapids-cmake-dir}/cpm/find.cmake") | ||
# Once we can require CMake 3.22 this can use `only_major_minor` for version searches | ||
rapids_cpm_find(rmm "${rapids-cmake-version}.0" ${ARGN} | ||
GLOBAL_TARGETS rmm::rmm | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/rapidsai/rmm.git | ||
GIT_TAG branch-${rapids-cmake-version} | ||
GIT_SHALLOW TRUE | ||
OPTIONS "BUILD_TESTS OFF" "BUILD_BENCHMARKS OFF") | ||
|
||
# rmm creates the correct namespace aliases | ||
endfunction() |
Oops, something went wrong.