-
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.
Introduce RAPIDS.cmake a new way to fetch rapids-cmake
- Loading branch information
1 parent
619b270
commit 7d70891
Showing
20 changed files
with
292 additions
and
36 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,38 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
# | ||
# This is the preferred entry point for projects using rapids-cmake | ||
# | ||
|
||
set(rapids-cmake-version 21.10) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
rapids-cmake | ||
GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git | ||
GIT_TAG branch-${rapids-cmake-version} | ||
) | ||
FetchContent_GetProperties(rapids-cmake) | ||
if(rapids-cmake_POPULATED) | ||
# Something else has already populated rapids-cmake, only thing | ||
# we need to do is setup the CMAKE_MODULE_PATH | ||
if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) | ||
list(APPEND CMAKE_MODULE_PATH "${rapids-cmake-dir}") | ||
endif() | ||
else() | ||
FetchContent_MakeAvailable(rapids-cmake) | ||
endif() | ||
|
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,41 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
|
||
# verify no rapids-cmake variables have been specified | ||
if(DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "") | ||
endif() | ||
|
||
include("${rapids.cmake-location}") | ||
|
||
if(NOT DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "expected variable rapids-cmake_SOURCE_DIR to exist") | ||
endif() | ||
|
||
if(NOT DEFINED rapids-cmake-dir) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to exist") | ||
endif() | ||
|
||
if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to be inside CMAKE_MODULE_PATH") | ||
endif() | ||
|
||
if(NOT EXISTS "${rapids-cmake_SOURCE_DIR}/init.cmake") | ||
message(FATAL_ERROR "expected init.cmake to exist") | ||
endif() | ||
|
||
# Be hostile against rapids-cmake | ||
set(CMAKE_MODULE_PATH "/not/a/directory") |
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,38 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
|
||
# verify no rapids-cmake variables have been specified | ||
if(DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "") | ||
endif() | ||
|
||
include("${rapids.cmake-location}") | ||
|
||
if(NOT DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "expected variable rapids-cmake_SOURCE_DIR to exist") | ||
endif() | ||
|
||
if(NOT DEFINED rapids-cmake-dir) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to exist") | ||
endif() | ||
|
||
if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to be inside CMAKE_MODULE_PATH") | ||
endif() | ||
|
||
if(NOT EXISTS "${rapids-cmake_SOURCE_DIR}/init.cmake") | ||
message(FATAL_ERROR "expected init.cmake to exist") | ||
endif() |
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,37 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
cmake_minimum_required(VERSION 3.20) | ||
project(rapids-test-project LANGUAGES CXX) | ||
|
||
cmake_path(GET rapids-cmake-dir PARENT_PATH rapids.cmake-location) | ||
cmake_path(APPEND rapids.cmake-location "RAPIDS.cmake") | ||
|
||
# Remove this cache variable so we can properly test | ||
# fetching rapids-cmake work as intended | ||
unset(rapids-cmake-dir CACHE) | ||
|
||
set(CMAKE_MODULE_PATH "/not/a/directory") | ||
|
||
function(add_A ) | ||
add_subdirectory(A) | ||
endfunction() | ||
|
||
function(add_B ) | ||
add_subdirectory(B) | ||
endfunction() | ||
|
||
add_A() | ||
add_B() |
38 changes: 38 additions & 0 deletions
38
testing/other/rapids_cmake-multiple-simple/A/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,38 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
|
||
# verify no rapids-cmake variables have been specified | ||
if(DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "") | ||
endif() | ||
|
||
include("${rapids.cmake-location}") | ||
|
||
if(NOT DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "expected variable rapids-cmake_SOURCE_DIR to exist") | ||
endif() | ||
|
||
if(NOT DEFINED rapids-cmake-dir) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to exist") | ||
endif() | ||
|
||
if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to be inside CMAKE_MODULE_PATH") | ||
endif() | ||
|
||
if(NOT EXISTS "${rapids-cmake_SOURCE_DIR}/init.cmake") | ||
message(FATAL_ERROR "expected init.cmake to exist") | ||
endif() |
38 changes: 38 additions & 0 deletions
38
testing/other/rapids_cmake-multiple-simple/B/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,38 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
|
||
# verify no rapids-cmake variables have been specified | ||
if(DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "") | ||
endif() | ||
|
||
include("${rapids.cmake-location}") | ||
|
||
if(NOT DEFINED rapids-cmake_SOURCE_DIR) | ||
message(FATAL_ERROR "expected variable rapids-cmake_SOURCE_DIR to exist") | ||
endif() | ||
|
||
if(NOT DEFINED rapids-cmake-dir) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to exist") | ||
endif() | ||
|
||
if(NOT "${rapids-cmake-dir}" IN_LIST CMAKE_MODULE_PATH) | ||
message(FATAL_ERROR "expected variable rapids-cmake-dir to be inside CMAKE_MODULE_PATH") | ||
endif() | ||
|
||
if(NOT EXISTS "${rapids-cmake_SOURCE_DIR}/init.cmake") | ||
message(FATAL_ERROR "expected init.cmake to exist") | ||
endif() |
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,31 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-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. | ||
#============================================================================= | ||
cmake_minimum_required(VERSION 3.20) | ||
project(rapids-test-project LANGUAGES CXX) | ||
|
||
cmake_path(GET rapids-cmake-dir PARENT_PATH rapids.cmake-location) | ||
cmake_path(APPEND rapids.cmake-location "RAPIDS.cmake") | ||
|
||
# Remove this cache variable so we can properly test | ||
# fetching rapids-cmake work as intended | ||
unset(rapids-cmake-dir CACHE) | ||
|
||
# Remove this cache variable so we can properly test | ||
# fetching rapids-cmake work as intended | ||
unset(rapids-cmake-dir CACHE) | ||
|
||
add_subdirectory(A) | ||
add_subdirectory(B) |