forked from dune-community/dune-gdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
137 lines (112 loc) · 4.97 KB
/
CMakeLists.txt
File metadata and controls
137 lines (112 loc) · 4.97 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# ~~~
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# Felix Schindler (2012 - 2018)
# René Fritze (2014, 2016 - 2018)
# Sven Kaulmann (2013)
# Tim Keil (2018)
# Tobias Leibner (2016, 2018 - 2021)
# ~~~
cmake_minimum_required(VERSION 3.29...4.0)
# To allow VERSION
cmake_policy(SET CMP0048 NEW)
# do not load custom FindBoost, use standard find_package mechanisms
cmake_policy(SET CMP0167 NEW)
# We automatically determine our PROJECT_VERSION from git, which needs to happen before the project() call.
include(cmake/DuneGdtVersioneer.cmake)
include(cmake/VcpkgBootStrap.cmake)
project(
dune-gdt
VERSION ${PROJECT_VERSION}
DESCRIPTION "Generic discretization toolbox for grid-based numerical methods."
HOMEPAGE_URL "https://github.com/dune-gdt/dune-gdt/"
LANGUAGES CXX)
if("${TRAVIS}" EQUAL "1")
add_compile_options(-Werror -Wno-error=unknown-pragmas -Wno-error=pedantic)
endif()
# allow dune to see imported targets across modules
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON)
# let 'find_package' know where modules can be found once configured removed dune-grid-glue: our gridview wrapper will
# need changes to work again. Seems Entity types on the glued view are different than in 2.7 removed dune-uggrid: lots
# of undefined refs
set(DUNE_SUBMODULES "dune-common;dune-geometry;dune-grid;dune-istl;dune-testtools;dune-localfunctions;dune-alugrid")
foreach(module IN LISTS DUNE_SUBMODULES)
find_package(${module} CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${${module}_MODULE_PATH})
endforeach()
# optional
find_package(dune-uggrid CONFIG)
if(Alberta_FOUND)
# alberta itself does not export its dependencies, so we need to find them manually
find_library(TIRPC_LIB tirpc REQUIRED)
endif()
find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG REQUIRED)
set(GRID_LIBS Dune::ALUGrid Dune::Grid Dune::ISTL Dune::Geometry)
# find_program(RUN_IN_ENV_SCRIPT gdt-run-in-dune-env PATHS /usr/local/bin/ ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}/../dune-testtools/ REQUIRED) execute_process(COMMAND ln -s ${RUN_IN_ENV_SCRIPT}
# ${CMAKE_CURRENT_BINARY_DIR}/gdt-run-in-dune-env)
# include the dune macros
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
include(DuneMacros)
include(DuneUtils)
# start a dune project with information from dune.module
dune_project()
if(DUNE_XT_WITH_PYTHON_BINDINGS)
dune_enable_all_packages(INCLUDE_DIRS ${dune-gdt_SOURCE_DIR}/dune ${Python3_INCLUDE_DIRS} MODULE_LIBRARIES dunegdt)
else()
dune_enable_all_packages(INCLUDE_DIRS ${dune-gdt_SOURCE_DIR}/dune ${Python3_INCLUDE_DIRS})
endif()
# (re-)set version info from git if available
include(DuneXtVersionHelper)
dune_xt_module_version_from_git()
dune_enable_all_packages(
INCLUDE_DIRS
${dune-gdt_SOURCE_DIR}/dune
${Python3_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/deps/pybind11/include
MODULE_LIBRARIES
gtest_dune_xt
dunext)
if(NOT DXT_DONT_LINK_PYTHON_LIB)
target_link_libraries(dunext INTERFACE ${Python3_LIBRARIES})
endif()
target_include_directories(dunext SYSTEM INTERFACE $<BUILD_INTERFACE:${pybind11_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# target_include_directories( dunext SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/deps/pybind11/include)
target_compile_features(dunext INTERFACE cxx_inheriting_constructors cxx_user_literals cxx_right_angle_brackets)
# ----------------------------------------------------------------------------------------------------
# General Settings
# ----------------------------------------------------------------------------------------------------
# search for spe10 data files
find_file(
SPE10MODEL1DATA
NAMES perm_case1.dat
PATHS "${dune-gdt_SOURCE_DIR}/../local/src/spe10/model1"
DOC "Location of perm_case1.dat"
NO_DEFAULT_PATH)
# silence most warnings we are not responsible for
make_dependent_modules_sys_included()
# do not change order here
add_subdirectory(python)
make_dependent_modules_sys_included()
# TODO: this isn't actually the way to do it??? enable headercheck add_definitions("-DENABLE_HEADERCHECK=1")
include(GridUtils)
add_header_listing()
add_subdirectory(dune)
add_subdirectory("cmake/modules")
add_subdirectory(examples)
add_subdirectory(tutorials)
add_tidy(${CMAKE_CURRENT_SOURCE_DIR})
add_pylicense()
dxt_exclude_from_headercheck(${CMAKE_SOURCE_DIR}/.vcpkg-root)
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# patch config.h to remove warnings about unused HAVE_GRIDTYPE
execute_process(
COMMAND sed -i -e "s,^\\([ ]*\\)\#if HAVE_GRIDTYPE$,\\1\#if defined(HAVE_GRIDTYPE) \\&\\& HAVE_GRIDTYPE,g"
${CMAKE_CURRENT_BINARY_DIR}/config.h)