Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make work with CMake MUMPS package #536

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type (Release, Debug, RelWithDebugInfo, MinSizeRel)")
ENDIF()

CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)

PROJECT(Elmer Fortran C CXX)

Expand Down Expand Up @@ -105,15 +105,6 @@ SET(USE_CONTIGUOUS FALSE CACHE BOOL "Use contiguous attribute")

MARK_AS_ADVANCED(WITH_ELMERPOST)

# if("${CMAKE_VERSION}" VERSION_GREATER 2.8.12)
# CMAKE_POLICY(SET CMP0022 OLD)
# ENDIF()

OPTION (USE_NEW_POLICY_CMP0057 "Option to enable new policy CMP0057" ON)
IF (USE_NEW_POLICY_CMP0057)
CMAKE_POLICY(SET CMP0057 NEW)
ENDIF()

MARK_AS_ADVANCED(ELMER_INSTALL_LIB_DIR)

INCLUDE(CTest)
Expand Down Expand Up @@ -507,9 +498,21 @@ SET(CMAKE_REQUIRED_LIBRARIES

IF(MPI_FOUND)
# Mumps
IF(WITH_Mumps)
FIND_PACKAGE(Mumps REQUIRED)
ENDIF()
if(WITH_Mumps)
find_package(MUMPS CONFIG)
if(MUMPS_FOUND)
set(Mumps_FOUND true)
set(Mumps_LIBRARIES ${MUMPS_LIBRARIES})
set(Mumps_INCLUDE_DIR ${MUMPS_INCLUDE_DIRS})
if(MUMPS_METIS_FOUND)
set(Metis_FOUND true)
set(Metis_LIBRARIES ${METIS_LIBRARIES})
set(Metis_INCLUDE_DIR ${METIS_INCLUDE_DIRS})
endif()
else()
FIND_PACKAGE(Mumps REQUIRED)
endif()
endif()
Comment on lines -510 to +515
Copy link
Contributor

@mmuetzel mmuetzel Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more similar to what is done for a similar situation with UMFPACK or CHOLMOD, would it be possible to move this to FindMumps.cmake?
See, e.g.,

# Try to find with CMake config file of upstream UMFPACK.
FIND_PACKAGE(UMFPACK CONFIG)
IF(UMFPACK_LIBRARIES AND UMFPACK_INCLUDE_DIR)
RETURN()
ENDIF()
.

You'll probably need to move that upper-case to lower-case translation to that file, too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As background for why moving that part to FindMumps.cmake would be nice:
Currently, ElmerFEM doesn't install .cmake files. (It only optionally installs pkg-config files.) But if at some point in the future a feature that installs cmake modules alongside ElmerFEM should be integrated, that hunk of logic would need to be repeated wherever those installed .cmake modules would be used in downstream code.
It would be a lot cleaner if that hunk of logic would be integrated in the existing FindMUMPS.cmake file.

# Hypre
IF(WITH_Hypre)
FIND_PACKAGE(Hypre REQUIRED OPTIONAL_COMPONENTS Euclid parcsr_ls ParaSails IJ_mv FEI core QUIET)
Expand Down
4 changes: 2 additions & 2 deletions ElmerGUIlogger/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
MESSAGE(STATUS "------------------------------------------------")

Expand All @@ -19,7 +19,7 @@ IF(WITH_QT5)
MESSAGE(STATUS " [ElmerGUIlogger] Qt5: " ${Qt5_FOUND})
MESSAGE(STATUS " [ElmerGUIlogger] Qt5 Libraries: ${Qt5OpenGL_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Script_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5PrintSupport_LIBRARIES}")
MESSAGE(STATUS "------------------------------------------------")
ELSE()
ELSE()
MESSAGE(STATUS "------------------------------------------------")
FIND_PACKAGE(Qt4 COMPONENTS QtOpenGL QtXml QtScript QtGui QtCore REQUIRED)
MESSAGE(STATUS " [ElmerGUIlogger] Qt4: " ${Qt4_FOUND})
Expand Down
2 changes: 1 addition & 1 deletion ElmerGUItester/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)
PROJECT(ElmerGUItester CXX)


Expand Down
6 changes: 3 additions & 3 deletions elmerice/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)
PROJECT(ElmerIceTests Fortran C)

SET(ELMERGRID_BIN "${CMAKE_BINARY_DIR}/elmergrid/src/ElmerGrid")
Expand Down Expand Up @@ -68,12 +68,12 @@ FOREACH(_file ${ELMERICE_TEST_FILES})
ENDIF()
ENDFOREACH()



#IF(NOT(CMAKE_BUILD_TYPE MATCHES "Rel"))
#INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/. #
# DESTINATION ${CMAKE_BINARY_DIR}/elmericetests#
# FILES_MATCHING REGEX
# FILES_MATCHING REGEX
# ".+\\.(f90|F90|sif|mif|grd|eg|msh|good|dat|pos|result|in2d|best0|txt)|HB|Makefile|TEST\\.RESULT|ELMERSOLVER_STARTINFO|mesh\\.*|DATA|PROG")
#
#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Compare.f90
Expand Down
10 changes: 5 additions & 5 deletions fem/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)
PROJECT(ElmerTests Fortran C)

#ADD_EXECUTABLE(findnorm findnorm_cmake.c)
Expand All @@ -15,7 +15,7 @@ SET(MESH2D_BIN "${CMAKE_BINARY_DIR}/meshgen2d/src/Mesh2D")
MACRO(SUBDIRLIST result curdir depth)
set(glob_pattern "*")
FOREACH(D RANGE 1 ${depth})
FILE(GLOB children RELATIVE ${curdir} ${glob_pattern})
FILE(GLOB children RELATIVE ${curdir} ${glob_pattern})
FOREACH(child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
LIST(APPEND dirlist ${child})
Expand Down Expand Up @@ -55,9 +55,9 @@ FOREACH(_subdir ${TEST_SUBDIRS})
ENDFOREACH()

IF(INSTALL_OLD_TESTS)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.
DESTINATION ${CMAKE_BINARY_DIR}/elmertests
FILES_MATCHING REGEX
FILES_MATCHING REGEX
".+\\.(f90|F90|sif|mif|grd|eg|msh|good|dat|pos|result|in2d|best0)|HB|Makefile|TEST\\.RESULT|ELMERSOLVER_STARTINFO|mesh\\.*")

# Misc. directories for meshes etc.
Expand All @@ -71,7 +71,7 @@ IF(INSTALL_OLD_TESTS)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/findnorm.c
${CMAKE_CURRENT_SOURCE_DIR}/ElmerSolver_test_how-to.txt
DESTINATION ${CMAKE_BINARY_DIR}/elmertests)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtests
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtests
DESTINATION ${CMAKE_BINARY_DIR}/elmertests)
ENDIF(INSTALL_OLD_TESTS)

Expand Down
2 changes: 1 addition & 1 deletion post/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.10...3.12)
PROJECT(ElmerPost Fortran C CXX)

SET(CMAKE_MODULE_PATH ${CMAKE_ROOT}/Modules "${PROJECT_SOURCE_DIR}/cmake/Modules" )
Expand Down
Loading