diff --git a/build.sh b/build.sh index dfa42c38099..e5beb51dedf 100755 --- a/build.sh +++ b/build.sh @@ -234,11 +234,6 @@ if [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_CUDF_CPP"* ]]; then EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DFIND_CUDF_CPP=ON" fi -# Append `-DFIND_CUDF_KAFKA_CPP=ON` to EXTRA_CMAKE_ARGS unless a user specified the option. -if buildAll || hasArg cudf_kafka && [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_CUDF_KAFKA_CPP"* ]]; then - EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DFIND_CUDF_KAFKA_CPP=ON" -fi - # If clean given, run it prior to any other steps if hasArg clean; then @@ -262,7 +257,7 @@ fi ################################################################################ # Configure, build, and install libcudf -if buildAll || hasArg libcudf || hasArg cudf || hasArg cudf_kafka || hasArg cudfjar; then +if buildAll || hasArg libcudf || hasArg cudf || hasArg cudfjar; then if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then CUDF_CMAKE_CUDA_ARCHITECTURES="${CUDF_CMAKE_CUDA_ARCHITECTURES:-NATIVE}" if [[ "$CUDF_CMAKE_CUDA_ARCHITECTURES" == "NATIVE" ]]; then @@ -374,7 +369,7 @@ fi # build cudf_kafka Python package if hasArg cudf_kafka; then cd ${REPODIR}/python/cudf_kafka - SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} -DCMAKE_CUDA_ARCHITECTURES=${CUDF_CMAKE_CUDA_ARCHITECTURES} ${EXTRA_CMAKE_ARGS}" \ + SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} ${EXTRA_CMAKE_ARGS}" \ SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL:-1}" \ python -m pip install --no-build-isolation --no-deps . fi diff --git a/python/cudf_kafka/CMakeLists.txt b/python/cudf_kafka/CMakeLists.txt index 8127ba87b40..5b3397fa64d 100644 --- a/python/cudf_kafka/CMakeLists.txt +++ b/python/cudf_kafka/CMakeLists.txt @@ -17,8 +17,6 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) set(cudf_kafka_version 23.12.00) include(../../fetch_rapids.cmake) -include(rapids-cuda) -rapids_cuda_init_architectures(cudf-kafka-python) project( cudf-kafka-python @@ -27,59 +25,15 @@ project( # language to be enabled here. The test project that is built in scikit-build to verify # various linking options for the python library is hardcoded to build with C, so until # that is fixed we need to keep C. - C CXX CUDA + C CXX ) -option(FIND_CUDF_KAFKA_CPP - "Search for existing cudf_kafka C++ installations before defaulting to local files" OFF -) - -option(CUDF_KAFKA_BUILD_WHEELS "Whether this build is generating a Python wheel." OFF) - -# If the user requested it we attempt to find cudf_kafka. if(FIND_CUDF_KAFKA_CPP) find_package(cudf_kafka ${cudf_kafka_version} REQUIRED) endif() if(NOT cudf_kafka_FOUND) - set(BUILD_TESTS OFF) - set(BUILD_BENCHMARKS OFF) - set(_exclude_from_all "") - if(CUDF_KAFKA_BUILD_WHEELS) - - # Statically link cudart if building wheels - set(CUDA_STATIC_RUNTIME ON) - set(CUDF_KAFKA_USE_CUDF_STATIC ON) - set(CUDF_KAFKA_EXCLUDE_CUDF_FROM_ALL ON) - - # Always build wheels against the pyarrow libarrow. - set(USE_LIBARROW_FROM_PYARROW ON) - - # Need to set this so all the nvcomp targets are global, not only nvcomp::nvcomp - # https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_PACKAGE_TARGETS_GLOBAL.html#variable:CMAKE_FIND_PACKAGE_TARGETS_GLOBAL - set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON) - - # Don't install the cudf_kafka C++ targets into wheels - set(_exclude_from_all EXCLUDE_FROM_ALL) - endif() - - add_subdirectory(../../cpp/libcudf_kafka cudf_kafka-cpp ${_exclude_from_all}) - - set(cython_lib_dir cudf_kafka) - - if(CUDF_KAFKA_BUILD_WHEELS) - include(cmake/Modules/WheelHelpers.cmake) - get_target_property(_nvcomp_link_libs nvcomp::nvcomp INTERFACE_LINK_LIBRARIES) - # Ensure all the shared objects we need at runtime are in the wheel - add_target_libs_to_wheel( - LIB_DIR ${cython_lib_dir} TARGETS arrow_shared nvcomp::nvcomp ${_nvcomp_link_libs} - ) - endif() - - # Since there are multiple subpackages of cudf_kafka._lib that require access to libcudf_kafka, we - # place the library in the cudf_kafka directory as a single source of truth and modify the other - # rpaths appropriately. - install(TARGETS cudf_kafka DESTINATION ${cython_lib_dir}) + message(FATAL_ERROR "cudf_kafka package not found. cudf_kafka C++ is required to build this Python package.") endif() include(rapids-cython) diff --git a/python/cudf_kafka/cudf_kafka/cmake/Modules/WheelHelpers.cmake b/python/cudf_kafka/cudf_kafka/cmake/Modules/WheelHelpers.cmake deleted file mode 100644 index 41d720c527a..00000000000 --- a/python/cudf_kafka/cudf_kafka/cmake/Modules/WheelHelpers.cmake +++ /dev/null @@ -1,71 +0,0 @@ -# ============================================================================= -# 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) - -# Making libraries available inside wheels by installing the associated targets. -function(add_target_libs_to_wheel) - list(APPEND CMAKE_MESSAGE_CONTEXT "add_target_libs_to_wheel") - - set(options "") - set(one_value "LIB_DIR") - set(multi_value "TARGETS") - cmake_parse_arguments(_ "${options}" "${one_value}" "${multi_value}" ${ARGN}) - - message(VERBOSE "Installing targets '${__TARGETS}' into lib_dir '${__LIB_DIR}'") - - foreach(target IN LISTS __TARGETS) - - if(NOT TARGET ${target}) - message(VERBOSE "No target named ${target}") - continue() - endif() - - get_target_property(alias_target ${target} ALIASED_TARGET) - if(alias_target) - set(target ${alias_target}) - endif() - - get_target_property(is_imported ${target} IMPORTED) - if(NOT is_imported) - # If the target isn't imported, install it into the the wheel - install(TARGETS ${target} DESTINATION ${__LIB_DIR}) - message(VERBOSE "install(TARGETS ${target} DESTINATION ${__LIB_DIR})") - else() - # If the target is imported, make sure it's global - get_target_property(already_global ${target} IMPORTED_GLOBAL) - if(NOT already_global) - set_target_properties(${target} PROPERTIES IMPORTED_GLOBAL TRUE) - endif() - - # Find the imported target's library so we can copy it into the wheel - set(lib_loc) - foreach(prop IN ITEMS IMPORTED_LOCATION IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION_DEBUG) - get_target_property(lib_loc ${target} ${prop}) - if(lib_loc) - message(VERBOSE "Found ${prop} for ${target}: ${lib_loc}") - break() - endif() - message(VERBOSE "${target} has no value for property ${prop}") - endforeach() - - if(NOT lib_loc) - message(FATAL_ERROR "Found no libs to install for target ${target}") - endif() - - # Copy the imported library into the wheel - install(FILES ${lib_loc} DESTINATION ${__LIB_DIR}) - message(VERBOSE "install(FILES ${lib_loc} DESTINATION ${__LIB_DIR})") - endif() - endforeach() -endfunction()