Skip to content

Commit

Permalink
Hard-code SYCL and MPI dependency paths on installation
Browse files Browse the repository at this point in the history
Paths can still be explicitly overridden, but default to the installation directories discovered at configuration time. Note that this does not apply to DPC++ which requires CMAKE_CXX_COMPILER to be set and therefore cannot be applied from the config file.
  • Loading branch information
fknorr committed Dec 21, 2021
1 parent da1c240 commit 4e88657
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cmake/celerity-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,34 @@ include("${CELERITY_CMAKE_DIR}/AddToTarget.cmake")
set(CELERITY_ORIGINAL_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CELERITY_CMAKE_DIR}")

if(NOT DEFINED MPI_HOME AND NOT "@MPI_HOME@" STREQUAL "")
# FindMPI does not export anything akin to "MPI_DIR" that can be fed back into find_dependency.
set(MPI_HOME "@MPI_HOME@")
endif()
find_dependency(MPI 2.0 REQUIRED)

find_dependency(Threads REQUIRED)

if(CELERITY_SYCL_IMPL STREQUAL "hipSYCL")
find_dependency(hipSYCL CONFIG REQUIRED)
if(NOT DEFINED HIPSYCL_TARGETS AND NOT "@HIPSYCL_TARGETS@" STREQUAL "")
set(HIPSYCL_TARGETS "@HIPSYCL_TARGETS@")
endif()
if(NOT DEFINED hipSYCL_DIR)
find_dependency(hipSYCL CONFIG REQUIRED PATHS "@hipSYCL_DIR@")
else()
find_dependency(hipSYCL CONFIG REQUIRED)
endif()
elseif(CELERITY_SYCL_IMPL STREQUAL "ComputeCpp")
if(NOT DEFINED ComputeCpp_DIR AND NOT "@ComputeCpp_DIR@" STREQUAL "")
# ComputeCpp does not support find_dependency(PATHS)
set(ComputeCpp_DIR "@ComputeCpp_DIR@")
endif()
find_dependency(ComputeCpp REQUIRED)
elseif(CELERITY_SYCL_IMPL STREQUAL "DPC++")
include("${CELERITY_CMAKE_DIR}/TestDPCXX.cmake")
test_cxx_compiler_is_dpcpp(CXX_COMPILER_IS_DPCPP)
if(NOT CXX_COMPILER_IS_DPCPP)
message(ERROR "Celerity was built against DPC++, but CMAKE_CXX_COMPILER does not point to DPC++")
message(SEND_ERROR "Celerity was built against DPC++, but CMAKE_CXX_COMPILER does not point to DPC++")
endif()
endif()

Expand Down

0 comments on commit 4e88657

Please sign in to comment.