diff --git a/CMakeLists.txt b/CMakeLists.txt index 384eb58798739aa1409a429cf7fd2b6f9c3b4f15..31061b51e10f21433144c98aebaa47d75c2e2ba6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,9 @@ OPTION(OGS_BUILD_UTILS "Should the utilities programms be built?" OFF) OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF) +# Linear solvers +OPTION(OGS_USE_LIS "Use Lis" OFF) + # Logging OPTION(OGS_DISABLE_LOGGING "Disables all logog messages." OFF) diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index 4feea6704f4d5ca2c681a5bf9a4e3b3ca65ec3a5..9a761e75bb85d35d84437a43fe1f8135fbc38ad4 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -138,6 +138,15 @@ IF(Shapelib_FOUND) ADD_DEFINITIONS(-DShapelib_FOUND) ENDIF() # Shapelib_FOUND +## lis ## +IF(OGS_USE_LIS) + FIND_PACKAGE ( LIS REQUIRED ) + IF (LIS_FOUND) + INCLUDE_DIRECTORIES( ${LIS_INCLUDE_DIR} ) + ADD_DEFINITIONS(-DUSE_LIS) + ENDIF() +ENDIF() + ######################## ### Find other stuff ### ######################## diff --git a/scripts/cmake/cmake/FindLIS.cmake b/scripts/cmake/cmake/FindLIS.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f63536d51298756c95069571a9caddc8c6e74b6 --- /dev/null +++ b/scripts/cmake/cmake/FindLIS.cmake @@ -0,0 +1,48 @@ +# - Try to find LIS +# Once done, this will define +# +# LIS_FOUND +# LIS_INCLUDE_DIRS +# LIS_LIBRARIES + +if (NOT LIS_FOUND) + + include(LibFindMacros) + + find_path( LIS_INCLUDE_DIR + NAMES lis.h + PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled) + + if ( UNIX ) + # Tell if the unix system is on 64-bit base + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + find_library(LIS_LIBRARIES + NAMES lis-64 + PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled ) + else (CMAKE_SIZEOF_VOID_P MATCHES "8") + find_library(LIS_LIBRARIES + NAMES lis-32 + PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled ) + endif (CMAKE_SIZEOF_VOID_P MATCHES "8") + else ( UNIX ) + find_library(LIS_LIBRARIES + NAMES lisomp + PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled ) + endif ( UNIX ) + + # Set the include dir variables and the libraries and let libfind_process do the rest. + # NOTE: Singular variables for this library, plural for libraries this this lib depends on. + if (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND") + set(LIS_PROCESS_INCLUDES LIS_INCLUDE_DIR) + set(LIS_PROCESS_LIBS LIS_LIBRARIES) + libfind_process(LIS) + else (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND") + message (STATUS "Warning: LIS not found!") + endif (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND") + +endif (NOT LIS_FOUND) + +if(LIS_FOUND) + INCLUDE_DIRECTORIES( ${LIS_INCLUDE_DIR} ) + message(STATUS "LIS found (include: ${LIS_INCLUDE_DIR})") +endif(LIS_FOUND)