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
|
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Precice(CMakePackage):
"""preCICE (Precise Code Interaction Coupling Environment) is a
coupling library for partitioned multi-physics simulations.
Partitioned means that preCICE couples existing programs (solvers)
capable of simulating a subpart of the complete physics involved in
a simulation."""
homepage = 'https://www.precice.org'
git = 'https://github.com/precice/precice.git'
# Skip version 1.1.1 entirely, the cmake was lacking install.
version('develop', branch='develop')
variant('mpi', default=True, description='Enable MPI support')
variant('petsc', default=False, description='Enable PETSc support')
variant('python', default=False, description='Enable Python support')
variant('shared', default=True, description='Build shared libraries')
# Not yet
# variant(
# 'float', default=False,
# description='Use single precision for field data exchange')
# variant(
# 'int64',
# default=False, description='Use 64-bit integers for indices')
depends_on('cmake@3.5:', type='build')
depends_on('boost@1.60.0:')
depends_on('eigen@3.2:')
# Implicit via eigen, don't over-constrain: depends_on('libxml2')
depends_on('mpi', when='+mpi')
depends_on('petsc', when='+petsc')
depends_on('python@2.7', when='+python', type=('build', 'run'))
def cmake_args(self):
"""Populate cmake arguments for precice."""
spec = self.spec
def variant_bool(feature, on='ON', off='OFF'):
"""Ternary for spec variant to ON/OFF string"""
if feature in spec:
return on
return off
cmake_args = [
'-DMPI:BOOL=%s' % variant_bool('+mpi'),
'-DPETSC:BOOL=%s' % variant_bool('+petsc'),
'-DPYTHON:BOOL=%s' % variant_bool('+python'),
'-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'),
]
return cmake_args
|