v0.15.0
Loading...
Searching...
No Matches
package.py
Go to the documentation of this file.
1# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
2# Spack Project Developers. See the top-level COPYRIGHT file for details.
3#
4# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5
6
7from spack.package import *
8from spack.pkg.builtin.boost import Boost
9
10
12 """MoFEM is finite element core library"""
13
14 homepage = "http://mofem.eng.gla.ac.uk"
15 git = "https://bitbucket.org/mofem/mofem-cephas.git"
16
17 maintainers = ['likask']
18
19 # Development versions
20 version('master', branch='master')
21 version('develop', branch='develop')
22 version('lukasz', branch='lukasz/develop')
23 version('newpetsc', branch='lukasz/newpetsc')
24 version('lukasz_eshelby', branch='lukasz/eshelby')
25 # Versions
26 version('0.15.0', branch='Version0.15.0')
27 version('0.14.0', branch='Version0.14.0')
28 version('0.13.2', branch='Version0.13.2')
29 version('0.13.0', branch='Version0.13.0')
30 version('0.12.1', branch='Version0.12.1')
31 version('0.12.0', branch='Version0.12.0')
32 version('0.11.1', branch='Version0.11.1')
33 version('0.11.0', branch='Version0.11.0')
34 version('0.10.0', branch='Version0.10.0')
35 version('0.9.2', branch='Version0.9.2')
36 version('0.9.1', tag='v0.9.1-release')
37 version('0.9.0', tag='v0.9.0')
38 version('0.8.23', tag='v0.8.23')
39 version('0.8.22', tag='v0.8.22')
40 version('0.8.21', tag='v0.8.21')
41 version('0.8.20', tag='v0.8.20')
42 version('0.8.19', tag='v0.8.19')
43 version('0.8.18', tag='v0.8.18')
44 version('0.8.17', tag='v0.8.17')
45 version('0.8.16', tag='v0.8.16')
46 version('0.8.15', tag='v0.8.15')
47 version('0.8.14', tag='v0.8.14')
48 version('0.8.13', tag='v0.8.13')
49 version('0.8.12', tag='v0.8.12')
50 version('0.8.11', tag='v0.8.11')
51 version('0.8.10', tag='v0.8.10')
52 version('0.8.9', tag='v0.8.9')
53 version('0.8.8', tag='v0.8.8')
54 version('0.8.7', tag='v0.8.7')
55
56 variant('shared', default=False,
57 description='Builds a shared version of the library')
58
59 # This option can be only used for development of core lib
60 variant('install_id', default="0",
61 description='Internal install ID used by Jenkins')
62 variant('copy_user_modules', default=True,
63 description='Copy user modules directory instead linking to source')
64 variant('adol-c', default=True, description='Compile with ADOL-C')
65 variant('tetgen', default=True, description='Compile with Tetgen')
66 variant('med', default=True, description='Compile with Med')
67 variant('slepc', default=True, description='Compile with Slepc')
68 variant('mgis', default=True, description='Compile with MGIS')
69
70 # Build variants
71 variant('build_tutorials', default=True, description='Build tutorials')
72
73 # build dependencies
74 depends_on('pkgconfig', type='build')
75
76 # boost
77 depends_on('boost@:1.69 +shared cxxstd=14', when='@0.8.7:0.13.0')
78 depends_on('boost@:1.77 +shared cxxstd=17', when='@0.13.0:0.14.99')
79 depends_on('boost@:1.83 +shared cxxstd=17', when='@0.15.0:')
80 depends_on('boost@:1.83 +shared cxxstd=17', when='@master')
81 depends_on('boost@:1.83 +shared cxxstd=17', when='@develop')
82 depends_on('boost@:1.83 +shared cxxstd=17', when='@lukasz')
83
84 # TODO: replace this with an explicit list of components of Boost,
85 # for instance depends_on('boost +filesystem')
86 # See https://github.com/spack/spack/pull/22303 for reference
87 depends_on(Boost.with_default_variants)
88
89 # mpi an other
90 depends_on('mpi')
91
92 # PETSC install
93 depends_on('petsc@:3.22.99+mumps+mpi')
94 depends_on('slepc@:3.22.99')
95 # petsc@:3.11.99
96 depends_on('petsc@:3.11.99+mumps+mpi', when='@0.8.7:0.10.0')
97 depends_on('slepc@:3.11.99', when='@0.8.7:0.10.0 +slepc')
98 # petsc@:3.14.99
99 depends_on('petsc@:3.14.99+mumps+mpi', when='@0.11.0:0.11.99')
100 depends_on('slepc@:3.14.99', when='@0.11.0:0.11.99 +slepc')
101 # petsc@:3.16.99
102 depends_on('petsc@:3.16.99+mumps+mpi', when='@0.12.0:0.14.99')
103 depends_on('slepc@:3.16.99', when='@0.12.0:0.14.99 +slepc')
104 depends_on('petsc@:3.16.99+mumps+mpi', when='@master')
105 depends_on('slepc@:3.16.99', when='@master +slepc')
106 # petsc@:3.22.99
107 depends_on('petsc@3.22.0:3.22.99+mumps+mpi', when='@0.15.0:')
108 depends_on('slepc@3.22.0:3.22.99', when='@0.15.0: +slepc')
109 depends_on('petsc@:3.22.99+mumps+mpi', when='@develop')
110 depends_on('slepc@:3.22.99', when='@develop +slepc')
111 depends_on('petsc@:3.22.99+mumps+mpi', when='@lukasz')
112 depends_on('slepc@:3.22.99', when='@lukasz +slepc')
113 # New
114 depends_on('petsc+mumps+mpi', when='@newpetsc')
115 depends_on('slepc', when='@newpetsc +slepc')
116
117 # MOAB install
118 depends_on('moab@:5.1.0 +shared', when='@0.8.7:0.9.1')
119 depends_on('moab +shared', when='@0.9.2:')
120 depends_on('moab +shared', when='@master')
121 depends_on('moab +shared', when='@develop')
122 depends_on('moab +shared', when='@lukasz')
123 depends_on('moab +shared', when='@newpetsc')
124
125 # Other dependencies
126 depends_on('adol-c~examples', when='+adol-c')
127 depends_on('tetgen', when='+tetgen')
128 depends_on('parmetis')
129 depends_on('blas')
130
131 # MED install
132 depends_on('med', when='+med')
133 depends_on('med@:3.99.99', when='+med @0.8.7:0.9.0')
134 depends_on('med@4.1.0:', when='+med @0.9.1:')
135 depends_on('med@4.1.0:', when='+med @master')
136 depends_on('med@4.1.0:', when='+med @develop')
137 depends_on('med@4.1.0:', when='+med @lukasz')
138
139 # Add MGIS
140 depends_on('mgis~python~fortran', when='+mgis')
141 depends_on('tfel~python~python_bindings~fortran', when='+mgis')
142
143 extendable = True
144
145 root_cmakelists_dir = "mofem"
146
148 env.set('CTEST_OUTPUT_ON_FAILURE', '1')
149
150 @property
152 spec = self.spec
153 build_type = spec.variants['build_type'].value
154 build_dir = 'core-build-%s-%s' % (build_type,spec.dag_hash(7))
155 return join_path(self.stage.path, build_dir)
156
157 def cmake_args(self):
158 spec = self.spec
159 options = []
160
161 # obligatory options
162 options.extend([
163 '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
164 '-DMPI_RUN_FLAGS:STRING=--allow-run-as-root',
165 '-DWITH_SPACK:BOOL=YES',
166 '-DPETSC_DIR:PATH=%s' % spec['petsc'].prefix,
167 '-DPETSC_ARCH:STRING=',
168 '-DMOAB_DIR:PATH=%s' % spec['moab'].prefix,
169 '-DBOOST_DIR:PATH=%s' % spec['boost'].prefix,
170 '-DBLAS_DIR:PATH=%s' % spec['blas'].prefix])
171
172 # variant packages
173 if '+adol-c' in spec:
174 options.append('-DADOL-C_DIR:PATH=%s' % spec['adol-c'].prefix)
175
176 if '+tetgen' in spec:
177 options.append('-DTETGEN_DIR:PATH=%s' % spec['tetgen'].prefix)
178
179 if '+med' in spec:
180 options.append('-DMED_DIR:PATH=%s' % spec['med'].prefix)
181
182 if '+slepc' in spec:
183 options.append('-DSLEPC_DIR:PATH=%s' % spec['slepc'].prefix)
184
185 if '+mgis' in spec:
186 options.append('-DMGIS_DIR:PATH=%s' % spec['mgis'].prefix)
187 options.append('-DTFEL_DIR:PATH=%s' % spec['tfel'].prefix)
188
189 # copy users modules, i.e. stand alone vs linked users modules
190 options.append(
191 self.define_from_variant(
192 'STAND_ALLONE_USERS_MODULES', 'copy_user_modules'))
193
194 options.append(
195 self.define_from_variant('BUILD_SHARED_LIBS', 'shared'))
196
197 if spec['boost'].satisfies('+shared'):
198 options.append(self.define('Boost_USE_STATIC_LIBS', False))
199 else:
200 options.append(self.define('Boost_USE_STATIC_LIBS', True))
201
202 options.append(
203 self.define_from_variant('BUILD_TUTORIALS', 'build_tutorials'))
204
205 return options
206
207 def check(self):
208 """Searches the CMake-generated Makefile for the target ``test``
209 and runs it if found.
210 """
211 with working_dir(self.build_directorybuild_directory):
212 ctest('--output-on-failure', parallel=False)
setup_build_environment(self, env)
Definition package.py:147