Skip to content

Commit

Permalink
cmake: rapids_cpm_find CURL
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Sep 30, 2024
1 parent 9cdebc6 commit 091dce9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
6 changes: 1 addition & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
32 changes: 32 additions & 0 deletions cpp/cmake/thirdparty/get_libcurl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# =============================================================================
# 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 # let's get a newer release if we have to build it ourselves anyways.
OPTIONS "BUILD_CURL_EXE OFF" "BUILD_SHARED_LIBS OFF" "BUILD_TESTING OFF" "CURL_USE_LIBPSL OFF"
"CURL_DISABLE_LDAP ON" "CMAKE_POSITION_INDEPENDENT_CODE ON"
)
endfunction()

find_and_configure_libcurl()
3 changes: 2 additions & 1 deletion python/kvikio/kvikio/remote_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion python/kvikio/tests/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def test_http_io(run_cmd, tmp_path, api):

if not kvikio.is_remote_file_available():
pytest.skip(
"cannot test remote IO, please build KvikIO with with AWS S3 support"
"RemoteFile not available, please build KvikIO "
"with libcurl (-DKvikIO_REMOTE_SUPPORT=ON)"
)
retcode = run_cmd(
cmd=[
Expand Down

0 comments on commit 091dce9

Please sign in to comment.