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
|
##############################################################################
# Copyright (c) 2018 Mark Olesen, OpenCFD Ltd.
#
# This file was authored by Mark Olesen <mark.olesen@esi-group.com>
# and is released as part of spack under the LGPL license.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for the LLNL notice and LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
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
|