Skip to content

Commit

Permalink
use find_dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Feb 14, 2024
1 parent 940371c commit 8bf59a7
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -147,60 +147,59 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
# NOTE: we do not export benchmarks, examples, tests or devel tools
# so `third_party` libraries are currently unneeded.

include(CMakeFindDependencyMacro)
if(GINKGO_HAVE_PAPI_SDE)
find_package(PAPI REQUIRED COMPONENTS sde)
find_dependency(PAPI 7.0.1.0 COMPONENTS sde)
endif()

if(GINKGO_HAVE_HWLOC)
find_package(HWLOC REQUIRED)
find_dependency(HWLOC)
endif()

# Check for MPI if it is enabled
if(GINKGO_BUILD_MPI)
find_package(MPI 3.1 COMPONENTS CXX REQUIRED)
find_dependency(MPI 3.1 COMPONENTS CXX)
endif()

# HIP and OpenMP depend on Threads::Threads in some circumstances, but don't find it
if (GINKGO_BUILD_HIP OR GINKGO_BUILD_OMP)
find_package(Threads REQUIRED)
find_dependency(Threads)
endif()

# Needed because of a known issue with CUDA while linking statically.
# For details, see https://gitlab.kitware.com/cmake/cmake/issues/18614
if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_CUDA)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
find_package(NVTX REQUIRED)
find_dependency(CUDAToolkit)
find_dependency(NVTX)
endif()

if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_HIP)
find_package(HIP REQUIRED)
find_package(hipblas REQUIRED)
find_package(hipfft) # optional
find_package(hiprand REQUIRED)
find_package(hipsparse REQUIRED)
find_package(rocrand REQUIRED)
set(ROCTRACER_PATH "@ROCTRACER_PATH@")
if(GINKGO_HAVE_ROCTX)
find_package(ROCTX REQUIRED)
endif()
find_dependency(HIP)
find_dependency(hipblas)
find_dependency(hipfft)
find_dependency(hiprand)
find_dependency(hipsparse)
find_dependency(rocrand)
set_and_check(ROCTRACER_PATH "@ROCTRACER_PATH@")
find_dependency(ROCTX)
endif()

if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_SYCL)
find_package(MKL CONFIG REQUIRED HINTS "${GINKGO_MKL_ROOT}")
find_package(oneDPL REQUIRED HINTS "${GINKGO_DPL_ROOT}")
find_dependency(MKL CONFIG HINTS "${GINKGO_MKL_ROOT}")
find_dependency(oneDPL HINTS "${GINKGO_DPL_ROOT}")
endif()

if(GINKGO_HAVE_VTUNE)
find_package(VTune REQUIRED)
find_dependency(VTune)
endif()

if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_HAVE_METIS)
find_package(METIS REQUIRED)
find_dependency(METIS)
endif()

if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_HAVE_TAU)
find_package(PerfStubs REQUIRED)
find_dependency(PerfStubs)
endif()

# Check that the same compilers as for Ginkgo are used
Expand Down

0 comments on commit 8bf59a7

Please sign in to comment.