-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
108 lines (88 loc) · 3.34 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.8)
project(mfem-mgis)
include(cmake/modules/mfem-mgis.cmake)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# (must be placed *before* any add_subdirectory, cmake bug ?)
include(CTest)
enable_testing()
# portable-build
option(enable-portable-build "produce binary that can be shared between various machine (same architecture, same gcc version, different processors" OFF)
#compiler options
include(cmake/modules/compiler.cmake)
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
include(cmake/modules/CodeCoverage.cmake)
SETUP_TARGET_FOR_COVERAGE(coverage ctest coverage)
endif(CMAKE_BUILD_TYPE STREQUAL "Coverage")
# MFEM
find_package(MFEM REQUIRED)
if (MFEM_USE_MPI)
message(STATUS "MFEM: using MPI, so mfem_mgis will use MPI")
find_package(MPI REQUIRED)
# The following include directories are automatically filled within FindMFEM.cmake
include_directories(SYSTEM ${HYPRE_INCLUDE_DIRS})
include_directories(SYSTEM ${METIS_INCLUDE_DIRS})
endif(MFEM_USE_MPI)
if (MFEM_USE_MUMPS)
find_package(OpenMP)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif (MFEM_USE_MUMPS)
# MFontGenericInterface
find_package (MFrontGenericInterface REQUIRED)
# Support for OpenMP
if(MFEM_USE_OPENMP OR MFEM_USE_LEGACY_OPENMP)
find_package(OpenMP REQUIRED)
endif(MFEM_USE_OPENMP OR MFEM_USE_LEGACY_OPENMP)
# find mfront for testing purposes
include(cmake/modules/tfel.cmake)
# documentation
if (NOT TARGET doc)
add_custom_target(doc)
endif(NOT TARGET doc)
option(enable-website "enable generation of the website" ON)
if(enable-website)
set(MFEMMGIS_GENERATE_WEBSITE ON)
# Looking for pandoc (http://johnmacfarlane.net/pandoc)
include(cmake/modules/pandoc.cmake)
if(MFEMMGIS_HAVE_PANDOC)
set(MFEMMGIS_GENERATE_WEBSITE ON)
endif(MFEMMGIS_HAVE_PANDOC)
if(MFEMMGIS_GENERATE_WEBSITE)
list(APPEND CPACK_COMPONENTS_ALL website)
set(CPACK_COMPONENT_WEBSITE_DESCRIPTION
"Contains the MFEM/MGIS web site")
endif(MFEMMGIS_GENERATE_WEBSITE)
else(enable-website)
set(MFEMMGIS_GENERATE_WEBSITE OFF)
message(STATUS "Generation of the MFEM/MGIS website disabled")
endif(enable-website)
# testing
set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
if(CMAKE_CONFIGURATION_TYPES)
if (NOT TARGET check)
add_custom_target(check COMMAND
${CMAKE_CTEST_COMMAND} -T test --output-on-failure -C $<CONFIGURATION>)
else(NOT TARGET check)
add_custom_target(mgis_check COMMAND
${CMAKE_CTEST_COMMAND} -T test --output-on-failure -C $<CONFIGURATION>)
endif(NOT TARGET check)
else(CMAKE_CONFIGURATION_TYPES)
if (NOT TARGET check)
add_custom_target(check COMMAND
${CMAKE_CTEST_COMMAND} -T test --output-on-failure )
else(NOT TARGET check)
add_custom_target(mgis_check COMMAND
${CMAKE_CTEST_COMMAND} -T test --output-on-failure )
endif(NOT TARGET check)
endif(CMAKE_CONFIGURATION_TYPES)
# HYPRE version
include(cmake/modules/hypre.cmake)
set(MFEM_HYPRE_VERSION ${HYPRE_VERSION})
add_compile_definitions(MFEM_HYPRE_VERSION=${MFEM_HYPRE_VERSION})
mfem_mgis_buildenv()
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(tests)