-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
113 lines (89 loc) · 3.77 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
109
110
111
112
113
# ~~~
# This file is part of the dune-xt project:
# https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt
# Copyright 2009-2021 dune-xt 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, 2020)
# René Fritze (2010 - 2020)
# Sven Kaulmann (2013)
# Tim Keil (2018)
# Tobias Leibner (2016, 2018 - 2021)
# ~~~
cmake_minimum_required(VERSION 3.13)
project("dune-xt" CXX)
if("${TRAVIS}" EQUAL "1")
add_compile_options(-Werror -Wno-error=unknown-pragmas -Wno-error=pedantic)
endif()
# local environment
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../local/bin:$ENV{PATH}")
set(ENV{LD_LIBRARY_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../local/lib:$ENV{LD_LIBRARY_PATH}")
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../local/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
set(CMAKE_COLOR_MAKEFILE ON)
# guess dune-common build dir
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} ${PROJECT_SOURCE_DIR}/cmake/modules)
# include the dune macros
include(DuneMacros)
include(DuneUtils)
# start a dune project with information from dune.module
dune_project()
# (re-)set version info from git if available
include(DuneXtVersionHelper)
dune_xt_module_version_from_git(dune-xt)
# dune-xt cmake includes
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
add_subdirectory(pybind11)
dune_enable_all_packages(
INCLUDE_DIRS
${dune-xt_SOURCE_DIR}/dune
${Python3_INCLUDE_DIRS}
MODULE_LIBRARIES
dunepybindxi
gtest_dune_xt
dunext)
target_link_libraries(dunepybindxi PRIVATE pybind11::module)
target_link_libraries(dunepybindxi PRIVATE ${Python3_LIBRARIES})
target_link_libraries(dunext INTERFACE ${Python3_LIBRARIES})
target_include_directories(dunepybindxi PRIVATE pybind11::module)
# ----------------------------------------------------------------------------------------------------
# General Settings
# ----------------------------------------------------------------------------------------------------
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/getRevision.sh
OUTPUT_VARIABLE COMMIT
ERROR_VARIABLE shell_error
OUTPUT_STRIP_TRAILING_WHITESPACE)
# silence most warnings we are not responsible for
include(DuneUtils)
make_dependent_modules_sys_included()
include(DunePybindxiInstallPythonPackage)
# this symlinks all files in python/ to the binary dir and install into the virtualenv from there thereby making the
# compiled extensions directly usable from the venv
dune_pybindxi_install_python_package(PATH python)
include_dependent_binary_python_dirs()
# install jinja2 for code generation into the dune-python virtualenv
execute_process(COMMAND ${DUNE_PYTHON_VIRTUALENV_EXECUTABLE} -m pip install jinja2 pytest-cov ipywidgets k3d xmljson
vtk lxml loguru)
add_subdirectory(python)
include(GridUtils)
add_header_listing()
add_subdirectory(dune)
add_subdirectory("cmake/modules")
add_tidy(${CMAKE_CURRENT_SOURCE_DIR})
add_pylicense()
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)