Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 1c053072 authored by Manuel Winkler's avatar Manuel Winkler
Browse files

Add FetchContent to cmake build and link properly

parent e18474e1
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required (VERSION 3.20.3)
project (OPALX VERSION 2024.1.00 LANGUAGES C CXX)
include(FetchContent)
set (PROJECT_BUGREPORT opal@lists.psi.ch)
set (OPALX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
......@@ -72,26 +73,36 @@ message (STATUS "The C++ compiler version is: ${CMAKE_CXX_COMPILER_VERSION}")
message (STATUS "The MPI C++ compiler is: ${MPI_CXX_COMPILER}")
message (STATUS "The underlying C++ compiler is: ${CMAKE_CXX_COMPILER}")
find_package(Heffte 2.2.0 REQUIRED)
message (STATUS "Found Heffte_DIR: ${Heffte_DIR}")
find_library(HEFFTE_LIBRARY heffte HINTS ${Heffte_DIR}/../..)
message (STATUS "Found HEFFTE lib: ${HEFFTE_LIBRARY}")
find_package(Kokkos REQUIRED)
message (STATUS "Found Kokkos_DIR: ${Kokkos_DIR}")
if ("${Kokkos_DEVICES}" MATCHES "CUDA")
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -G --diag-suppress=20011")
endif()
find_library(KOKKOS_LIBRARY1 NAMES kokkoscore HINTS ${Kokkos_DIR}/../..)
find_library(KOKKOS_LIBRARY2 NAMES kokkoscontainers HINTS ${Kokkos_DIR}/../..)
find_library(KOKKOS_LIBRARY3 NAMES kokkossimd HINTS ${Kokkos_DIR}/../..)
message (STATUS "Found Kokkos lib: ${KOKKOS_LIBRARY1}:${KOKKOS_LIBRARY2}:${KOKKOS_LIBRARY3}")
#find_package(Heffte 2.2.0 REQUIRED)
#message (STATUS "Found Heffte_DIR: ${Heffte_DIR}")
#find_library(HEFFTE_LIBRARY heffte HINTS ${Heffte_DIR}/../..)
#message (STATUS "Found HEFFTE lib: ${HEFFTE_LIBRARY}")
#
#
#find_package(Kokkos REQUIRED)
#message (STATUS "Found Kokkos_DIR: ${Kokkos_DIR}")
#if ("${Kokkos_DEVICES}" MATCHES "CUDA")
# set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -G --diag-suppress=20011")
#endif()
#find_library(KOKKOS_LIBRARY1 NAMES kokkoscore HINTS ${Kokkos_DIR}/../..)
#find_library(KOKKOS_LIBRARY2 NAMES kokkoscontainers HINTS ${Kokkos_DIR}/../..)
#find_library(KOKKOS_LIBRARY3 NAMES kokkossimd HINTS ${Kokkos_DIR}/../..)
#message (STATUS "Found Kokkos lib: ${KOKKOS_LIBRARY1}:${KOKKOS_LIBRARY2}:${KOKKOS_LIBRARY3}")
find_package (Ippl REQUIRED)
message (STATUS "Found IPPL_DIR: ${IPPL_DIR}")
find_library(IPPL_LIBRARY ippl HINTS ${IPPL_LIBRARY_DIR})
if(NOT IPPL_VERSION)
set(IPPL_VERSION "3.2.0")
message(STATUS "Defaulting to IPPL-${IPPL_VERSION}")
endif()
FetchContent_Declare(ippl
#URL https://github.com/IPPL-framework/ippl/archive/refs/tags/IPPL-${IPPL_VERSION}.tar.gz
GIT_REPOSITORY https://github.com/IPPL-framework/ippl.git
GIT_SHALLOW True
DOWNLOAD_EXTRACT_TIMESTAMP True
)
FetchContent_MakeAvailable(ippl)
include_directories("${IPPL_SOURCE_DIR}/src")
#find_library(IPPL_LIBRARY ippl HINTS ${IPPL_LIBRARY_DIR})
message (STATUS "Found Ippl_INC: ${IPPL_INCLUDE_DIR}")
message (STATUS "Found Ippl_LIB: ${IPPL_LIBRARY}")
......
......@@ -89,14 +89,18 @@ add_library (libOPAL ${OPAL_SRCS})
set_target_properties (libOPAL PROPERTIES OUTPUT_NAME OPAL)
target_link_libraries (libOPAL
PUBLIC
${MPI_CXX_LIBRARIES}
)
ippl
Heffte
)
message (STATUS "OPAL_LIBS is: " ${CMAKE_BINARY_DIR})
add_executable (opalx Main.cpp)
target_link_libraries( opalx
${CMAKE_BINARY_DIR}/src/libOPAL.a
PUBLIC
libOPAL
${KOKKOS_LIBRARY1}
${KOKKOS_LIBRARY2}
${KOKKOS_LIBRARY3}
......@@ -133,4 +137,4 @@ set (HDRS
changes.h
)
install (FILES ${HDRS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/src")
\ No newline at end of file
install (FILES ${HDRS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/src")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment