Skip to content

Commit 1960157

Browse files
committed
add module-dir to the install table
1 parent b9d11e6 commit 1960157

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/fpm/manifest/install.f90

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
!>
55
!>```toml
66
!>library = bool
7+
!>module-dir = "path"
78
!>```
89
module fpm_manifest_install
910
use fpm_error, only : error_t, fatal_error, syntax_error
1011
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
1213
implicit none
1314
private
1415

@@ -23,6 +24,9 @@ module fpm_manifest_install
2324
!> Install tests with this project
2425
logical :: test = .false.
2526

27+
!> Directory where compiled module files should be installed
28+
character(len=:), allocatable :: module_dir
29+
2630
contains
2731

2832
!> Print information on this instance
@@ -56,6 +60,7 @@ subroutine new_install_config(self, table, error)
5660

5761
call get_value(table, "library", self%library, .false.)
5862
call get_value(table, "test", self%test, .false.)
63+
call get_value(table, "module-dir", self%module_dir)
5964

6065
end subroutine new_install_config
6166

@@ -80,7 +85,7 @@ subroutine check(table, error)
8085
case default
8186
call syntax_error(error, "Key "//list(ikey)%key//" is not allowed in install table")
8287
exit
83-
case("library","test")
88+
case("library","test","module-dir")
8489
continue
8590
end select
8691
end do
@@ -114,6 +119,9 @@ subroutine info(self, unit, verbosity)
114119
write(unit, fmt) "Install configuration"
115120
write(unit, fmt) " - library install", trim(merge("enabled ", "disabled", self%library))
116121
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
117125

118126
end subroutine info
119127

@@ -127,6 +135,10 @@ logical function install_conf_same(this,that)
127135
type is (install_config_t)
128136
if (this%library.neqv.other%library) return
129137
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
130142
class default
131143
! Not the same type
132144
return
@@ -155,6 +167,9 @@ subroutine dump_to_toml(self, table, error)
155167
call set_value(table, "test", self%test, error, class_name)
156168
if (allocated(error)) return
157169

170+
call set_string(table, "module-dir", self%module_dir, error, class_name)
171+
if (allocated(error)) return
172+
158173
end subroutine dump_to_toml
159174

160175
!> Read install config from toml table (no checks made at this stage)
@@ -175,6 +190,8 @@ subroutine load_from_toml(self, table, error)
175190
if (allocated(error)) return
176191
call get_value(table, "test", self%test, error, class_name)
177192
if (allocated(error)) return
193+
call get_value(table, "module-dir", self%module_dir)
194+
if (allocated(error)) return
178195

179196
end subroutine load_from_toml
180197

0 commit comments

Comments
 (0)