-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (69 loc) · 3.06 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
# SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
# SPDX-License-Identifier: LGPL-2.1-or-later
cmake_minimum_required(VERSION 3.16)
# set up project
project("dune-uggrid" C CXX)
#circumvent not building docs
set(BUILD_DOCS 1)
# Guess the dune-common build directory if it is not yet set
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
${PROJECT_BINARY_DIR})
endif()
#find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/modules")# make sure our own modules are found
#include the dune macros
include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
find_package(MPI)
# set defines that are only used internally.
# The rest is in cmake/modules/DuneUggrid.cmake
if(MPI_C_FOUND)
set(UG_ENABLE_PARALLEL True CACHE BOOL "Enable a parallel UG (default is True if MPI is there False otherwise)")
else()
set(UG_ENABLE_PARALLEL False CACHE BOOL "Enable a parallel UG (default is True if MPI is there False otherwise)")
endif()
set(UG_ENABLE_DEBUGGING False CACHE BOOL "Enable UG debugging (default is Off)")
set(UG_ENABLE_SYSTEM_HEAP ON CACHE BOOL "If ON/True then we are using the operating system heap instead of the one internal to UG (Default: ON)")
set(UG_DDD_MAX_MACROBITS "24" CACHE STRING
"Set number of bits of an unsigned int used to store the process number,
the remaining bits are used to store the local entity id")
set(DUNE_UGGRID_TET_RULESET True CACHE BOOL "Use complete rule set for refinement of tetrahedral elements")
if(TET_RULESET)
set(DUNE_UGGRID_TET_RULESET True)
message(DEPRECATION "The TET_RULESET option has been renamed to DUNE_UGGRID_TET_RULESET")
endif()
if(UG_ENABLE_DEBUGGING)
list(APPEND UG_COMPILE_DEFINITIONS "Debug")
set(UG_EXTRAFLAGS "${UG_EXTRAFLAGS} -DDebug")
endif()
#Always build parallel libs if MPI is found
if(UG_ENABLE_PARALLEL)
if(NOT MPI_C_FOUND)
message(SEND_ERROR "A parallel UG was requested but MPI was not found. Either change variable UG_ENABLE_PARALLEL or install MPI." )
endif()
list(APPEND UG_COMPILE_DEFINITIONS "ModelP")
set(UG_EXTRAFLAGS "${UG_EXTRAFLAGS} -DModelP")
endif()
# define target for duneuggrid
dune_add_library(duneuggrid EXPORT_NAME UGGrid)
target_compile_definitions(duneuggrid PUBLIC ${UG_COMPILE_DEFINITIONS})
target_link_libraries(duneuggrid PUBLIC Dune::Common)
add_dune_mpi_flags(duneuggrid)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(time.h HAVE_TIME_H)
if(HAVE_TIME_H AND HAVE_SYS_TIME_H)
set(TIME_WITH_SYS_TIME True)
endif()
add_subdirectory(dune)
add_subdirectory(cmake/modules)
# set variable names for config.h
set(DDD_MAX_PROCBITS_IN_GID ${UG_DDD_MACROBITS})
# finalize the dune project, e.g., generate config.h etc.
# Use package init to set additional information
set(dune-uggrid_INIT "set(UG_PARALLEL ${UG_ENABLE_PARALLEL})")
finalize_dune_project()