-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thrust when exported now automatically calls
thrust_create_target
(#…
…467) Instead of having each consuming project inject a code block into the `project-config.cmake` we instead have rapids-cmake call `thrust_create_target` right after `find_package(Thrust)`, only when thrust was found. This fixes two existing issues: 1. It removes the need for `rapids_cpm_thrust` to remove the the custom Thrust target from the global target set. Now that target will exist when rapids-cmake tries to promote it to global 2. It removes issues when multiple calls to `find_package(thrust)` occur before any calls to `thrust_create_target`. This creates some vexing issues when the thrust find calls resolve to different major versions of thrust Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) URL: #467
- Loading branch information
1 parent
9214ee3
commit 3bc1394
Showing
17 changed files
with
393 additions
and
69 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
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,84 @@ | ||
#============================================================================= | ||
# 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. | ||
#============================================================================= | ||
include_guard(GLOBAL) | ||
|
||
#[=======================================================================[.rst: | ||
rapids_export_post_find_package_code | ||
------------------------------------ | ||
.. versionadded:: v23.12.00 | ||
Record for <PackageName> a set of CMake instructions to be executed after the package | ||
has been found successfully. | ||
.. code-block:: cmake | ||
rapids_export_post_find_package_code((BUILD|INSTALL) | ||
<PackageName> | ||
<code> | ||
EXPORT_SET [ExportSetName] | ||
[CONDITION <variableName>] | ||
) | ||
When using complicated find modules like `Thrust` you might need to run some code after | ||
execution. Multiple calls to :cmake:command:`rapids_export_post_find_package_code` will append the | ||
instructions to execute in call order. | ||
.. note: | ||
The code will only be run if the package was found | ||
``BUILD`` | ||
Record code to be executed immediately after `PackageName` has been found | ||
for our our build directory export set. | ||
``INSTALL`` | ||
Record code to be executed immediately after `PackageName` has been found | ||
for our our install directory export set. | ||
``EXPORT_SET`` | ||
List the export set name that this code should be attached too. If | ||
no name is given the associated call will be ignored. | ||
``CONDITION`` | ||
A boolean variable name, that when evaluates to undefined or a false value | ||
will cause the associated call to be ignored. | ||
#]=======================================================================] | ||
function(rapids_export_post_find_package_code type name code) | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.export.post_find_package_code") | ||
|
||
set(options "") | ||
set(one_value EXPORT_SET CONDITION) | ||
set(multi_value "") | ||
cmake_parse_arguments(_RAPIDS "${options}" "${one_value}" "${multi_value}" ${ARGN}) | ||
# Early terminate conditions | ||
if(NOT _RAPIDS_EXPORT_SET OR NOT ${_RAPIDS_CONDITION}) | ||
return() | ||
endif() | ||
|
||
string(TOLOWER ${type} type) | ||
set(export_set ${_RAPIDS_EXPORT_SET}) | ||
|
||
if(NOT TARGET rapids_export_${type}_${export_set}) | ||
add_library(rapids_export_${type}_${export_set} INTERFACE) | ||
endif() | ||
|
||
# if the code coming in is a list of string we will have `;`, so transform those to "\n" so we | ||
# have a single string | ||
string(REPLACE ";" "\n" code "${code}") | ||
set_property(TARGET rapids_export_${type}_${export_set} APPEND_STRING | ||
PROPERTY "${name}_POST_FIND_CODE" "${code}\n") | ||
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
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
Oops, something went wrong.