@@ -27,6 +27,8 @@ module fpm_installer
27
27
character (len= :), allocatable :: testdir
28
28
! > Include directory relative to the installation prefix
29
29
character (len= :), allocatable :: includedir
30
+ ! > Module directory relative to the installation prefix
31
+ character (len= :), allocatable :: moduledir
30
32
! > Output unit for informative printout
31
33
integer :: unit = output_unit
32
34
! > Verbosity of the installer
@@ -46,6 +48,8 @@ module fpm_installer
46
48
procedure :: install_library
47
49
! > Install a header/module in its correct subdirectory
48
50
procedure :: install_header
51
+ ! > Install a module in its correct subdirectory
52
+ procedure :: install_module
49
53
! > Install a test program in its correct subdirectory
50
54
procedure :: install_test
51
55
! > Install a generic file into a subdirectory in the installation prefix
@@ -69,6 +73,9 @@ module fpm_installer
69
73
! > Default name of the include subdirectory
70
74
character (len=* ), parameter :: default_includedir = " include"
71
75
76
+ ! > Default name of the module subdirectory
77
+ character (len=* ), parameter :: default_moduledir = " include"
78
+
72
79
! > Copy command on Unix platforms
73
80
character (len=* ), parameter :: default_copy_unix = " cp"
74
81
@@ -90,7 +97,7 @@ module fpm_installer
90
97
contains
91
98
92
99
! > Create a new instance of an installer
93
- subroutine new_installer (self , prefix , bindir , libdir , includedir , testdir , verbosity , &
100
+ subroutine new_installer (self , prefix , bindir , libdir , includedir , moduledir , testdir , verbosity , &
94
101
copy , move )
95
102
! > Instance of the installer
96
103
type (installer_t), intent (out ) :: self
@@ -102,6 +109,8 @@ subroutine new_installer(self, prefix, bindir, libdir, includedir, testdir, verb
102
109
character (len=* ), intent (in ), optional :: libdir
103
110
! > Include directory relative to the installation prefix
104
111
character (len=* ), intent (in ), optional :: includedir
112
+ ! > Module directory relative to the installation prefix
113
+ character (len=* ), intent (in ), optional :: moduledir
105
114
! > Test directory relative to the installation prefix
106
115
character (len=* ), intent (in ), optional :: testdir
107
116
! > Verbosity of the installer
@@ -139,6 +148,12 @@ subroutine new_installer(self, prefix, bindir, libdir, includedir, testdir, verb
139
148
else
140
149
self% includedir = default_includedir
141
150
end if
151
+
152
+ if (present (moduledir)) then
153
+ self% moduledir = moduledir
154
+ else
155
+ self% moduledir = default_moduledir
156
+ end if
142
157
143
158
if (present (testdir)) then
144
159
self% testdir = testdir
@@ -288,6 +303,18 @@ subroutine install_header(self, header, error)
288
303
call self% install(header, self% includedir, error)
289
304
end subroutine install_header
290
305
306
+ ! > Install a module in its correct subdirectory
307
+ subroutine install_module (self , module , error )
308
+ ! > Instance of the installer
309
+ class(installer_t), intent (inout ) :: self
310
+ ! > Path to the module
311
+ character (len=* ), intent (in ) :: module
312
+ ! > Error handling
313
+ type (error_t), allocatable , intent (out ) :: error
314
+
315
+ call self% install(module , self% moduledir, error)
316
+ end subroutine install_module
317
+
291
318
! > Install a generic file into a subdirectory in the installation prefix
292
319
subroutine install (self , source , destination , error )
293
320
! > Instance of the installer
0 commit comments