Skip to content

Commit d1fc16e

Browse files
Add SOFA algorithm implementation
1 parent adb73d1 commit d1fc16e

4 files changed

Lines changed: 1190 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ option(BUILD_TESTS "Build test executables" OFF)
3737
option(BUILD_ODYSSEY "Build Odyssey components with MPI support" OFF)
3838
option(ODYSSEY_DEBUG_RESULTS "Print Odyssey search results (query_result) for debug before copy to I,D" OFF)
3939
option(BUILD_SING "Enable CUDA support" OFF)
40+
option(BUILD_SOFA "Build SOFA with FFTW3 support" OFF)
4041

4142
# Backward compatibility: ENABLE_MPI and ODYSSEY_MPI map to BUILD_ODYSSEY
4243
if(DEFINED ENABLE_MPI)
@@ -214,6 +215,31 @@ else()
214215
endif()
215216
endif()
216217

218+
if (BUILD_SOFA)
219+
if(DEBUG_MSG)
220+
message(STATUS "Attempting to build with SOFA support (BUILD_SOFA is ON)...")
221+
endif()
222+
223+
find_package(FFTW3 QUIET COMPONENTS single)
224+
225+
if(FFTW3_FOUND)
226+
set(BUILD_SOFA_AVAILABLE TRUE CACHE INTERNAL "Internal flag indicating if FFTW3 is available." FORCE)
227+
if(DEBUG_MSG)
228+
message(STATUS "FFTW3 found and will be used for SOFA components.")
229+
endif()
230+
else()
231+
if(DEBUG_MSG)
232+
message(WARNING "FFTW3 not found. Skipping SOFA FFTW3 components.")
233+
endif()
234+
set(BUILD_SOFA_AVAILABLE FALSE CACHE INTERNAL "Internal flag indicating if FFTW3 is available." FORCE)
235+
endif()
236+
else()
237+
if(DEBUG_MSG)
238+
message(STATUS "Building without SOFA support (BUILD_SOFA is OFF)")
239+
endif()
240+
set(BUILD_SOFA_AVAILABLE FALSE CACHE INTERNAL "Internal flag indicating if FFTW3 is available." FORCE)
241+
endif()
242+
217243
if(BUILD_TESTS)
218244
include(CTest)
219245
enable_testing()

lib/algos/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,29 @@ if(DEBUG_MSG)
5252
message(STATUS "Messi.cpp added (commented out).")
5353
endif()
5454

55+
# ///// SOFA //////
56+
if (BUILD_SOFA_AVAILABLE)
57+
if(DEBUG_MSG)
58+
message(STATUS "Adding Sofa.cpp to dino_lib sources.")
59+
endif()
60+
target_sources(dino_lib
61+
PRIVATE
62+
${CMAKE_CURRENT_SOURCE_DIR}/Sofa.cpp
63+
${CMAKE_CURRENT_SOURCE_DIR}/../isax/iSAXSearch.cpp
64+
)
65+
if(DEBUG_MSG)
66+
message(STATUS "Sofa.cpp added")
67+
endif()
68+
69+
target_compile_definitions(dino_lib PUBLIC SOFA_FFTW_ENABLED)
70+
target_link_libraries(dino_lib PUBLIC FFTW3::fftw3f)
71+
else()
72+
if(DEBUG_MSG)
73+
message(STATUS "BUILD_SOFA_AVAILABLE is FALSE. Skipping SOFA sources (requires FFTW3).")
74+
endif()
75+
endif()
76+
77+
5578
# ////// ODYSSEY //////
5679
if (BUILD_ODYSSEY_AVAILABLE)
5780
if(DEBUG_MSG)

0 commit comments

Comments
 (0)