From 108e5eb095a16586e9531546fe3fdd62f969130e Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Sun, 29 Sep 2024 17:35:47 +0200 Subject: [PATCH] cmake: rapids_cpm_find CURL --- cpp/CMakeLists.txt | 6 +---- cpp/cmake/thirdparty/get_libcurl.cmake | 31 ++++++++++++++++++++++++++ python/kvikio/kvikio/remote_file.py | 3 ++- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 cpp/cmake/thirdparty/get_libcurl.cmake diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 8f464ba5d5..3bb65e1bbc 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -51,11 +51,7 @@ rapids_find_package( ) if(KvikIO_REMOTE_SUPPORT) - rapids_find_package( - CURL 7.87.0 REQUIRED - BUILD_EXPORT_SET kvikio-exports - INSTALL_EXPORT_SET kvikio-exports - ) + include(cmake/thirdparty/get_libcurl.cmake) endif() rapids_find_package( diff --git a/cpp/cmake/thirdparty/get_libcurl.cmake b/cpp/cmake/thirdparty/get_libcurl.cmake new file mode 100644 index 0000000000..706eb07d58 --- /dev/null +++ b/cpp/cmake/thirdparty/get_libcurl.cmake @@ -0,0 +1,31 @@ +# ============================================================================= +# Copyright (c) 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. 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 function finds libcurl and sets any additional necessary environment variables. +function(find_and_configure_libcurl) + include(${rapids-cmake-dir}/cpm/find.cmake) + + rapids_cpm_find( + CURL 7.87.0 + GLOBAL_TARGETS libcurl + BUILD_EXPORT_SET kvikio-exports + INSTALL_EXPORT_SET kvikio-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/curl/curl + GIT_TAG curl-8_10_1 + OPTIONS "BUILD_CURL_EXE OFF" "BUILD_SHARED_LIBS OFF" "BUILD_TESTING OFF" + ) +endfunction() + +find_and_configure_libcurl() diff --git a/python/kvikio/kvikio/remote_file.py b/python/kvikio/kvikio/remote_file.py index 90a8b81fb4..db8715c086 100644 --- a/python/kvikio/kvikio/remote_file.py +++ b/python/kvikio/kvikio/remote_file.py @@ -25,7 +25,8 @@ def _get_remote_module(): """Get the remote module or raise an error""" if not is_remote_file_available(): raise RuntimeError( - "RemoteFile not available, please build KvikIO with AWS S3 support" + "RemoteFile not available, please build KvikIO " + "with libcurl (-DKvikIO_REMOTE_SUPPORT=ON)" ) import kvikio._lib.remote_handle