Skip to content

Commit dec963d

Browse files
author
Felix Schurk
committed
update CMakeLists to "work" with Catalyst
* error if find_path imports to GLOBAL * link error if catalyst::catalyst
1 parent 7b6e9de commit dec963d

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

CMakeLists.txt

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ set (IPPL_VERSION_NAME "V${IPPL_VERSION_MAJOR}.${IPPL_VERSION_MINOR}")
77

88
set (IPPL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
99

10+
include(CMakePrintHelpers)
11+
1012
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
11-
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
12-
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
13-
FORCE
14-
)
13+
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
14+
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
15+
FORCE
16+
)
1517
endif ()
1618

1719
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
18-
add_definitions (-DNOPAssert)
20+
add_definitions (-DNOPAssert)
1921
endif ()
2022

2123
add_compile_options (-Wall)
@@ -39,7 +41,7 @@ set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
3941

4042
# Compile using C++20 for CPU builds
4143
if (${CMAKE_CXX_COMPILER} MATCHES ".*mpicxx")
42-
set (CMAKE_CXX_STANDARD 20)
44+
set (CMAKE_CXX_STANDARD 20)
4345
endif ()
4446

4547

@@ -59,9 +61,9 @@ find_package(Kokkos REQUIRED)
5961

6062
option (ENABLE_FFT "Enable FFT transform" OFF)
6163
if (ENABLE_FFT)
62-
add_definitions (-DENABLE_FFT)
63-
find_package(Heffte 2.2.0 REQUIRED)
64-
message (STATUS "Found Heffte_DIR: ${Heffte_DIR}")
64+
add_definitions (-DENABLE_FFT)
65+
find_package(Heffte 2.2.0 REQUIRED)
66+
message (STATUS "Found Heffte_DIR: ${Heffte_DIR}")
6567
endif ()
6668

6769
option (ENABLE_SOLVERS "Enable IPPL solvers" OFF)
@@ -70,26 +72,31 @@ add_subdirectory (src)
7072

7173
option (ENABLE_TESTS "Enable IPPL tests" OFF)
7274
if (ENABLE_TESTS)
73-
add_subdirectory (test)
75+
add_subdirectory (test)
7476
endif ()
7577

7678
option (ENABLE_ALPINE, "Enable Alpine" OFF)
7779
if (ENABLE_ALPINE)
78-
if (NOT ENABLE_SOLVERS)
79-
message (FATAL_ERROR "Cannot enable Alpine since Solver not enabled (-DENABLE_SOLVERS=ON)!")
80-
endif ()
81-
if (NOT ENABLE_FFT)
82-
message (FATAL_ERROR "Cannot enable Alpine since FFT not enabled (-DENABLE_FFT=ON)!")
83-
endif ()
84-
message (STATUS "Enable Alpine")
85-
add_subdirectory (alpine)
80+
if (NOT ENABLE_SOLVERS)
81+
message (FATAL_ERROR "Cannot enable Alpine since Solver not enabled (-DENABLE_SOLVERS=ON)!")
82+
endif ()
83+
if (NOT ENABLE_FFT)
84+
message (FATAL_ERROR "Cannot enable Alpine since FFT not enabled (-DENABLE_FFT=ON)!")
85+
endif ()
86+
message (STATUS "Enable Alpine")
87+
add_subdirectory (alpine)
8688
endif ()
8789

8890
option(ENABLE_CATALYST "Build example with Catalyst enabled" ON)
8991
if (ENABLE_CATALYST)
9092
get_property(importTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
9193

92-
find_package(catalyst REQUIRED)
94+
find_package(catalyst 2.0 REQUIRED)
95+
96+
cmake_print_properties(
97+
TARGETS catalyst::catalyst
98+
PROPERTIES POSITION_INDEPENDENT_CODE
99+
)
93100
get_property(importTargetsAfter DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
94101
list(REMOVE_ITEM importTargetsAfter ${importTargets})
95102

@@ -100,18 +107,18 @@ endif ()
100107

101108
option (ENABLE_UNIT_TESTS "Enable unit tests" OFF)
102109
if (ENABLE_UNIT_TESTS)
103-
find_package (GTest REQUIRED HINT $ENV{GTEST_PREFIX})
104-
add_subdirectory (unit_tests)
110+
find_package (GTest REQUIRED HINT $ENV{GTEST_PREFIX})
111+
add_subdirectory (unit_tests)
105112
endif ()
106113

107114
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
108-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake )
115+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake )
109116

110117
install (
111-
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake
112-
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}"
113-
RENAME ${PROJECT_NAME}Config.cmake
114-
)
118+
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake
119+
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}"
120+
RENAME ${PROJECT_NAME}Config.cmake
121+
)
115122

116123
# vi: set et ts=4 sw=4 sts=4:
117124

alpine/ChargedParticles.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//
1818

1919
#include "Ippl.h"
20-
#include <catalyst.hpp>
20+
#include <catalyst-2.0/catalyst.hpp>
2121

2222
#include "Solver/ElectrostaticsCG.h"
2323
#include "Solver/FFTPeriodicPoissonSolver.h"

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ include_directories (
9595
9696
add_library ( ippl ${IPPL_SRCS} ${IPPL_SRCS_FORT} )
9797
98-
target_link_libraries(ippl PUBLIC Kokkos::kokkos ${HEFFTE_LIBRARY} catalyst::catalyst)
98+
target_link_libraries(ippl PUBLIC Kokkos::kokkos ${HEFFTE_LIBRARY} catalyst)
9999
100100
install (TARGETS ippl DESTINATION lib)
101101
install (FILES ${IPPL_BASEDIR_HDRS} DESTINATION include)

0 commit comments

Comments
 (0)