Skip to content

Commit

Permalink
cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Dec 17, 2024
1 parent b52486d commit d495351
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ set(ESPRESSO_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
# folder for C++ and CUDA shared objects
set(ESPRESSO_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

set(ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")

# python site-packages, can be overriden with CMake options
if(ESPRESSO_BUILD_WITH_PYTHON)
if(NOT ESPRESSO_INSTALL_PYTHON)
Expand Down Expand Up @@ -349,11 +351,12 @@ if(ESPRESSO_BUILD_WITH_GSL)
endif()

if(ESPRESSO_BUILD_WITH_STOKESIAN_DYNAMICS)
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}")
FetchContent_GetProperties(stokesian_dynamics)
set(STOKESIAN_DYNAMICS 1)
if(NOT stokesian_dynamics_POPULATED)
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}")
FetchContent_MakeAvailable(stokesian_dynamics)
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR}")
endif()
endif()

Expand Down Expand Up @@ -461,7 +464,8 @@ set(CMAKE_INSTALL_RPATH "${ESPRESSO_INSTALL_LIBDIR}")
#

# drop 'lib' prefix from all libraries
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(ESPRESSO_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}")

add_library(espresso_coverage_flags INTERFACE)
add_library(espresso::coverage_flags ALIAS espresso_coverage_flags)
Expand Down Expand Up @@ -684,9 +688,11 @@ if(ESPRESSO_BUILD_WITH_WALBERLA)
endif()
set(WALBERLA_BUILD_WITH_FASTMATH off CACHE BOOL "")
if(NOT walberla_POPULATED)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_SHARED_LIBRARY_PREFIX "libwalberla_")
FetchContent_MakeAvailable(walberla)
set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT})
set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}")
endif()
set(WALBERLA_LIBS
walberla::core walberla::domain_decomposition walberla::blockforest
Expand All @@ -704,13 +710,10 @@ if(ESPRESSO_BUILD_WITH_WALBERLA)
add_library(${target_w_namespace} ALIAS ${target_wo_namespace})
get_target_property(target_type ${target_wo_namespace} TYPE)
if(${target_type} STREQUAL "SHARED_LIBRARY")
install(
TARGETS ${target_wo_namespace}
LIBRARY DESTINATION ${ESPRESSO_INSTALL_PYTHON}/espressomd/_walberla)
install(TARGETS ${target_wo_namespace}
LIBRARY DESTINATION "${ESPRESSO_INSTALL_LIBDIR}")
endif()
endforeach()
set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_RPATH}:${ESPRESSO_INSTALL_PYTHON}/espressomd/_walberla")
if(ESPRESSO_BUILD_WITH_WALBERLA_AVX)
function(espresso_avx_flags_callback COMPILER_AVX2_FLAG)
target_compile_options(
Expand All @@ -731,8 +734,12 @@ if(ESPRESSO_BUILD_WITH_CALIPER)
set(CALIPER_INSTALL_HEADERS off CACHE BOOL "")
if(NOT caliper_POPULATED)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}")
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
FetchContent_MakeAvailable(caliper)
set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT})
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR}")
set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}")
endif()
target_compile_options(caliper-common
PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wno-restrict>)
Expand Down

0 comments on commit d495351

Please sign in to comment.