Compare commits

..

1 Commits

Author SHA1 Message Date
Gauthier Folzan 5c7a84b747 Using a unique multi-valued variant for defining the modules:
CON :
- Users have to give explicitly the list of required modules but the
  error message gives all the modules to add

PRO :
 - Does not hide automatic installed dependecies
   (with the one module - one variant, a module can be installed and the corresponding variant set to false)
 - Module dependencies is done when checking the arguments
 - Does not tamper with spack resource fetching
2020-05-16 01:36:48 +02:00
6 changed files with 176 additions and 431 deletions

View File

@ -1,6 +1,7 @@
---
before_script:
- pwd
- . /spack/share/spack/setup-env.sh
- spack repo add .

View File

@ -11,8 +11,8 @@ RUN export DEBIAN_FRONTEND=noninteractive; \
ca-certificates \
git \
procps \
python3 \
python3-dev \
python \
python-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
ARG version=master

143
README.md
View File

@ -1,139 +1,56 @@
# DISCLAIMER
This repository is in early experimental stage. As soon as it is mature, this disclaimer will be removed and the project will be publicly announced through the mailing list. Until then, you are invited to try this and report your experiences, but you might experience some problems.
This repository is in early experimental stage. As soon as it is mature,
this disclaimer will be removed and the project will be publicly announced
through the mailing list. Until then, you are invited to try this and report
your experiences, but you might experience some problems.
# Dune Spack repository
This repository defines a package `dune` for the Spack package manager. It allows to install the Dune core modules and many extension modules, as well as their dependent software with very few commands. The target audiences for Spack are:
* system administrators at HPC facilities that build scientific software stacks
* developers that are interested in OS-independent, consistent software stacks for their development
* new users that are interested in minimal installation procedures
More information on Spack can be found [in the official documentation](https://spack.readthedocs.io/en/latest/index.html).
The below instructions should explain the basics of Spack usage though.
## Prerequisites
Spack requires the following packages on the system:
* a C++ compiler
* a Python interpreter
* `make`
* `git`
* `curl`
If you are running Ubuntu or Debian, the following command will install the necessary requirements:
```
sudo apt-get install build-essential git curl python3
```
## Setting up Spack for Dune
The first step is to get the Spack sources via `git`:
## Installation
Clone spack git
```
git clone https://github.com/spack/spack.git
source ./share/spack/setup-env.sh
spack bootstrap
```
Then, you should add Spack to your shell environment:
add dune spack repo
```
source <path-to-spack>/share/spack/setup-env.sh
cd $HOME
git clone https://github.com/gauthier12/dune_spack_repo.git
spack repo add dune_spack_repo
```
This commmand needs to be rerun on any shell session, so you might want to consider adding it to your `~/.bashrc`.
Next, the dune-spack repository needs to be added to Spack's library of package specifications:
Install dune with desired modules
```
git clone https://gitlab.dune-project.org/spack/dune-spack.git
spack repo add dune-spack
spack install dune+desired+modules+.....
```
## Installing Dune!
You are now good to install Dune:
by example
```
spack install dune
spack install dune+uggrid+grid+functions
```
modules dependencies wil be automatically downloaded and added
This will install the latest release of the Dune core modules and all their dependencies. As Spack builds the entire dependency tree from source, this might take up to several hours. Also, this operation requires internet access as tarballs are fetched from the internet during the installation process (if you are in an isolated network environment, you should consult the Spack documentation).
After installation, the package can be loaded into the environment with:
## Use
To use dune, load the module
```
source /PATH/TO/SPACK/share/spack/setup-env.sh
spack load dune
```
if python module was installed, python bindings are avalaible after loading the module
## Customization of the Dune package
There is two main points about the Dune package that can be customized: *versions* and *variants*.
A summary of customization options can be shown with:
## Build a new module
### Load the dune module
```
spack info dune
```
Currently, three versions are implemented: `master`, `2.7` (default) and `2.6`. You can switch between them by specifying them with the `@` character. The following command installs a software stack based on the master branch of all Dune modules:
```
spack install dune@master
```
Variants describe optional components of Dune and are appended to the package name with the `+` character e.g. `dune+uggrid`. Again, a complete list of available variants is available with `spack info dune`. You can also inspect the DAG of the software stack that is going to be installed beforehand by running e.g.:
```
spack spec dune+fem+python
```
This will also throw a meaningful error message in case you requested an incompatible set of variants.
Note that it is possible to install the Dune package multiple times with differing versions and variants. When loading the Dune package, you need to identify the version you are loading by providing versions and variants or through Spack's build hash.
## Using the installed Dune package
Whenever you want to use the Spack-installed Dune, you need to make sure that you have `source`d Spack's setup script and loaded your Dune package:
```
source <path-to-spack>/share/spack/setup-env.sh
source /PATH/TO/SPACK/share/spack/setup-env.sh
spack load dune
```
If you now have any Dune module dune-foo you can simply run:
```
cd dune-foo
mkdir build
cd build
cmake ..
```
There is no need to run `dunecontrol`, a plain `cmake` call will correctly configure your module `dune-foo`. If you want to create a new module, you can do so by calling:
### Initialize dune project
```
duneproject
```
If you are interested in using the Python bindings for Dune, you should make sure to build with the `+python` variant. After loading the Dune module, you can run the Python interpreter and immediately run Python examples. For convenience, you might want to consider installing and loading additional tools though, e.g.:
Answer the questions about the new modules, enter the project folder and compile with standard cmake
```
spack install jupyter
spack load jupyter
mkdir build
cd build
cmake ..
cmake --build .
```
## Troubleshooting
Spack is a great tool, but sometimes things may fall over. These are the equivalents of *Have you tried turning it off an on again?* for Spack:
* Uninstall all versions of the Dune package: `spack uninstall dune`
* Clear all build caches `spack clean -a`
* Remove `$HOME/.spack` (note you need to re-add the Dune repository afterwards: `spack repo add <path-to-dune-spack>`)
If your problem persists, report it on [the issue tracker](https://gitlab.dune-project.org/spack/dune-spack/issues).
A complete log of what is going on would be very much appreciated.
## Acknowledgements
Thank you to Gauthier Foltan for providing very useful hints and implementation on how to map Dune's multi-modular structure to Spack's abstractions.

View File

@ -21,9 +21,12 @@
# ----------------------------------------------------------------------------
import os
from pathlib import Path
from spack import *
try:
from collections.abc import Sequence
except ImportError:
from collections import Sequence
import spack.error as error
class Dune(CMakePackage):
"""
@ -33,73 +36,12 @@ class Dune(CMakePackage):
git = "https://gitlab.dune-project.org/core/dune-common.git"
# This defines a mapping of available versions of the dune Spack package
# and the branch name in the Dune repositories this refers to. This is a
# list instead of a dictionary to ensure iteration order (first entry is
# the default version) in Python3.
dune_versions_to_branch = [
("2.9", "releases/2.9"),
("2.8", "releases/2.8"),
("2.7", "releases/2.7"),
("2.6", "releases/2.6"),
("master" , "master"),
]
# This defines the mapping of the variant names for Dune modules and the
# resource names that we assign later on.
dune_variants_to_resources = {
'alugrid' : 'dune-alugrid',
'codegen' : 'dune-codegen',
'fem' : 'dune-fem',
'foamgrid' : 'dune-foamgrid',
'functions': 'dune-functions',
'gridglue' : 'dune-grid-glue',
'multidomaingrid' : 'dune-multidomaingrid',
'pdelab' : 'dune-pdelab',
'polygongrid' : 'dune-polygongrid',
'spgrid' : 'dune-spgrid',
'testtools' : 'dune-testtools',
'typetree' : 'dune-typetree',
'uggrid' : 'dune-uggrid',
# and the branch name in the Dune repositories this refers to.
dune_versions_to_branch = {
"master" : "master",
"2.7" : "releases/2.7",
}
# Define the inverse mapping
dune_resources_to_variants = {v: k for k, v in dune_variants_to_resources.items()}
# Dependencies between modules - not necessarily the full set
# as the closure of module dependencies is built later on.
# dune-common does not need to be named.
dune_module_dependencies = {
'dune-alugrid': ['dune-grid'],
'dune-codegen': ['dune-pdelab', 'dune-testtools', 'dune-alugrid'],
'dune-fem': ['dune-grid'],
'dune-fempy': ['dune-fem'],
'dune-foamgrid': ['dune-grid'],
'dune-functions': ["dune-grid", "dune-typetree", "dune-localfunctions", "dune-istl"],
'dune-grid': ['dune-geometry'],
'dune-grid-glue': ['dune-grid'],
'dune-localfunctions': ['dune-geometry'],
'dune-multidomaingrid': ['dune-grid', 'dune-typetree'],
'dune-pdelab': ['dune-istl', 'dune-functions'],
'dune-polygongrid': ['dune-grid'],
}
# Build the closure of above module dependency list.
# We need to use cryptic variable names here because
# Spack behaves in weird ways if we accidentally use
# names (like 'module') that are used in seemingly
# unrelated places.
for _mod in dune_module_dependencies:
_closure = set(dune_module_dependencies[_mod])
_old_closure = set()
while (len(_closure) > len(_old_closure)):
_old_closure = _closure.copy()
for _res in _old_closure:
for _m in dune_module_dependencies.get(_res, []):
_closure.add(_m)
dune_module_dependencies[_mod] = list(_closure)
# Variants for the general build process
variant('shared', default=True, description='Enables the build of shared libraries.')
@ -107,225 +49,197 @@ class Dune(CMakePackage):
variant('doc', default=False, description='Build and install documentation')
variant('python', default=False, description='Build with Python bindings')
# Variants for upstream dependencies. Note that we are exposing only very
# costly upstream dependencies as variants. All other upstream dependencies
# are installed unconditionally. This happens in an attempt to limit the total
# number of variants of the dune package to a readable amount. An exception
# to this rule is ParMETIS, which has a variant because of it's semi-free license.
# Variants for upstream dependencies
variant('arpack', default=True, description='Build ARnoldi PACKage library support')
variant('blas', default=True, description='Build with BLAS support')
variant('gmp', default=True, description='Build with GNU multi-precision library support')
variant('lapack', default=True, description='Build with LAPACK support')
variant('metis', default=True, description='Build with METIS library support')
variant('parmetis', default=False, description='Build with ParMETIS support')
variant('petsc', default=False, description='Build with PetSc support')
variant('ptscotch', default=True, description='Build with PT-Scotch support')
variant('sionlib', default=False, description='Build with SIONlib support')
variant('suitesparse', default=True, description='Build SuiteSparse library support')
variant('superlu', default=False, description='Build Supernodal LU library support')
variant('tbb', default=False, description='Build with Intel TBB support')
variant('vc', default=False, description='Build C++ Vectorization library support')
variant('zlib', default=False, description='Build zlib library support')
variant('zoltan', default=False, description='Build with Zoltan support')
# Define one variant for each non-core Dune module that we have.
for var, res in dune_variants_to_resources.items():
variant(var, default=False, description='Build with the %s module' % res)
# Some variants that were here that are on my todo list
# variant('jupyter', default=False, description='Build with Jupyter support')
# Define a multi-valued variant for defining the modules
class dune_module_set(Sequence):
"""Define the possible values for the DUNE modules variants"""
def __init__(self):
self.module_dependencies={}
self.module_dependencies["common"]=[]
self.module_dependencies["geometry"]=["common"]
self.module_dependencies["grid"]=["common","geometry"]
self.module_dependencies["uggrid"]=["common"]
self.module_dependencies["istl"]=["common"]
self.module_dependencies["localfunctions"]=["common","geometry"]
self.module_dependencies["functions"]=["grid","typetree","localfunctions","istl"]
self.module_dependencies["typetree"]=["common"]
self.module_dependencies["python"]=[]
self.module_dependencies["spgrid"]=[]
self.module_dependencies["alugrid"]=["grid","geometry","common"]
self.sets=[]
for key in self.module_dependencies:
self.sets.append(key)
self.feature_values = tuple(self.sets)
self.default = ("common","grid")
self.multi = True
def __getitem__(self, idx):
return self.feature_values[idx]
def __len__(self):
return len(self.feature_values)
@property
def validator(self):
def module_dependency_closure(modlist):
closure = set(modlist)
old_closure = set()
while (len(closure) > len(old_closure)):
old_closure = closure.copy()
for res in old_closure:
for mod in self.module_dependencies.get(res):
closure.add(mod)
return closure
def _dune_modules_set_validator(pkg_name, variant_name, values):
ok=True
msg='Missing module dependencies: '
for s in values:
req_mod=module_dependency_closure({s})
for req in req_mod:
if(not req in values):
msg+=req+','
ok=False
if(ok):
return
msg = msg[:-1]
format_args = {
'variant': variant_name, 'package': pkg_name, 'values': values
}
msg = msg + \
" @*r{{[{package}, variant '{variant}']}}"
msg = llnl.util.tty.color.colorize(msg.format(**format_args))
raise error.SpecError(msg)
return _dune_modules_set_validator
variant( 'modules',
values=dune_module_set(),
description='Installed dune module')
# Define conflicts between Dune module variants. These conflicts are of the following type:
# conflicts('dune~functions', when='+pdelab') -> dune-pdelab cannot be built without dune-functions
for var, res in dune_variants_to_resources.items():
for dep in dune_module_dependencies.get(res, []):
if dep in dune_resources_to_variants:
conflicts('dune~%s' % dune_resources_to_variants[dep], when='+%s' % var)
# Iterate over all available Dune versions and define resources for all Dune modules
# If a Dune module behaves differently for different versions (e.g. dune-python got
# merged into dune-common post-2.7), define the resource outside of this loop.
for _vers, _branch in dune_versions_to_branch:
version(_vers, branch=_branch)
for vers, branch in dune_versions_to_branch.items():
version(vers, branch=dune_versions_to_branch[vers])
resource(
name='dune-geometry',
git='https://gitlab.dune-project.org/core/dune-geometry.git',
branch=_branch,
when='@%s' % _vers,
branch=branch,
when='@%s modules=geometry' % vers,
)
resource(
name='dune-grid',
git='https://gitlab.dune-project.org/core/dune-grid.git',
branch=_branch,
when='@%s' % _vers,
branch=branch,
when='@%s modules=grid' % vers,
)
resource(
name='dune-istl',
git='https://gitlab.dune-project.org/core/dune-istl.git',
branch=_branch,
when='@%s' % _vers,
branch=branch,
when='@%s modules=istl' % vers,
)
resource(
name='dune-localfunctions',
git='https://gitlab.dune-project.org/core/dune-localfunctions.git',
branch=_branch,
when='@%s' % _vers,
branch=branch,
when='@%s modules=localfunctions' % vers,
)
resource(
name='dune-functions',
git='https://gitlab.dune-project.org/staging/dune-functions.git',
branch=_branch,
when='@%s+functions' % _vers,
branch=branch,
when='@%s modules=functions' % vers,
)
resource(
name='dune-typetree',
git='https://gitlab.dune-project.org/staging/dune-typetree.git',
branch=_branch,
when='@%s+typetree' % _vers,
branch=branch,
when='@%s modules=typetree' % vers,
)
resource(
name='dune-alugrid',
git='https://gitlab.dune-project.org/extensions/dune-alugrid.git',
branch=_branch,
when='@%s+alugrid' % _vers,
branch=branch,
when='@%s modules=alugrid' % vers,
)
resource(
name='dune-uggrid',
git='https://gitlab.dune-project.org/staging/dune-uggrid.git',
branch=_branch,
when='@%s+uggrid' % _vers,
branch='releases/2.7',
when='@%s modules=uggrid' % vers,
)
resource(
name='dune-spgrid',
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
branch=_branch,
when='@%s+spgrid' % _vers,
branch=branch,
when='@%s modules=spgrid' % vers,
)
resource(
name='dune-testtools',
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
branch=_branch,
when='@%s+testtools' % _vers,
)
resource(
name='dune-polygongrid',
git='https://gitlab.dune-project.org/extensions/dune-polygongrid.git',
branch=_branch,
when='@%s+polygongrid' % _vers,
)
resource(
name='dune-foamgrid',
git='https://gitlab.dune-project.org/extensions/dune-foamgrid.git',
branch=_branch,
when='@%s+foamgrid' % _vers,
)
resource(
name='dune-multidomaingrid',
git='https://gitlab.dune-project.org/extensions/dune-multidomaingrid.git',
branch=_branch,
when='@%s+multidomaingrid' % _vers,
)
resource(
name='dune-fem',
git='https://gitlab.dune-project.org/dune-fem/dune-fem.git',
branch=_branch,
when='@%s+fem' % _vers,
)
resource(
name='dune-fempy',
git='https://gitlab.dune-project.org/dune-fem/dune-fempy.git',
branch=_branch,
when='@%s+fem+python' % _vers,
)
resource(
name='dune-pdelab',
git='https://gitlab.dune-project.org/pdelab/dune-pdelab.git',
branch=_branch,
when='@%s+pdelab' % _vers,
)
# The dune-grid-glue package does not yet have a 2.7-compatible release
resource(
name='dune-grid-glue',
git='https://gitlab.dune-project.org/extensions/dune-grid-glue.git',
branch=_branch,
when='@%s+gridglue' % _vers,
)
# The dune-python package migrated to dune-common after the 2.7 release
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch='releases/2.7',
when='@2.7+python',
)
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch='releases/2.6',
when='@2.6+python',
branch=branch,
when='@2.7 modules=python',
)
# The dune-codegen package does not have a 2.6-compatible release
resource(
name='dune-codegen',
git='https://gitlab.dune-project.org/extensions/dune-codegen.git',
branch='master',
when='@master+codegen',
submodules=True,
)
resource(
name='dune-codegen',
git='https://gitlab.dune-project.org/extensions/dune-codegen.git',
branch='releases/2.7',
when='@2.7+codegen',
submodules=True,
)
conflicts('dune@2.6', when='+codegen')
# Make sure that Python components integrate well into Spack
extends('python')
python_components = [ 'dune' ]
# Specify upstream dependencies (often depending on variants)
depends_on('amgx', when='+fem+petsc')
depends_on('arpack-ng')
depends_on('benchmark', when='+codegen')
depends_on('blas')
depends_on('arpack-ng', when='+arpack')
depends_on('blas', when='+blas')
depends_on('cmake@3.1:', type='build')
depends_on('eigen', when='+fem')
depends_on('eigen', when='+pdelab')
depends_on('papi', when='+fem')
depends_on('doxygen', type='build', when='+doc')
depends_on('gawk')
depends_on('gmp')
depends_on('gmp', when='+gmp')
depends_on('intel-tbb', when='+tbb')
depends_on('lapack')
# depends_on('likwid', when='+codegen') likwid cannot be built in spack v0.14.2 due to the lua dependency being broken
depends_on('lapack', when='+lapack')
depends_on('metis', when='+metis')
depends_on('mpi')
depends_on('parmetis', when='+parmetis')
depends_on('petsc', when='+petsc')
depends_on('pkg-config', type='build')
depends_on('python@3.0:', type=('build', 'run'))
depends_on('python@3.0:', type=('build', 'run'), when='+python')
depends_on('py-setuptools', type='build', when='+python')
depends_on('py-numpy', type=('build', 'run'), when='+python')
depends_on('py-pip', type=('build', 'run'))
depends_on('py-pip', type=('build', 'run'), when='+python')
depends_on('py-sphinx', type=('build', 'run'), when='+doc')
depends_on('py-wheel', type='build')
depends_on('scotch+mpi')
depends_on('suite-sparse')
depends_on('superlu')
depends_on('vc')
depends_on('zlib', when='+alugrid')
depends_on('zoltan', when='+alugrid')
# Apply patches
patch('virtualenv_from_envvariable.patch', when='+testtools')
patch('pdelab_2.6_update_cmake.patch', when='@2.6+pdelab', working_dir= 'dune-pdelab')
depends_on('py-wheel', type='build', when='+python')
depends_on('scotch+mpi', when='+ptscotch')
depends_on('sionlib', when='+sionlib')
depends_on('suite-sparse', when='+suitesparse')
depends_on('superlu', when='+superlu')
depends_on('vc', when='+vc')
depends_on('zlib', when='+zlib')
depends_on('zoltan', when='+zoltan')
def setup_build_environment(self, env):
# We reset the DUNE_CONTROL_PATH here because any entries in this
@ -341,12 +255,7 @@ class Dune(CMakePackage):
# Additionally, we need to set the workspace for the Python bindings to something
# that is unique to this build of the dune module (it defaults to ~/.cache)
if '+python' in self.spec:
env.set('DUNE_PY_DIR', join_path(Path.home(), '.cache', 'dune-py', self.spec.dag_hash()))
# For those modules that typically work with the Dune Virtualenv,
# we export the location of the virtualenv as an environment variable.
if '+testtools' in self.spec:
env.set('DUNE_PYTHON_VIRTUALENV_PATH', join_path(Path.home(), '.cache', 'dune-python-env', self.spec.dag_hash()))
env.set('DUNE_PY_DIR', self.prefix)
def cmake_args(self):
"""Populate cmake arguments."""
@ -362,21 +271,25 @@ class Dune(CMakePackage):
return variant_bool(feature, on='OFF', off='ON')
cmake_args = [
'-DCMAKE_BUILD_TYPE:STRING=%s' % self.spec.variants['build_type'].value,
'-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'),
'-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=ON',
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen:BOOL=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX:BOOL=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS:BOOL=%s' % nvariant_bool('+parmetis'),
'-DCMAKE_DISABLE_FIND_PACKAGE_BLAS=%s' % nvariant_bool('+blas'),
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_GMP=%s' % nvariant_bool('+gmp'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LAPACK=%s' % nvariant_bool('+lapack'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_METIS=%s' % nvariant_bool('+metis'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS=%s' % nvariant_bool('+parmetis'),
'-DCMAKE_DISABLE_FIND_PACKAGE_PTScotch=%s' % nvariant_bool('+ptscotch'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SIONLib=%s' % nvariant_bool('+sionlib'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SuiteSparse=%s' % nvariant_bool('+suitesparse'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=%s' % nvariant_bool('+superlu'),
# '-DCMAKE_DISABLE_FIND_PACKAGE_TBB=%s' % nvariant_bool('+tbb'), Disabled until upstream fix of dune-common#205.
'-DCMAKE_DISABLE_FIND_PACKAGE_VC=%s' % nvariant_bool('+vc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=%s' % nvariant_bool('+zlib'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=%s' % nvariant_bool('+zoltan'),
]
if '+testtools' in spec:
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_SETUP:BOOL=ON')
cmake_args.append('-DDUNE_PYTHON_ALLOW_GET_PIP:BOOL=ON')
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_PATH:STRING="%s"' % join_path(Path.home(), '.cache', 'dune-python-env', self.spec.dag_hash()))
cmake_args.append('-DDUNE_PYTHON_INSTALL_LOCATION:STRING="system"')
if '+python' in spec:
if '@2.7' not in spec:
cmake_args.append('-DDUNE_ENABLE_PYTHONBINDINGS:BOOL=TRUE')
@ -386,12 +299,6 @@ class Dune(CMakePackage):
return cmake_args
def cmake(self, spec, prefix):
# dune-codegen delivers its own set of patches for its submodules
# that we can apply with a script delivered by dune-codegen.
if '+codegen' in self.spec:
with working_dir(join_path(self.root_cmakelists_dir, 'dune-codegen')):
Executable('patches/apply_patches.sh')()
# Write an opts file for later use
with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile:
optFile.write('CMAKE_FLAGS="')
@ -402,13 +309,7 @@ class Dune(CMakePackage):
installer = Executable('bin/dunecontrol')
options_file = join_path(self.stage.source_path, "..", "dune.opts")
# The 'cmake' command of dunecontrol was added in 2.7
commandname = 'cmake'
if '@2.6' in self.spec:
commandname = 'configure'
installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, commandname)
installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, 'cmake')
def install(self, spec, prefix):
installer = Executable('bin/dunecontrol')

View File

@ -1,44 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc069408..3971e6aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
project("dune-pdelab" C CXX)
# general stuff
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.6)
# guess dune-common build dir
if(NOT (dune-common_DIR OR dune-common_ROOT OR
@@ -25,26 +25,18 @@ dune_project()
# Disable the upstream testing magic, that builds tests during "make test"
set(DUNE_TEST_MAGIC OFF)
-# To have enable all packages work with cmake-2.8, the module
-# libraries need to be added before the call to dune_enable_all_packages()
-# With cmake 3.1, one would use the MODULE_LIBRARIES argument of
-# dune_enable_all_packages() instead.
+# Use the enable all packages feature
+dune_enable_all_packages(MODULE_LIBRARIES dunepdelab)
if(NOT MINGW)
set(clock_cc "dune/pdelab/common/clock.cc")
endif()
-dune_add_library(dunepdelab
+dune_library_add_sources(dunepdelab SOURCES
${clock_cc}
dune/pdelab/common/hostname.cc
dune/pdelab/common/logtag.cc
- )
-dune_target_enable_all_packages(dunepdelab)
-
-dune_register_package_flags(LIBRARIES dunepdelab)
-
-# Use the enable all packages feature
-dune_enable_all_packages()
+)
add_subdirectory(doc)
add_subdirectory(dune/pdelab)

View File

@ -1,30 +0,0 @@
diff --git a/cmake/modules/DunePythonCommonMacros.cmake b/cmake/modules/DunePythonCommonMacros.cmake
index 6f8ff307..93ea3e9c 100644
--- a/cmake/modules/DunePythonCommonMacros.cmake
+++ b/cmake/modules/DunePythonCommonMacros.cmake
@@ -149,6 +149,10 @@ function(dune_python_require_virtualenv_setup)
endif()
endfunction()
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
+ set(DUNE_PYTHON_VIRTUALENV_SETUP 1)
+endif()
+
# If requested, switch into DunePythonVirtualenv.cmake and setup the virtualenv.
if(DUNE_PYTHON_VIRTUALENV_SETUP)
include(DunePythonVirtualenv)
diff --git a/cmake/modules/DunePythonVirtualenv.cmake b/cmake/modules/DunePythonVirtualenv.cmake
index 8a09676f..96cb5954 100644
--- a/cmake/modules/DunePythonVirtualenv.cmake
+++ b/cmake/modules/DunePythonVirtualenv.cmake
@@ -81,6 +81,10 @@ set(DUNE_PYTHON_EXTERNAL_VIRTUALENV_FOR_ABSOLUTE_BUILDDIR ON CACHE BOOL
"Place Python virtualenv in top-level directory \"dune-python-env\" when using an absolute build directory"
)
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
+ set(DUNE_PYTHON_VIRTUALENV_PATH "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}")
+endif()
+
if(DUNE_PYTHON_VIRTUALENV_PATH STREQUAL "")
foreach(mod ${ALL_DEPENDENCIES})
if(IS_DIRECTORY ${${mod}_DIR}/dune-env)