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