Skip to content

Commit

Permalink
Attempt to Fix Broken C++ Build After cudftestutil is Made a Shared…
Browse files Browse the repository at this point in the history
… Lib (#996)

This PR aims to fix broken C++ build.

Authors:
  - Michael Wang (https://github.com/isVoid)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Mark Harris (https://github.com/harrism)
  - Mark Sadang (https://github.com/msadang)

URL: #996
  • Loading branch information
isVoid authored Mar 15, 2023
1 parent 95350b9 commit 3aefd4e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions conda/recipes/libcuspatial/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ requirements:
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- cudatoolkit ={{ cuda_version }}
- doxygen
- gmock {{ gtest_version }}
- gtest {{ gtest_version }}
- libcudf ={{ minor_version }}
Expand Down
10 changes: 7 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ include(cmake/Modules/ConfigureCUDA.cmake)
rapids_cpm_init()
# find or add cuDF
include(cmake/thirdparty/CUSPATIAL_GetCUDF.cmake)

# find or install GoogleTest
if (CUSPATIAL_BUILD_TESTS)
include(cmake/thirdparty/get_gtest.cmake)
endif()

###################################################################################################
# - library targets -------------------------------------------------------------------------------
Expand Down Expand Up @@ -279,9 +282,10 @@ rapids_export(
# * build documentation ----------------------------------------------------------------------------

find_package(Doxygen)
if(Doxygen_FOUND)

# doc targets for cuDF
if(DOXYGEN_FOUND)

# doc targets for cuSpatial
add_custom_command(
OUTPUT CUSPATIAL_DOXYGEN
WORKING_DIRECTORY ${CUSPATIAL_SOURCE_DIR}/doxygen
Expand Down
39 changes: 39 additions & 0 deletions cpp/cmake/thirdparty/get_gtest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# =============================================================================
# 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.
# =============================================================================

# This function finds gtest and sets any additional necessary environment variables.
function(find_and_configure_gtest)
include(${rapids-cmake-dir}/cpm/gtest.cmake)

# Find or install GoogleTest
rapids_cpm_gtest(BUILD_EXPORT_SET cuspatial-testing-exports INSTALL_EXPORT_SET cuspatial-testing-exports)

if(GTest_ADDED)
rapids_export(
BUILD GTest
VERSION ${GTest_VERSION}
EXPORT_SET GTestTargets
GLOBAL_TARGETS gtest gmock gtest_main gmock_main
NAMESPACE GTest::
)

include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(
BUILD GTest [=[${CMAKE_CURRENT_LIST_DIR}]=] cuspatial-testing-exports
)
endif()

endfunction()

find_and_configure_gtest()

0 comments on commit 3aefd4e

Please sign in to comment.