-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
From 8333d5e6ff4665d12cbbd5bae5150bfff5be2daa Mon Sep 17 00:00:00 2001 | ||
From: Vicente Adolfo Bolea Sanchez <[email protected]> | ||
Date: Thu, 10 Aug 2023 18:19:27 -0400 | ||
Subject: [PATCH] cmake: Add Blosc2 2.10.1 compatibility. | ||
|
||
- Give priority to Blosc2Config.cmake file rather than FindBlosc2.cmake. | ||
- Prefer shared Blosc2 library. | ||
|
||
Co-Authored-By: Axel Huebl <[email protected]> | ||
--- | ||
CMakeLists.txt | 2 ++ | ||
cmake/DetectOptions.cmake | 25 ++++++++++++++++++++++--- | ||
source/adios2/CMakeLists.txt | 6 ++++-- | ||
3 files changed, 28 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index ad70e1817b..638cc06fed 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -197,6 +197,8 @@ if(ADIOS2_HAVE_MPI) | ||
add_definitions(-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX) | ||
endif() | ||
|
||
+cmake_dependent_option(ADIOS2_Blosc2_PREFER_SHARED "Prefer shared Blosc2 libraries" | ||
+ ON "Blosc2_shlib_available" OFF) | ||
|
||
#------------------------------------------------------------------------------# | ||
# POSIX O_DIRECT is only working for Unix in adios for now | ||
diff --git a/cmake/DetectOptions.cmake b/cmake/DetectOptions.cmake | ||
index 99d2d45cb1..5b71c1565b 100644 | ||
--- a/cmake/DetectOptions.cmake | ||
+++ b/cmake/DetectOptions.cmake | ||
@@ -69,12 +69,31 @@ endfunction() | ||
|
||
# Blosc2 | ||
if(ADIOS2_USE_Blosc2 STREQUAL AUTO) | ||
- find_package(Blosc2 2.4) | ||
+ # Prefect CONFIG mode | ||
+ find_package(Blosc2 2.4 CONFIG QUIET) | ||
+ if(NOT Blosc2_FOUND) | ||
+ find_package(Blosc2 2.4 MODULE QUIET) | ||
+ endif() | ||
elseif(ADIOS2_USE_Blosc2) | ||
- find_package(Blosc2 2.4 REQUIRED) | ||
+ # Prefect CONFIG mode | ||
+ find_package(Blosc2 2.4 CONFIG REQUIRED) | ||
+ if(NOT Blosc2_FOUND) | ||
+ find_package(Blosc2 2.4 MODULE REQUIRED) | ||
+ endif() | ||
endif() | ||
-if(BLOSC2_FOUND) | ||
+if(Blosc2_FOUND) | ||
set(ADIOS2_HAVE_Blosc2 TRUE) | ||
+ if(TARGET Blosc2::blosc2_shared) | ||
+ set(Blosc2_shlib_available ON) | ||
+ endif() | ||
+ | ||
+ set(adios2_blosc2_tgt Blosc2::Blosc2) | ||
+ if (Blosc2_VERSION VERSION_GREATER_EQUAL 2.10.1) | ||
+ set(adios2_blosc2_tgt Blosc2::blosc2_$<IF:$<BOOL:${ADIOS2_Blosc2_PREFER_SHARED}>,shared,static>) | ||
+ endif() | ||
+ | ||
+ add_library(adios2_blosc2 INTERFACE) | ||
+ target_link_libraries(adios2_blosc2 INTERFACE ${adios2_blosc2_tgt}) | ||
endif() | ||
|
||
# BZip2 | ||
diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt | ||
index 659ca94e70..8ce49a6904 100644 | ||
--- a/source/adios2/CMakeLists.txt | ||
+++ b/source/adios2/CMakeLists.txt | ||
@@ -273,9 +273,11 @@ if(ADIOS2_HAVE_DataSpaces) | ||
target_link_libraries(adios2_core_mpi PRIVATE DataSpaces::DataSpaces) | ||
endif() | ||
|
||
+set(maybe_adios2_blosc2) | ||
if(ADIOS2_HAVE_Blosc2) | ||
target_sources(adios2_core PRIVATE operator/compress/CompressBlosc.cpp) | ||
- target_link_libraries(adios2_core PRIVATE Blosc2::Blosc2) | ||
+ target_link_libraries(adios2_core PRIVATE adios2_blosc2) | ||
+ set(maybe_adios2_blosc2 adios2_blosc2) | ||
endif() | ||
|
||
if(ADIOS2_HAVE_BZip2) | ||
@@ -448,7 +450,7 @@ install(DIRECTORY toolkit/ | ||
) | ||
|
||
# Library installation | ||
-install(TARGETS adios2_core ${maybe_adios2_core_mpi} ${maybe_adios2_core_cuda} ${maybe_adios2_core_kokkos} EXPORT adios2Exports | ||
+install(TARGETS adios2_core ${maybe_adios2_core_mpi} ${maybe_adios2_core_cuda} ${maybe_adios2_core_kokkos} ${maybe_adios2_blosc2} EXPORT adios2Exports | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_core-runtime | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-libraries NAMELINK_COMPONENT adios2_core-development | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters