v0.16.3
Loading...
Searching...
No Matches
package.py
Go to the documentation of this file.
1# Copyright (c) 2022 [Authors](http://mofem.eng.gla.ac.uk/mofem/html/authors.html)
2#
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9#
10# The above copyright notice and this permission notice shall be included in all
11# copies or substantial portions of the Software.
12#
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20#
21# [MIT License](https://opensource.org/licenses/MIT)#
22
23
24from spack import *
25
26
27class MofemUmAgeingUmat(CMakePackage):
28 """MoFEM user module for an ageing UMAT."""
29
30 homepage = "http://mofem.eng.gla.ac.uk"
31 git = "https://bitbucket.org/mofem/um_ageing_umat.git"
32
33 maintainers = ['Ananya']
34
35 version("develop", branch="develop")
36 version("0.16.3", branch="Version0.16.3")
37
38 variant('copy_user_modules', default=True,
39 description='Copy user modules directory instead linking')
40
41 extends('mofem-cephas')
42
43 depends_on("mofem-cephas@develop", when="@develop")
44 depends_on("mofem-cephas@0.16.3:", when="@0.16.3")
45
46
48 env.set('CTEST_OUTPUT_ON_FAILURE', '1')
49
50 # The CMakeLists.txt installed with mofem-cephas package set cmake
51 # environment to install extension from extension repository. It searches
52 # for modules in user provides paths, for example in Spack source path.Also
53 # it finds all cmake exported targets installed in lib directory, which are
54 # built with dependent extensions, f.e. mofem - users - modules or others if
55 # needed.
56 @property
58 """The relative path to the directory containing CMakeLists.txt
59
60 This path is relative to the root of the extracted tarball,
61 not to the ``build_directory``. Defaults to the current directory.
62
63 :return: directory containing CMakeLists.txt
64 """
65 spec = self.spec
66 return spec['mofem-cephas'].prefix.include.cmake.users_modules
67
68 @property
69 def build_directory(self):
70 spec = self.spec
71 build_type = spec.variants['build_type'].value
72 build_dir = 'users_modules/um_ageing_umat'
73 return join_path(self.stage.path, build_dir)
74
75 def cmake_args(self):
76 spec = self.spec
77 from_variant = self.define_from_variant
78
79 options = []
80
81 # obligatory options
82 options.extend([
83 '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
84 '-DMPI_RUN_FLAGS=--allow-run-as-root',
85 '-DWITH_SPACK=YES'])
86 options.append(self.define(
87 'MOFEM_DIR', spec['mofem-cephas'].prefix))
88 options.append(self.define(
89 'EXTERNAL_MODULE_SOURCE_DIRS', self.stage.source_path))
90
91 # build tests
92 options.append(self.define('MOFEM_UM_BUILD_TESTS', self.run_tests))
93
94 return options
95
96 # This function is not needed to run code installed by extension, nor in
97 # the install process. However, for users like to have access to source
98 # code to play, change and make it. Having source code at hand one can
99 # compile in own build directory it in package view when the extension is
100 # activated.
101 @run_after('install')
103 source = self.stage.source_path
104 prefix = self.prefix
105 install_tree(source, prefix.ext_users_modules.um_ageing_umat)
setup_build_environment(self, env)
Definition package.py:47