Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain the original path to Kokkos and ArborX #723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Dec 11, 2023

Downstream Cabana libraries require specifying Kokkos_ROOT and ArborX_ROOT right now. This PR allows users to skip that and try to use the directories used during the build. I've only done these two because that's what I tested, but it could be expanded to all others.

Similar approach was hardcoded in Cabana at some point, but was removed in #244.

find_package(Kokkos QUIET)
if(NOT Kokkos_FOUND)
# If Kokkos was not found, try to use Kokkos used when building Cabana
set(Kokkos_DIR @Kokkos_DIR@)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(Kokkos_DIR @Kokkos_DIR@)
if(NOT Kokkos_DIR)
set(Kokkos_DIR @Kokkos_DIR@)
endif()

So the user can still overwrite it if needed.

if(NOT Kokkos_FOUND)
# If Kokkos was not found, try to use Kokkos used when building Cabana
set(Kokkos_DIR @Kokkos_DIR@)
find_dependency(Kokkos)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_dependency(Kokkos)
find_dependency(Kokkos REQUIRED)

@@ -12,14 +12,24 @@
include(CMakeFindDependencyMacro)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" )
list(APPEND CMAKE_PREFIX_PATH @CMAKE_PREFIX_PATH@)
find_dependency(Kokkos REQUIRED)
find_package(Kokkos QUIET)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_package(Kokkos QUIET)
find_dependency(Kokkos)

find_dependency handles QUIET automatically.

set(Cabana_ENABLE_MPI @Cabana_ENABLE_MPI@)
if(Cabana_ENABLE_MPI)
find_dependency(MPI REQUIRED CXX)
endif()
set(Cabana_ENABLE_ARBORX @Cabana_ENABLE_ARBORX@)
if(Cabana_ENABLE_ARBORX)
find_dependency(ArborX REQUIRED)
find_package(ArborX QUIET)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_package(ArborX QUIET)
find_dependency(ArborX)

find_package(ArborX QUIET)
if(NOT ArborX_FOUND)
# If ArborX was not found, try to use ArborX used when building Cabana
set(ArborX_DIR @ArborX_DIR@)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(ArborX_DIR @ArborX_DIR@)
if(NOT ArborX_DIR)
set(ArborX_DIR @ArborX_DIR@)
endif()

if(NOT ArborX_FOUND)
# If ArborX was not found, try to use ArborX used when building Cabana
set(ArborX_DIR @ArborX_DIR@)
find_dependency(ArborX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_dependency(ArborX)
find_dependency(ArborX REQUIRED)

@streeve
Copy link
Member

streeve commented Dec 12, 2023

How do you mean we require *_ROOT? I generally just pass the Cabana path in CMAKE_PREFIX_PATH to build an app and Kokkos/ArborX are found just fine. Is this a CMake version thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants