4
4
! >
5
5
! >```toml
6
6
! >library = bool
7
+ ! >module-dir = "path"
7
8
! >```
8
9
module fpm_manifest_install
9
10
use fpm_error, only : error_t, fatal_error, syntax_error
10
11
use tomlf, only : toml_table, toml_key, toml_stat
11
- use fpm_toml, only : get_value, set_value, serializable_t
12
+ use fpm_toml, only : get_value, set_value, serializable_t, set_string
12
13
implicit none
13
14
private
14
15
@@ -23,6 +24,9 @@ module fpm_manifest_install
23
24
! > Install tests with this project
24
25
logical :: test = .false.
25
26
27
+ ! > Directory where compiled module files should be installed
28
+ character (len= :), allocatable :: module_dir
29
+
26
30
contains
27
31
28
32
! > Print information on this instance
@@ -56,6 +60,7 @@ subroutine new_install_config(self, table, error)
56
60
57
61
call get_value(table, " library" , self% library, .false. )
58
62
call get_value(table, " test" , self% test, .false. )
63
+ call get_value(table, " module-dir" , self% module_dir)
59
64
60
65
end subroutine new_install_config
61
66
@@ -80,7 +85,7 @@ subroutine check(table, error)
80
85
case default
81
86
call syntax_error(error, " Key " // list(ikey)% key// " is not allowed in install table" )
82
87
exit
83
- case (" library" ," test" )
88
+ case (" library" ," test" , " module-dir " )
84
89
continue
85
90
end select
86
91
end do
@@ -114,6 +119,9 @@ subroutine info(self, unit, verbosity)
114
119
write (unit, fmt) " Install configuration"
115
120
write (unit, fmt) " - library install" , trim (merge (" enabled " , " disabled" , self% library))
116
121
write (unit, fmt) " - test install" , trim (merge (" enabled " , " disabled" , self% test))
122
+ if (allocated (self% module_dir)) then
123
+ write (unit, fmt) " - module directory" , self% module_dir
124
+ end if
117
125
118
126
end subroutine info
119
127
@@ -127,6 +135,10 @@ logical function install_conf_same(this,that)
127
135
type is (install_config_t)
128
136
if (this% library.neqv. other% library) return
129
137
if (this% test.neqv. other% test) return
138
+ if (allocated (this% module_dir).neqv. allocated (other% module_dir)) return
139
+ if (allocated (this% module_dir)) then
140
+ if (.not. (this% module_dir== other% module_dir)) return
141
+ end if
130
142
class default
131
143
! Not the same type
132
144
return
@@ -155,6 +167,9 @@ subroutine dump_to_toml(self, table, error)
155
167
call set_value(table, " test" , self% test, error, class_name)
156
168
if (allocated (error)) return
157
169
170
+ call set_string(table, " module-dir" , self% module_dir, error, class_name)
171
+ if (allocated (error)) return
172
+
158
173
end subroutine dump_to_toml
159
174
160
175
! > Read install config from toml table (no checks made at this stage)
@@ -175,6 +190,8 @@ subroutine load_from_toml(self, table, error)
175
190
if (allocated (error)) return
176
191
call get_value(table, " test" , self% test, error, class_name)
177
192
if (allocated (error)) return
193
+ call get_value(table, " module-dir" , self% module_dir)
194
+ if (allocated (error)) return
178
195
179
196
end subroutine load_from_toml
180
197
0 commit comments