diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index 46588c75ecdab1d6170ba7049ea3c16498b04bde..2882065524b34c6325ec0fb1150f7426e38d3f5e 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -5,7 +5,7 @@ append_source_files(SOURCES Curve) append_source_files(SOURCES InterpolationAlgorithms) append_source_files(SOURCES Integration) append_source_files(SOURCES LinAlg) -if(CVODE_FOUND) +if(OGS_USE_CVODE) append_source_files(SOURCES ODE) endif() append_source_files(SOURCES Nonlinear) @@ -26,8 +26,6 @@ target_include_directories(MathLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} $<$<BOOL:${OGS_USE_PETSC}>:${PETSC_INCLUDE_DIRS}> - PRIVATE - $<$<BOOL:${OGS_USE_CVODE}>:${CVODE_INCLUDE_DIRS}> ) set_target_properties(MathLib PROPERTIES LINKER_LANGUAGE CXX) @@ -38,6 +36,7 @@ target_link_libraries(MathLib ${OpenMP_CXX_LIBRARIES} $<$<TARGET_EXISTS:LAPACK::LAPACK>:LAPACK::LAPACK> $<$<BOOL:${OGS_USE_LIS}>:${LIS_LIBRARIES}> + $<$<BOOL:${OGS_USE_CVODE}>:CVODE::CVODE> Eigen3::Eigen PRIVATE spdlog::spdlog @@ -46,9 +45,6 @@ target_link_libraries(MathLib if(OGS_USE_PETSC) target_link_libraries(MathLib PUBLIC ${PETSC_LIBRARIES}) endif() -if(OGS_USE_CVODE) - target_link_libraries(MathLib PUBLIC ${CVODE_LIBRARIES}) -endif() if(OGS_USE_MKL) target_link_libraries(MathLib PUBLIC ${MKL_LIBRARIES}) endif() @@ -57,7 +53,7 @@ target_compile_definitions(MathLib PUBLIC $<$<BOOL:${USE_LIS}>:USE_LIS> $<$<BOOL:${OGS_USE_PETSC}>:USE_PETSC> - $<$<BOOL:${CVODE_FOUND}>:CVODE_FOUND> + $<$<BOOL:${OGS_USE_CVODE}>:CVODE_FOUND> PRIVATE $<$<BOOL:${OGS_USE_MKL}>:USE_MKL> ) diff --git a/scripts/cmake/ConanSetup.cmake b/scripts/cmake/ConanSetup.cmake index e367a5e5476794b2173198388eb56b476563b358..9b97ed7b29c59472ae1b453100839deb2a69dd94 100644 --- a/scripts/cmake/ConanSetup.cmake +++ b/scripts/cmake/ConanSetup.cmake @@ -62,10 +62,6 @@ if(OGS_USE_LIS) set(CONAN_REQUIRES ${CONAN_REQUIRES} lis/1.7.9@bilke/stable) endif() -if(OGS_USE_CVODE) - set(CONAN_REQUIRES ${CONAN_REQUIRES} cvode/2.8.2@bilke/stable) -endif() - if(OGS_USE_MFRONT) set(CONAN_REQUIRES ${CONAN_REQUIRES} tfel/3.3.0@bilke/testing) endif() diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index d4bc04adf3c2bc65678ffb5b5fd68d65678c3dda..ebb814b215a3dad0482abfbfc6e3ced7b12a3696 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -257,6 +257,27 @@ if(OGS_BUILD_GUI) endif() endif() +if(OGS_USE_CVODE) + CPMAddPackage( + NAME CVODE + GITHUB_REPOSITORY ufz/cvode + VERSION 2.8.2 + GIT_TAG 42d786bff4f950045d2de941677ecd4432cec855 + OPTIONS "EXAMPLES_ENABLE OFF" + ) + if(CVODE_ADDED) + add_library(CVODE::CVODE INTERFACE IMPORTED) + target_include_directories(CVODE::CVODE INTERFACE + ${CVODE_SOURCE_DIR}/include + ${CVODE_BINARY_DIR}/include + ) + target_link_libraries(CVODE::CVODE INTERFACE + sundials_cvode_static + sundials_nvecserial_static + ) + endif() +endif() + # Disable warnings foreach(TARGET ${DISABLE_WARNINGS_TARGETS}) target_compile_options(${TARGET} PRIVATE diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index a48c56a9d97647809052f848a59f4d0f33eb6f3f..1a2e1f2ba0a2bbfafbbd5368285c1a6306bf70d8 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -159,11 +159,6 @@ if(OGS_USE_MPI) find_package(MPI REQUIRED) endif() -## Sundials cvode ode-solver library -if(OGS_USE_CVODE) - find_package(CVODE REQUIRED) -endif() - find_package(Filesystem REQUIRED COMPONENTS Final Experimental) configure_file(${PROJECT_SOURCE_DIR}/BaseLib/filesystem.h.in ${PROJECT_BINARY_DIR}/BaseLib/filesystem.h)